In this tutorial, I will show you how to increase the shared memory limit permanently.
The shared memory is stored in the following file: /proc/sys/kernel/shmmax
To check the size of your shmmax, write the following command:
you will see the number of maximum shared memory in bytes.
There are three ways to change the maximum limit. In the below examples, I will set the maximum shared memory to 64 MB (64 * 1024 * 1024 = 67108864)
This method is not permanent and will be reset once the server is rebooted:
This method is permenant, the file sysctl.conf will be loaded during the boot process:
This method is also permanent, but requires to edit the sysctl.conf directly:
and append the following:
Make sure to save the file using :w
If you use the second or third method, you will need to restart your server for the changes to take effects.
To restart your server, write the following command:
Any questions? Leave us a comment below!