kb: how-to
Plesk for Linux
Question
A minimum of 1 GB swap is required for Plesk on a Linux server. According to this article, Plesk does not manage swap space. This article describes how to manually enable the swap file in the Linux operating system.
Answer
- Start by creating a file that will be used for swap:
# fallocate -l 1G /swapfile
- Note: In old distributions like CentOS 7 you might have problems with fallocate command, to create the file in sthis case use:
# dd if=/dev/zero of=/swapfile count=1024 bs=1MiB
- Only the root user should be able to write and read the swap file. Set the correct permissions by typing:
# chmod 600 /swapfile
- Use the mkswap utility to set up a Linux swap area on the file:
# mkswap /swapfile
- Activate the swap file using the following command:
# swapon /swapfile
- To make the change permanent open the
/etc/fstab
file:# vi /etc/fstab
- Add the following content:
CONFIG_TEXT: /swapfile swap swap defaults 0 0
- Verify that the swap is active by using either the swapon or the free command , as shown below:
# swapon --show
# free -h - Swappiness is a Linux kernel property that defines how often the system will use the swap space. Swappiness can have a value between 0 and 100. A low value will make the kernel try to avoid swapping whenever possible, while a higher value will make the kernel use the swap space more aggressively. The default swappiness value is 60. You can check the current swappiness value by typing the following command:
# cat /proc/sys/vm/swappiness
- While the swappiness value of 60 is OK for most Linux systems, for production servers, you may need to set a lower value.
Comments
0 comments
Please sign in to leave a comment.