Category: Centos Notes

  • Centos High Availability Cluster with OpenVZ, DRBD and Heartbeat – Part 1

    Install OpenVZ in both machines, follow the link below How to install OpenVZ in Centos 6.5 DRBD installation. 1. BOTH MACHINES: Install this repository “elrepo-release-6-6.el6.elrepo.noarch.rpm”. rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm 2. BOTH MACHINES: Install DRBD. yum install drbd83-utils-8.3.13 kmod-drbd83-8.3.13 -y 3. BOTH MACHINES: Insert drbd module manually or reboot both machines. /sbin/modprobe drbd 4. BOTH MACHINES: Create…

  • How to install OpenVZ in Centos 6.5

    Install first a fresh OS Centos 6.5 with the partitions below. In this example we will use 1 TB of hardisk. / – 20000mb /swap – 5000mb /vz – All the available space.   Below is the steps on how to install OpenVZ in Centos 6.5 1. Edit the config file below and change SELINUX=enforcing…

  • Tuning the Apache Prefork MPM

    To find httpd process avg memory usage: [root@webserverpage /]#ps -ylC httpd | awk ‘{x += $8;y += 1} END {print “Apache Memory Usage (MB): “x/1024; print “Average Proccess Size (MB): “x/((y-1)*1024)}’ TOTAL: 31.6831 To find after excluding httpd and mysql total memory so that we can get other processes usage memory: [root@webserverpage /]# ps -eo…

  • Setting timezone and synchronizing time with NTP

    Check available timezones in your server by executing the command below. ls /usr/share/zoneinfo/ Then simply delete the current timezone: rm /etc/localtime Create a symbolic link to /etc/localtime. ln –s /usr/share/zoneinfo/Asia/Singapore /etc/localtime If symblolic link not working, then you may use a copy command. cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime Install NTP yum install ntp See all the timezones…

  • How to enable port 587 (submission) in postfix

    To enable port 587, edit the file /etc/postfix/master.cf vi /etc/postfix/master.cf and remove the # in front of the line: #submission inet n – n – – smtpd so that it looks like this: submission inet n – n – – smtpd and restart postfix: /etc/init.d/postfix restart

  • How to fix corrupted mails on queue in qmail or qmailtoaster.

    Step 1. Download qfixq. wget http://qmail.jms1.net/scripts/qfixq Step 2. Change the file permission. chmod 700 qfixq Step 3. Stop qmail service. /etc/init.d/qmail stop Step 4. Run the script. ./qfixq After running it the first time to see what it’s going to do, you should run it a second time, in “live mode”. This will do the…

  • How to repair mail server configuration in Plesk?

    Use mchk utility to repair/rebuild mail server configuration and restore settings for all mailboxes created in Parallels Plesk Panel. Plesk for Linux: ~# /usr/local/psa/admin/sbin/mchk –help Restore settings for all mailboxes. Usage: /usr/local/psa/admin/sbin/mchk [OPTION] OPTIONS: –without-spam restore all settings except for SpamAssassin configuration –with-spam restore all settings –spam-only restore only SpamAssassin settings ~# /usr/local/psa/admin/sbin/mchk –with-spam Plesk…

  • How to fix Nginx error “Too many open files”

    nginx: [emerg] open() “/var/www/vhosts/webserverpage.com/statistics/logs/webmail_access_log” failed (24: Too many open files) nginx: configuration file /etc/nginx/nginx.conf test failed Please resolve the errors in web server configuration templates and generate the file again. # echo ‘ULIMIT=”-n 4096″‘ >> /etc/sysconfig/nginx # cp /etc/init.d/nginx /root/nginx.backup # wget http://kb.parallels.com/Attachments/22839/Attachments/nginx.redhat-centos.patch # patch /etc/init.d/nginx nginx.redhat-centos.patch # egrep “root|psaadm” /etc/security/limits.conf root hard nofile 4096…

  • How to measure or calculate maximum memory usage of Apache

    For Debian: ps -ylC apache2 | awk ‘{x += $8;y += 1} END {print “Apache Memory Usage (MB): “x/1024; print “Average Proccess Size (MB): “x/((y-1)*1024)} For Centos/RedHat: ps -ylC httpd | awk ‘{x += $8;y += 1} END {print “Apache Memory Usage (MB): “x/1024; print “Average Proccess Size (MB): “x/((y-1)*1024)}’ The output should be like…