Author: rpaco

  • 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…

  • How to install QmailToaster in Centos.

    Download & Run Pre-Install Scripts 1. Create a directory for qmailtoaster files. mkdir -p /usr/src/qtms-install 2. Change directory to the above created directory. cd /usr/src/qtms-install 3. Download the installation script. (The script is meant for 64 bit). wget http://www.qmailtoaster.com/centos/cnt5064/cnt5064-deps.sh 4. Run the installation script. bash cnt5064-deps.sh 5. cnt50-svcs.sh & firewall.sh wget http://www.qmailtoaster.com/centos/cnt50/cnt50-svcs.sh 6. Rename cnt50-svcs.sh…

  • How to monitor MySQL process.

    rpaco@choi:~$ mytop -uroot -p<mypassword> Output should be like this. MySQL on localhost (5.0.45) up 0+05:34:18 [15:50:11] Queries: 16.6M qps: 869 Slow: 0.0 Se/In/Up/De(%): 20/00/00/00 qps now: 682 Slow qps: 0.0 Threads: 9 ( 1/ 1) 22/00/00/00 Key Efficiency: 99.9% Bps in/out: 0.0/ 1.8 Now in/out: 8.4/ 1.4k Id User Host/IP DB Time Cmd Query or…

  • How to check the max_connections in MySQL database.

    rpaco@choi:~$mysql -uroot -h localhost -p Enter Password: mypassword Type the command below. mysql> show variables like ‘max_connections’; +—————–+——-+ | Variable_name   | Value | +—————–+——-+ | max_connections | 100   | +—————–+——-+ Set temporary values. This values will be reset when mysql service restart. mysql>set global max_connections = 200; To set it permanently. vi /etc/mysql/my.cnf # #…

  • Check RAM Memory Chip Speed and Specification From Within a Linux System

    root@choi:~# dmidecode –type memory # dmidecode 2.11 SMBIOS 2.6 present. Handle 0x0008, DMI type 16, 15 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 8 GB Error Information Handle: No Error Number Of Devices: 2 Handle 0x0009, DMI type 17, 28 bytes Memory Device Array…

  • How to update vzkernel in host OS running OpenVZ

    This is how you can update your kernel in your host OS. 1. Check the installed kernel first. [root@choi ~]# rpm -qa | grep vzkernel vzkernel-2.6.32-042stab057.1.x86_64 2. Search for available vzkernel [root@choi ~]# yum search vzkernel Loaded plugins: fastestmirror, presto Loading mirror speeds from cached hostfile * base: mirror.usonyx.net * extras: mirror.usonyx.net * openvz-kernel-rhel6: mirror.secureax.com…

  • Create Partition and Format Partition in Centos 6.4

    In this notes, I have inserted two HDD on a 1U server which have 2 existing HDD (raid 1) setup and currently running. I have inserted 2x 1TB HDD in the 3rd and 4th slot of the server. 1. To check if the disk have been detected, you may type the command below “fdisk -l”…

  • Check current network bandwidth usage on Linux System

    root@choi:/usr/local/bin# vim netspeed #!/bin/bash if [ -z “$1” ]; then echo echo usage: $0 network-interface echo echo e.g. $0 eth0 echo exit fi IF=$1 while true do R1=`cat /sys/class/net/$1/statistics/rx_bytes` T1=`cat /sys/class/net/$1/statistics/tx_bytes` sleep 1 R2=`cat /sys/class/net/$1/statistics/rx_bytes` T2=`cat /sys/class/net/$1/statistics/tx_bytes` TBPS=`expr $T2 – $T1` RBPS=`expr $R2 – $R1` TKBPS=`expr $TBPS / 1024` RKBPS=`expr $RBPS / 1024` echo “tx…

  • Sysstat – CPU Load, Uptime. RAM usage check in Linux System

    Automatic Installation root@choi:~# apt-get install sysstat Reading package lists… Done Building dependency tree Reading state information… Done The following extra packages will be installed: libsensors4 multiarch-support Suggested packages: lm-sensors isag The following NEW packages will be installed: libsensors4 multiarch-support sysstat 0 upgraded, 3 newly installed, 0 to remove and 282 not upgraded. Need to get…