WHM & cPanel Ports

Download PDF
PORT	PROTOCOL	OPEN	SERVICE	NOTES
20	TCP-UDP	I/O-I/O	FTP	File transfers (data port)
21	TCP-UDP	I/O-I/O	FTP	File transfers (control port)
22	TCP	I/O	SSH	ssh, scp copy, sftp
25	TCP	I/O	SMTP	Outgoing email
37	TCP	O	rdate	Network time
43	TCP	O	WHOIS	Domain lookup
53	TCP-UDP	I/O-I/O	DNS	Inbound is only needed if you run public DNS server
80	TCP	I/O	HTTP	Web server
110	TCP	I/O	POP3	Incoming email
113	TCP-UDP	O-O	Ident	Client identification
123	UDP	O	NTP	Network time
143	TCP	I	IMAP4	Incoming email
443	TCP	I/O	HTTPS	Web server SSL
465	TCP	I	SMTP 	Outgoing email SSL/TLS
587	TCP	I/O	SMTP	Outgoing email
873	TCP-UDP	O-O	rsync	File, directory sync	
993	TCP	I	IMAP4 	Incoming email SSL
995	TCP	I	POP3	Incoming email SSL
2077	TCP	I	WebDAV	Distributed authoring
2078	TCP	I	WebDAV	Distributed authoring SSL
2082	TCP	I	CPanel	CPanel control panel
2083	TCP	I	CPanel	CPanel control panel SSL
2086	TCP	I	WHM	WHM control panel
2087	TCP	I	WHM	WHM control panel SSL
2089	TCP	O		CPanel licensing
2095	TCP	I	Webmail	Web based email	
2096	TCP	I	Webmail	Web based email SSL
2703	TCP	O		Razor email scanning
3306	TCP	I	MySQL	Out only if you need to connect remotely
4643	TCP	I		Virtuozzo control panel
6277	UDP	O		SpamAssassin
6666	TCP	I	Chat	CPanel built in Java chat

How to run cPanel behind a NAT – Router – Home modem

Download PDF

cPanel is not designed to run behind a NAT, therefore if you decide to go that way you won’t get any help from cPanel support techs, it is not officialy supported. Many people have done it. I personaly do it manualy by changing the IP configuration and DNS Zones, but for those with less Linux/DNS knowledge, here is a great script that helps you run cPanel & WHM behind a NAT (router with internal IP for example 192.168.0.x)

Install

create the script by pasting source from bellow or downloading from link above

as root go to /var/cpanel/scripts and type  vi wwwact_nat.sh (paste the script), then :wq! to save it.

then type chmod 0755 wwwact_nat.sh

and then run with sh wwwact_nat.sh

How to use

Script is very self-explanatory, Run the initial configuration first, then create a domain etc. If any problems, feel free to comment 🙂

Script Source Code

#!/bin/bash
# cpanel – wwwacct_nat.sh Copyright(c) 2008 cPanel, Inc.
# All rights Reserved.
copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
myversion=001
mybuild=STABLE
echo “”
echo “This script is designed to help you run cPanel/WHM behind a NAT/ROUTER”
echo “Based network 192.168.x.xxx take Extra Caution when using this script”
echo “Please view the readme that comes with this script before using it.”
echo “”
echo “+===================================+”
echo “| Dependency Check |”
echo “+===================================+”
rootcheck=$(echo $USER); if [ “$rootcheck” = “root” ]; then
echo “| running as user $rootcheck [ OK ] “
else
echo “| running as user root [FAIL] “
echo “+===================================+”
echo “Script Halted!”
exit
fi
if [ -f /etc/wwwacct.conf ]; then
echo “| cPanel wwwacct.conf [ OK ] “
else
echo “| cPanel wwwacct.conf [FAIL] “
echo “+===================================+”
echo “Script Halted!”
exit
fi
mycurl=”`which /usr/bin/curl 2> /dev/null`”; if [ “$mycurl” != “” ]; then
echo “| $mycurl [ OK ] “
else
echo “| /usr/bin/curl [FAIL] “
fi
mysed=”`which /bin/sed 2> /dev/null`”; if [ “$mysed” != “” ]; then
echo “| $mysed [ OK ] “
else
echo “| /bin/sed [FAIL] “
fi
mywget=”`which /usr/bin/wget 2> /dev/null`”; if [ “$mywget” != “” ]; then
echo “| $mywget [ OK ] “
else
echo “| /usr/bin/wget [FAIL] “
fi
echo “+===================================+”
sleep 2
addr=$(awk ‘/ADDR/ { print $2 }’ /etc/wwwacct.conf)
ethdev=$(awk ‘/ETHDEV/ { print $2 }’ /etc/wwwacct.conf)
lanaddr=$(ifconfig $ethdev | grep ‘inet addr:’| cut -d: -f2 | awk ‘{ print $1}’)
replace $addr $lanaddr — /etc/wwwacct.conf 1> /dev/null
mainip=$(awk ‘{ print $1 }’ /var/cpanel/mainip)
echo “”
echo “+===================================+”
echo “| We Have Detected |”
echo “+===================================+”
echo “| Main/DNS IP: $mainip”
echo “| Shared/NAT IP: $lanaddr”
echo “+===================================+”
while true; do
echo “”
echo “+===================================+”
echo “| cPanel NAT Main Menu |”
echo “+===================================+”
echo “| 1) First Time Setup”
echo “| 2) Update Everything”
echo “| 3) New Account”
echo “| 4) Del Account”
echo “| 5) Sub-Domains *use caution*”
echo “| 6) Check GitHub To Update Script”
echo “| 7) Quit”
echo “+===================================+”
echo “| [ Build: $mybuild Ver: $myversion ] |”
echo “+===================================+”
read case;
echo “”
case $case in
  1)
echo “Detecting WAN IP (using curl)”
echo “Should Be Quick”
wanip=$(curl -s http://www.cpanel.net/myip)
echo $wanip > /var/cpanel/mainip
echo “Main IP Updated To $wanip”
echo “Fixing Proxy Domains For NAT”
replace proxysubdomainsfornewaccounts=1 proxysubdomainsfornewaccounts=0 — /var/cpanel/cpanel.config
/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings 1> /dev/null;;
  2)
echo “Detecting WAN IP (using curl)”
echo “Should Be Quick”
wanip=$(curl -s http://www.cpanel.net/myip)
echo “”
echo “+===================================+”
echo “| We Have Detected |”
echo “+===================================+”
echo “| Old IP: $mainip”
echo “| New IP: $wanip”
echo “+===================================+”
echo “”
echo “Updating NameServer IPs”
replace $mainip $wanip — /etc/nameserverips
echo “Updating DNS With $wanip”
for domain in `ls /var/named|grep ‘\.db$’`; do
if [ -f “/var/named/$domain” ] ; then
arecord=$(grep -E ‘ftp IN A’ /var/named/$domain|awk ‘{print $4}’)
echo “Updating $domain From $arecord To $wanip”
replace $arecord $wanip — /var/named/$domain 1> /dev/null
fi
done
echo “Updating cPanel IPs”
replace $mainip $wanip — /var/cpanel/mainip
replace $mainip $wanip — /etc/secondary.ip
replace $mainip $wanip — /etc/hosts
replace $mainip $wanip — /etc/mail_reverse_dns
replace $wanip $lanaddr — /var/cpanel/users/*
echo “Fixing Proxy Domains For NAT”
replace proxysubdomainsfornewaccounts=1 proxysubdomainsfornewaccounts=0 — /var/cpanel/cpanel.config
/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings 1> /dev/null;;
  3)
echo “What is the domain name you would like to setup?”
echo -n “”
read -e domain
echo “”
echo “What username would you like to setup?”
echo -n “”
read -e user
echo “”
echo “What password would you like to setup?”
echo -n “”
read -e pass
echo “”
echo “Preparing DNS Zones For WAN IP”
echo “Detecting Zone Template Backups”
dir=/var/cpanel/zonetemplates/backup
echo “”
if [ -d $dir ]; then
echo “Backups Exist Copying To Main Folder For Setup”
  for mytemplate in `ls /var/cpanel/zonetemplates/*`; do
if [ -f “$mytemplate” ] ; then
rm -f $mytemplate
  fi
done
cp $dir/* /var/cpanel/zonetemplates
else
echo “No Backups Found”
echo “Backing Up”
mkdir $dir
  for mybackup in `ls /var/cpanel/zonetemplates/*`; do
if [ -f “$mybackup” ] ; then
cp $mybackup $dir
  fi
done
fi
echo “”
echo “Setting Up Zone Templates With $mainip”
  for mytemplate in `ls /var/cpanel/zonetemplates/*`; do
if [ -f “$mytemplate” ] ; then
replace %ip% $mainip — $mytemplate
  echo “cpanel IN A $mainip” >> $mytemplate
  echo “whm IN A $mainip” >> $mytemplate
  echo “webmail IN A $mainip” >> $mytemplate
  echo “webdisk IN A $mainip” >> $mytemplate
  fi
done
echo “Done”
echo “”
/scripts/wwwacct $domain $user $pass;;
  4)
/bin/ls -A /var/cpanel/users/
read user
/scripts/killacct –force –killdns $user;;
  5)
echo “What User?”
read user
echo “”
domain=$(awk ‘/DNS/’ /var/cpanel/users/$user | cut -d’=’ -f2)
echo “Not The Full Domain (sub.$domain)”
echo “What Is The Sub Part? (sub)”
read subdomain
folder=/home/$user/public_html/$subdomain
if [ ! -d $folder ] ; then
mkdir $folder; chmod 0755 $folder; chown $user.$user $folder;
fi
echo “”
if [ -f “/var/named/$domain.db” ] ; then
echo “$domain.db Found”
apacheconf=/usr/local/apache/conf/includes
  if [ -f “$apacheconf/$subdomain.$domain.conf” ] ; then
echo “Sorry Already Exists!”
  echo “Remove [YES/NO]?”
  read myremove
    if [ “$myremove” = “YES” ]; then
echo “Removing…”
    rm -f $apacheconf/$subdomain.$domain.conf
    sed -i “/$subdomain IN A/d” /var/named/$domain.db
    sed -i “/$subdomain.$domain.conf/d” $apacheconf/post_virtualhost_global.conf
    echo “Restarting httpd”
    service httpd restart
    echo “Restarting bind”
    rndc flush; rndc reload;
    echo “Done”
    else
echo “Returning To Menu”
    fi
else
echo “<virtualhost $lanaddr:80>” > $apacheconf/$subdomain.$domain.conf
  echo ” ServerName $subdomain.$domain” >> $apacheconf/$subdomain.$domain.conf
  echo ” DocumentRoot $folder” >> $apacheconf/$subdomain.$domain.conf
  echo ” ServerAdmin webmaster@$domain” >> $apacheconf/$subdomain.$domain.conf
  echo ” UseCanonicalName Off” >> $apacheconf/$subdomain.$domain.conf
  echo “</virtualhost>” >> $apacheconf/$subdomain.$domain.conf
  echo “Restarting httpd”
  echo “Include conf/includes/$subdomain.$domain.conf” >> $apacheconf/post_virtualhost_global.conf
  service httpd restart
  echo “Restarting bind”
  echo $subdomain IN A $mainip >> /var/named/$domain.db
  rndc flush; rndc reload;
  echo “”
  echo “Files Are In $folder”
  fi
else
echo “$domain.db Not Found”
echo “Halted Returning To Menu”
fi;;
  6)
echo “Downloading Update Script…”
echo “Please Wait”
wget -q -O /scripts/wwwacct_nat_update.sh https://raw.github.com/cpanelscripts/wwwacct_nat/master/wwwacct_nat_update.sh
echo “”
chmod 0755 wwwacct_nat_update.sh && /scripts/wwwacct_nat_update.sh && exit;;
  7)
echo “Thanks For Using This Script”
echo “Quitting”
exit;;
  *)
echo “$case is an invaild option. Please select option between 1-6 only”;
sleep 3
clear
esac
done

FROM SPICEWORKS:

This KB was written to provide some insight into a problem many people face when running their own sites/servers: running cPanel behind NAT.

We’ve been over at the cPanel forums and have read the many posts about how “cPanel does not support NAT configurations in any way.” This may be true. But what they’re saying is that cPanel, the company, does not support NAT – meaning they do not provide technical support/assistance with your NAT setup. Some posts go as far as saying a NAT’d cPanel server won’t work. Well… it does. Here’s what we did to get it working (CentOS 6, 64-Bit):

What’s really odd about this whole thing? The solution came from cPanel and was published in the Forums.

1.

Download the cPanel script from gitHub

This script is designed to help you run cPanel/WHM behind a NAT/ROUTER Based network 192.168.x.xxx take Extra Caution when using this script. You may also want to view the readme.md file under gitHub.

https://github.com/cpanelscripts/wwwacct_nat

Builds
EDGE = Most Recent But May Contain Errors (Do Not Use On A LIVE Server)
STABLE = Tested By The Dev Team And Seems To Work OK
RELEASE = 99% Tested And Safe For LIVE Servers

2.

Install the Script

Login to your cPanel server via SSH

cd to /scripts

create the file wwwacct_nat.sh

edit the file and copy the contents of the script you downloaded

OR you can also FTP the script to this location.

 

3.

Set permissions of the script

Do not forget to set the permissions on the script so it can execute.

root@perseus [/scripts]# chmod 755 wwwacct_nat.sh

4.

First Run

When you first run the script, it will attempt to ascertain the external and internal IP’s. You will need to confirm the IP’s are correct. If they are not, you need to set your Shared IP in the Basic Setup of cPanel and re-run the script.

+===================================+
| Dependency Check |
+===================================+
| running as user root [ OK ]
| cPanel wwwacct.conf [ OK ]
| /usr/bin/curl [ OK ]
| /bin/sed [ OK ]
| /usr/bin/wget [ OK ]
+===================================+

+===================================+
| We Have Detected |
+===================================+
| Main/DNS IP: 169.161.136.110
| Shared/NAT IP: 192.168.1.104
+===================================+

5.

First Time Setup

Now you will need to run the First Time Setup under Option 1). This will make adjustments to your Zone Files as needed.

+===================================+
| cPanel NAT Main Menu |
+===================================+
| 1) First Time Setup
| 2) Update Everything
| 3) New Account
| 4) Del Account
| 5) Sub-Domains *use caution*
| 6) Check GitHub To Update Script
| 7) Quit
+===================================+
| [ Build: STABLE Ver: 001 ] |
+===================================+

6.

Adding a New Account

Since you are running behind NAT, you will not be able to use the WHM Admin UI to add or remove accounts. This should now all be done via the new script.

Using Option 3) we will add a new account.

What is the domain name you would like to setup?
spicecentral.net

What username would you like to setup?
spice

What password would you like to setup?
johnwayne1234

Preparing DNS Zones For WAN IP
Detecting Zone Template Backups

Backups Exist Copying To Main Folder For Setup

Setting Up Zone Templates With 169.161.136.110
/var/cpanel/zonetemplates/root_standardvirtualftp converted
Done

+===================================+
| New Account Info |
+===================================+
| Domain: spicecentral.net
| UserName: spice
| PassWord: johnwayne1234
+===================================+

This ok? y
Checking input data……Done
WWWAcct 12.5.0 (c) 2013 cPanel, Inc…….Done
Running pre creation script (/usr/local/cpanel/scripts/prewwwacct)……Done
Adding User……Done
Copying skel files from /root/cpanel3-skel/ to /home/spice/……Done
Adding Entries to httpd.conf……Done
Setting up Mail & Local Domains……Done
Configuring DNS……Done
Restarting apache……Done
Updating Authentication Databases……Done
Verifying MX Records and Setting up Databases……Done
Sending Account Information……Done
Running post creation scripts (/usr/local/cpanel/scripts/legacypostwwwacct, /usr/local/cpanel/scripts/postwwwacct, /usr/local/cpanel/scripts/postwwwacctuser)……Done
Setting up Domain Pointers……Done
Setting Reseller Privs……Done
Account Creation Complete!!!……Done
Account Creation Ok
System has 1 free ip.

Dns Zone check is enabled.
+===================================+
| New Account Info |
+===================================+
| Domain: spicecentral.net
| Ip: 192.168.1.104 (n)
| HasCgi: y
| UserName: spice
| PassWord: johnwayne1234
| CpanelMod: x3
| HomeRoot: /home
| Quota: 0 Meg
| NameServer1: ns10.kit-llc.net
| NameServer2: ns11.kit-llc.net
| NameServer3:
| NameServer4:
| Contact Email:
| Package: default
| Feature List: default
| Language: en
+===================================+
Adding Shell Access (y)
Successlocaldomains…valiases …vdomainaliases…vfilters…Bind reconfiguring on perseus using rndc
Zone spicecentral.net has been successfully added
Password for spice has been changed
Updating ftp passwords for spice
Ftp password files updated.
Ftp vhost passwords synced
Reconfiguring Mail Routing:
LOCAL MAIL EXCHANGER: This server will serve as a primary mail exchanger for spicecentral.net’s mail.:
This configuration has been manually selected.

Bind reloading on perseus using rndc zone: [spicecentral.net]
System has 1 free ip.
wwwacct creation finished
Account Creation Ok

7.

Check your new Zone File

Login to your WHM UI and go to DNS Functions -> Edit DNS Zone

Select the newly created domain and click EDIT.

Now verify the Public IP address is present in the Zone File and not the NAT’d IP.

Change any IP addresses that may not be correct in the Zone File. If there are corrections to make, then you will need to manually adjust your Zone File Template for the standardvirtualftp Zone Template.

8.

Deleting an Account

Remember, you shouldn’t delete an account through your WHM UI if you are using this script.

We will use Option 4) to delete the account we just created.

you will be promoted for the user you wish to delete from the system. You must type in the user name you want to delete.

+===================================+
| cPanel NAT Main Menu |
+===================================+
| 1) First Time Setup
| 2) Update Everything
| 3) New Account
| 4) Del Account
| 5) Sub-Domains *use caution*
| 6) Check GitHub To Update Script
| 7) Quit
+===================================+
| [ Build: STABLE Ver: 001 ] |
+===================================+
4

forsythp insspec jimks kitcom kitllc kitpro secc spice triplej
spice
Running pre removal script (/usr/local/cpanel/scripts/prekillacct)……Done
Collecting Domain Name and IP……Done
Locking account and setting shell to nologin……Done
Killing all processes owned by user……Done
Removing Sessions………Done
Removing Suspended Info………Done
Cleaning Virtfs………Done
Removing Web Logs……Done
Removing Bandwidth Files……Done
Removing Email Sending Limits Cache……Done
Removing DKIM keys……Done
Removing Crontab……Done
Removing Virtual Hosts……Done
Removing user’s web content directory symlinks……Done
Removing MySQL databases and users……Done
Removing PostgreSQL databases and users……Done
Removing User & Group……….Done
Removing DNS Entries……Done
Removing Email Setup……Done
Removing mailman lists……Done
Updating Databases……Done
Removing bandwidth limits……Done
Removing Counter Data……Done
Adding IP back to the IP address pool……Done
Removing user’s cPanel Databases & Updating……Done
Reloading Services…proftpd: no process killed
…Done
Removing SSL keys, certificates, and signing requests……Done
Removing mail and service configs……Done
Removing Logaholic Webstats……Done
Sending Contacts……Done
Updating internal databases……Done
Running post removal scripts (/usr/local/cpanel/scripts/legacypostkillacct, /usr/local/cpanel/scripts/postkillacct)……Done
Account Removal Complete!!!……Done
info [killacct] User spice removed
User: spice
Domain: spicecentral.net
Locking password for user spice.
passwd: Success
Deleted domain: spicecentral.net
Successspicecentral.net => deleted from perseus.
Removing /etc/valiases/spicecentral.net
System has 1 free ip.

Id: TQ:TaskQueue:63
Updating ftp passwords for spice
Purging ftp user spice
Ftp password files updated.
Ftp vhost passwords synced
spice account removed

Conclusion

There may be some final tweaking, but these steps got our server up and running behind a NAT Firewall running DNS, Email, HTTP, SSH, FTP, WHM, cPanel. We wouldn’t recommend this configuration for a server you plan on using as an auto-provisioned hosting server for clients. Perhaps with a little more tweaking of scripts, etc. you can get it perfected.

cPanel How to increase /tmp and /var/tmp size – Re: The file system /tmp, which is mounted at /var/tmp, has reached critical status because it is full.

Download PDF

What size is your /tmp partition? You can resize it if it isn’t large enough. Many servers have only 500MB for /tmp which isn’t large enough and should be around 2GB instead. You could edit /scripts/securetmp for this line:

Code:
my $tmpdsksize     = 512000;    # Must be larger than 250000

Change to this line for 2GB:

Code:
my $tmpdsksize     = 2097152;    # Must be larger than 250000

Save the file (:wq), then run these commands to resize /tmp partition:

Code:
umount -l /tmp
umount -l /var/tmp
rm -fv /usr/tmpDSK
/scripts/securetmp

Would you like to secure /tmp & /var/tmp at boot time? (y/n) y

Would you like to secure /tmp & /var/tmp now? (y/n) y


Securing /tmp & /var/tmp

/tmp is already secure

/var/tmp is already secure

Checking fstab for entries …Done

Logrotate TMPDIR already configured

Process Complete

 

How to test SMTP operations using Telnet

Download PDF

1. Telnet into Exchange server hosting IMS service using TCP port 25.
Command is telnet <servername> 25

2. Turn on local echo on your telnet client so that you can see what you are typing.
On Win 9x and NT 3.5/4.0 Telnet client this done by selecting the “preferences” from the “terminal” pull down menu, and checking the local echo radio button.  For Windows 2000 telnet client, issue command “set local_echo”, from the telnet command prompt.

3. Issue the following smtp command sequence

helo <your domain name><enter>                  
response should be as follows
250 OK

mail from: <your Email Address><enter>
response should be as follows
250 OK – mail from <your Email address>

rcpt to: <recipient address><enter>
response should be as follows
250 OK – Recipient <recipient address>

data<enter>
response should be as follows
354 Send data.  End with CRLF.CRLF

To: <recipient’s display name><enter>
From: <your display name><enter>
Subject: <Subject field of Email message><enter>
<Enter you body text><enter><enter> . <enter>

response should be as follows
250 OK

quit<enter>

More detailed link on Microsoft website. http://support.microsoft.com/kb/153119

MaxRequestLen : Linux File size upload error

Download PDF

With new version of Linux distros I have noticed a lot of default configurations are set with really low values.

One of them is MaXRequestLen in Fast CGI.

It used to be set to 1Gb by default, with new distro installs its value is 128kb (Ubuntu, CentOS, RedHat, Fedora etc.).

In order to upload files larger then 128kb you will have to do the following:

First obviously make sure your php.ini settings are set first, for example:

upload_max_filesize = 100M
post_max_size = 150M
memory_limit = 128M

Next is to change MaXRequestLen in  /etc/apache2/conf.d/fcgid.conf

FcgidMaxRequestLen 2147483648

This will give you limit of 2Gb file uploads.

 

Have fun 🙂

 

How to change recursion limit (file limit list) in pure-ftpd

Download PDF

How to change recursion limit (file limit list) in pure-ftpd

By default, pure-ftp server has a limit on a number of files displayed through an ftp client. It is usualy 2000 or 7500, if you need more files displayed follow this quick tutorial.

Solution :- Just login to your Server with root user and do the following changes in your ftp configuration :-

1. Open the main ftp configuration file.
2. root@centos[~]# vi /etc/pure-ftpd/pure-ftpd.conf
3. Search or scroll till you see “LimitRecursion”

——————————————————————–

LimitRecursion 2000 8

2000 represents the number of files displayed and 8 number of subdirectories.

4. Change it to whatever you want for example:

LimitRecursion 75000 15

5. Just save the file after modification and restart the pureftp server with the following command :-

root@centos[~]# /etc/init.d/pure-ftpd restart

Now you can upload and view total 75000 files through ftp and 15 parallel subdirectories are allowed.

Enjoy 🙂

———————————————————–

If you are running PURE FTPD on WHM & cPanel server, the location of the .conf file is:

/etc/pure-ftpd.conf

If this change still has no effect, you can edit it here:

/var/cpanel/conf/pureftpd/main

MySQL Table is marked as crashed and last (automatic?) repair failed

Download PDF

If you have a table in mysql that has crashed and your attempts to repair it using mysqlcheck have failed, then you may have to resort to the lower level myisamchk command.

To use this, you will need to stop the server process (usually service mysqld stop or /etc/init.d/mysqld stop) and then find the data files (usually in /var/lib/mysql/databasename).

You can then run the following command against the table:

myisamchk -r -v -f --sort_buffer_size=128M --key_buffer_size=128M /var/lib/mysql/database/table.MYI

Obviously replacing database/table with the correct database and table.

How to Check Hard Disk Size and Hard Disk Usage on CentOS 6

Download PDF

Simple command to check the Hard Disk size and usage on CentOS 6.2. This command is a basic command for linux operating system.

To view and list of the usage of each partition in the server :

[root@centos62 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos62-lv_root
                       13G  1.8G   10G  15% /
tmpfs                 504M     0  504M   0% /dev/shm
/dev/sda1             485M   48M  412M  11% /boot

df command will displays the total, used, and available free space on all currently mounted filesystems.

To list the size of a specific directory, run the following command :

[root@centos62 ~]# du -sh /root
2.6M    /root

du command reports disk usage. It will shows the disk space used by the files and directories in a directory. The -h option makes the output easier to read by user.

How to install ffmpeg mplayer and mancoder on CentOS 6

Download PDF

Installing FFmpeg, MPlayer and MEncoder on CPanel and Centos 6

First, we need to install RPMforge repository on CentOS 6.

1. Install the DAG GPG key.

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

ffmpeg01

2. Download RPMforge-release package.

cd /home
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm (if your server x86)
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

ffmpeg02

3. Verify the RPMforge-release package you have downloaded.

rpm -K rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

ffmpeg03

4. Install the RPMforge-release package.

rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

ffmpeg04

5. Now we can install FFmpeg, MPlayer and MEncoder.

yum install ffmpeg ffmpeg-devel mplayer mencoder

ffmpeg06

6. You may get this error when you try to install components.

Requires: perl-SGMLSpm >= 1.03ii

ffmpeg07

7. Download perl-SGMLSpm package to CentOS.

wget http://ftp.twaren.net/Linux/Scientific/41/i386/SL/RPMS/perl-SGMLSpm-1.03ii-14.noarch.rpm

ffmpeg08

8. perl-SGMLSpm may require OpenJade.

ffmpeg09

9. Let’s install openjade on CentOS.

yum install openjade

ffmpeg10

10. Try re-install perl-SGMLSpm.

rpm -ivh perl-SGMLSpm-1.03ii-14.noarch.rpm

ffmpeg11

11. After perl-SGMLSpm installation, you can continue to install FFmpeg, MPlayer and MEncoder.

yum install ffmpeg ffmpeg-devel mplayer mencoder

ffmpeg12

12. Now, you can test your ffmpeg installation.

ffmpeg -v

ffmpeg13

Change Default Boot Kernel CentOS

Download PDF

In my previous post I wrote on how to remove linux kernel. In this post I will show you how to change default kernel if you don’t want to remove it.

Selecting default OS or kernel in GRUB boot loader

If you are wishing to change the default OS or kernel in GRUB boot loader, you can easily make the changes

# /boot/grub/grub.conf

Change the  default=0 to 1 of other numeric if that is the kernel or OS you wish to use.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-238.19.1.el5.centos.plus)         <<<<<<<<<<<<<<<<<<<<<<<<<< THIS BEING 0
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-238.19.1.el5.centos.plus ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-238.19.1.el5.centos.plus.img
title CentOS (2.6.18-238.19.1.el5)                 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< THIS BEING 1
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-238.19.1.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-238.19.1.el5.img