Free Mail Server on OCI

Free Mail Server on OCI – Swapfile

Spread the love

This is the series of articles about how to setup free own mailserver on OCI.

How to create Oracle Cloud Account and basic setup you can find in this article.
How to link your Domain Name to OCI you can find in this article.
How to reserve public IPv4 address and setup PTR in OCI you can find in this article.
How to create and link Data Block Volume to OCI you can find in this article.
How to create Virtual Cloud Network in OCI you can find in this article.
How to create Compute instance Virtual Machine in OCI you can find in this article.

Swapfile

Even if you have great amount of memory allocated to your VM instance, it is still advised to create a swapfile and mount it to your VM.

For VM instances with 16GB of memory or more it is advised to create at least 4GB of swapfile, I have only 12GB of memory but I still think 4GB of swapfile will be beneficial. Run the following commands:

# Create swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=4000 status=progress
# Change the CHMOD for swapfile
sudo chmod 0600 /swapfile
# Make SWAP
sudo mkswap /swapfile
# Enable SWAP
sudo swapon /swapfile
# Add the SWAP record to FSTAB
echo "/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab
# Remount FSTAB
sudo mount -a

If everything went OK, by running the free command you should see your SWAP (bottom line):

ubuntu@mailserver:~$ free
               total        used        free      shared  buff/cache   available
Mem:        12226604      238280    11296260        4484      692064    11790644
Swap:        4095996         264     4095732

Let’s configure OCFS2, more details you can read on official Oracle documentation (this page, and this page). Follow this article.