Memory is one of the most important resource components on a server to ensure that process run smooth and fast. Thus, the availability of physical memory for any server is very important, especially for high load web host server which runs database server such as Oracle or MySQL, which require high memory utilization for smooth running. Linux [CentOS] which is popular on cPanel and Plesk web hosting server, comes with several commands and tools to check memory usage on server
1. meminfo
"/proc/meminfo" contain all your memory usage information when you type:
cat /proc/meminfo
you will get an out of your server memory info, below is an example of meminfo.
2. Using free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
free -m
The command will display information about physical memory in MB.
free -m -t
Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.
free -m -s 10
The command will display memory status in megabytes on terminal with continuous polling delay at 10 seconds,You can specify any number for delay.
3. Using vmstat Command
vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The command will display report based on averages since last reboot.
Syntax of vmstat
vmstat -[options] [delay count]
vmstat 10
The command will pool average system resources usage level for a sampling period of 10 seconds at interval of 10 seconds, except the first result that is averages since the last reboot.
If no delay is specified, only one report is printed with the average values since boot.
4. Using top Command
Syntax of top
top
Using top is very simple, Just type "top" at command shell [without ""], it constantly update stats page will be shown.
top -d 2
Same as "top", but "-d" used to Specifies the delay between screen updates after 2 sec.
5. Using ps Command
Syntax of ps aux
ps -aux
aux is the options for ps command to see every process on the system.
To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
Enjoy:)
How to Check Memory Usage on Linux Servers.
Posted by Mayur's BLOG 0 comments
How to change exim default port
Posted by Mayur's BLOG 0 comments
Well, I think there is no need to tell you that why some time we have to change default port (25) for exim so I directly come to the point instead of bla..bla..blaaaa..
For cpanel server:
You can run exim on another port by going to the 'Service Manager' in WebHost Manager and then enabling 'exim on another port' and choosing the port number.
For another servers:
Just add this first line to /etc/exim.conf and both 25 and 26 will work as smtp ports.
daemon_smtp_ports = 25 : 26
acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message
Restart exim. Thats it
Enjoy:)
Cpanel Icon Missing From WHM List Accounts.
Posted by Mayur's BLOG 1 comments
Cpanel Icon Missing From WHM List Accounts.
Cause :-
Following option selected in WHM >> Tweak Settings
| Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
You need to uncheck the following option in WHM >> Tweak Settings under System tab
| Disable login with root or reseller password into the users’ cPanel interface. Also disable switch account dropdown in themes with switch account feature |
Enjoy:)
Disabling direct root login
Posted by Mayur's BLOG 0 comments
Inorder to disable direct root login on a linux server, you need to do the following thing:
1. vi /etc/ssh/sshd_config in that file make
Permitrootlogin no then save it
2. Restart sshd service
/etc/init.d/sshd restart
3. Now create a new user and set password for that user.
4. Add that user to the wheel group
vi /etc/groups // add that user to the group of wheel
5. Now logon to the server using the username and password and then do
su - and provide the root password
Inorder to work this properly you should have the following permission settings
chmod 4755 /bin/su
chmod 1700 /etc/passwd
chmod 1700 /etc/shadow
chmod 1755 /etc/groups
If there is anything wrong with this permission, you may get permission denied or incorrect password errors.
Enjoy:)
RSYNC
Posted by Mayur's BLOG 0 comments
rsync utility is used for synchronising files one of the major adavantage of rsync is that rsync can preserve permissions and ownership information, copy symbolic links, and generally is designed to intelligently handle your files
The basic syntax for rsync is simple enough -- just run
rsync [options] source destination
If you want to rsync the contents from /home/mabin/ to /var/www/html/ the command
rsync -a /home/mabin /var/www/html
Whe doing rsync there is a big meaning in the ending '/' because if I rsync /home/mabin/ then only the contents inside the folder mabin will be copied.....but if didn't used the '/' ie /home/mabin then the entire directory will be taken ..that is a directory named mabin will be created at the destination
some switches with rsync
-----------------------------
-a --> archive option, which actually combines several rsync options. It combines the recursive and copy symlinks options, preserves group and owner, and generally makes rsync suitable for making archive copies. Note that it doesn't preserve hardlinks
-H --> Copies hard link
-v --> verbose mode
-z --> Compress option, will compress the data during transfer
--delete --> For deleting the already transferred data from source (a dangerous option, try to avoid it)
--exclude=".*/" --> To avoid copying hidden files. With this option you can avoid copying any particular file( If you dont want to copy .php files then pot it like this --exclude="*.php/"
sample command for local copying
----------------------------------------
rsync -avh /home/mabin/ /var/www/html
Rsync for remote copying
------------------------------------------------------------
rsync -avhe ssh /home/user/dir/ user@remote.host.com:dir/
If you want to know how fast the transfer is going use the --progress option
rsync --progress -avhe ssh /home/user/dir/ user@remote.host.com:dir/
Enjoy:)
Roundcube installation on cPanel server
Posted by Mayur's BLOG 0 comments
1-Login to the server as root and run the following:
cd /usr/local/cpanel/base
wget http://dfn.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1.1.tar.gz
tar -zxvf roundcubemail-0.1.1.tar.gz
rm -rf roundcubemail-0.1.1.tar.gz
mv -f roundcubemail-0.1.1 roundcube
chown root.root -R roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
mysql -e “CREATE DATABASE roundcube;” -pDATABASEPASSWORD
mysql -e “use roundcube; source SQL/mysql.initial.sql;” -pDATABASEPASSWORD
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
Note:Replace DATABASEPASSWORD with your server MySQL root password
2-Open db.inc.php with Pico
pico db.inc.php
Find this line in the file using (Ctrl+w)
$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace the line above with the following line:
$rcmail_config['db_dsnw'] = ‘mysql://root:DATABASEPASSWORD@localhost/roundcube’;
Note:Replace DATABASEPASSWORD with MySQL server root password
save and close.
3-Open main.inc.php with pico
pico main.inc.php
find the following lines in the file and edit their values as the following:
$rcmail_config['enable_caching'] = FALSE;
$rcmail_config['default_host'] = ‘localhost’;
$rcmail_config['enable_spellcheck'] = FALSE;
Save and close
4-There are some changes need to be done in index.php file, instead of telling you what to find, add or remove, I have made a ready to made index.php file for you to use and you are done.
You can get the index.php file by running the following command lines:
cd /usr/local/cpanel/base/roundcube
wget http://www.2mhostblog.com/rc.1.1.tar
rm -f index.php
tar -xf rc.1.1.tar
rm -f rc.1.1.tar
5-Finally, restart your cpanel service
service cpanel restartEnjoy:)
Installing Subversion Using yum on CentOS 5
Posted by Mayur's BLOG 0 comments
Is is very simple, you can install it by using yum. But I found most of the time it is not as simple as we assume.
While attempting to install Subversion via yum today, I received the following error:
[root@sXXX ~]# yum install subversion
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
extras 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
bla..bla..:)
bla..:)
bla..:)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion
Steps to resolve this:
#wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
#rpm -i perl-URI-1.35-3.noarch.rpm
#yum install subversion
That's it.
Enjoy:)