So, here's a simple step to add a swap space (Read more for details):
[root@ns1 /]# dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
1073741824 bytes (1.1 GB) copied, 45.5356 seconds, 23.6 MB/s
[2] zeros file has been created, now we make it as swap file:
[root@ns1 /]# mkswap /swapfile1
Setting up swapspace version 1, size = 1073737 kB
[3] make it on!
[root@ns1 /]# swapon /swapfile1
[4] check it using free
[root@ns1 /]# free
total used free shared buffers cached
Mem: 1026788 940420 86368 0 4096 363916
-/+ buffers/cache: 572408 454380
Swap: 2097136 803060 1294076
Yup, it's activated now.. you may add entry on your /etc/fstab so it will automounted when your server is rebooted, add this line
/swapfile1 swap swap defaults 0 0