AWS EC2 Amazon Linux CentOS Prerequisites - tooltwist/documentation GitHub Wiki

#AWS EC2 Amazon Linux / CentOS Prerequisites

##Install download and compression tools

First we need to update the system repositories then afterwards install the tools.

$ sudo yum update
$ sudo yum install curl wget unzip zip 

##Set Open Files limit Applications running on the system need to open a few files, and socket connections. The default open files limit of 1024 in Unix will most likely be exceeded. Ensure that open file limits are set to 64k.

$ sudo vi /etc/security/limits.conf

Add the following entries at the bottom of the file:

*	soft	nofile	65536
*	hard	nofile	65536
root	soft	nofile	65536
root	hard	nofile	65536

##Adding swap space Note: If you setup a swap partition as part of the OS install then you can skip this section.

As root create a 1GB swapfile and initialise it.

$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ sudo mkswap /swapfile
$ sudo chmod 0600 /swapfile
$ sudo swapon /swapfile

Ensure that the swap partition is persistent so that it isn’t dropped when you reboot.

$ sudo vi /etc/fstab

Then add the following line to the bottom of the file:

/swapfile swap swap defaults 0 0

When you reboot, use the free -o or df -h command to check that the swap partition exists.