As previous answers didn't work well (it was good, but not enough) for me on a 14.04 Ubuntu Server, I mention these recommendations (this is a quote).
Edit: note that as @jason-faust mentioned it in the comments, on 14.04, the authbind package that ships with it does support IPv6 now, so the prefer IPv4 thing isn't needed any longer.
1) Install authbind
2) Make port 80 available to authbind (you need to be root):
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown tomcat7 /etc/authbind/byport/80
3) Make IPv4 the default (authbind does not currently support IPv6).
To do so, create the file TOMCAT/bin/setenv.sh with the following content:
CATALINA_OPTS="-Djava.net.preferIPv4Stack=true"
4) Change /usr/share/tomcat7/bin/startup.sh
exec authbind --deep "$PRGDIR"/"$EXECUTABLE" start "$@"
# OLD: exec "$PRGDIR"/"$EXECUTABLE" start "$@"
If you already got a setenv.sh file in /usr/share/tomcat7/bin with CATALINA_OPTS, you have to use :
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 120G 0 disk
`-xvda1 202:1 0 8G 0 part /
~$ sudo parted /dev/xvda resizepart 1
Warning: Partition /dev/xvda1 is being used. Are you sure you want to continue?
Yes/No? yes
End? [8590MB]? 120G
Information: You may need to update /etc/fstab.
~$ sudo /sbin/resize2fs /dev/xvda1
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 7
The filesystem on /dev/xvda1 is now 29296875 (4k) blocks long.
First check the partition layout. In the following example we have a 30GB disk with a 15GB partition for /. We have to extend this partition.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 15G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 975M 0 part [SWAP]
sr0 11:0 1 46K 0 rom
Then we disable the SWAP partition:
$ sudo swapoff /dev/sda5
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 15G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 975M 0 part
sr0 11:0 1 46K 0 rom
Now we remove all three partitions:
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2,5, default 5):
Partition 5 has been deleted.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Confirm if it is really important to maintain the ext4 signature.
Confirm if it is really needed to perform the following steps in the same fdisk session.
And while still in the same fdisk session, re-create the partitions maintaining the ext4 signature. Determine the size of the first partition (28GB) as the total disk space (30GB) minus ~20% to ~25% of the assigned RAM memory (20% of 10GB is 2GB):
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62914559, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914559, default 62914559): +28G
Created a new partition 1 of type 'Linux' and of size 28 GiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 2
First sector (58722304-62914559, default 58722304):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (58722304-62914559, default 62914559):
Created a new partition 2 of type 'Extended' and of size 2 GiB.
Command (m for help): n
Adding logical partition 5
First sector (58724352-62914559, default 58724352):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (58724352-62914559, default 62914559):
Created a new partition 5 of type 'Linux' and of size 2 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 28G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 2G 0 part
sr0 11:0 1 46K 0 rom
Then re-configure the SWAP:
$ sudo mkswap /dev/sda5
Setting up swapspace version 1, size = 2 GiB (2145382400 bytes)
no label, UUID=204fbbfb-79bf-4a72-870d-2a94288da6ba
And update /etc/fstab with the new UUID for the SWAP partition.