How to add SWAP space in Linux to avoid Tomcat, Mysql being killed by the Kernel

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

If you Tomcat, Mysql, JAVA programs got killed by the kernel for memory space issues, adding a SWAP space in your Virtual Machine or Physical Machine may help.

Make sure you have login as root:
To create a 2GB swap space:

dd if=/dev/zero of=/mnt/swap bs=1024 count=2048000

Make it a swap area:

/sbin/mkswap /mnt/swap

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Make it live:

/sbin/swapon /mnt/swap

add the following codes in

/etc/fstab

to make SWAP area consistence after reboot.

/mnt/swap swap swap defaults 0 0

Read More