Ports that must be open to run cPanel behind a firewall IPTables

Ports that must be open to run cPanel behind a firewall / IPTables

port service protocol direction

20 ftp tcp inbound/outbound

21 ftp tcp,udp inbound/outbound

22 ssh tcp inbound

25 smtp tcp inbound/outbound

26 smtp tcp inbound/outbound

37 rdate tcp outbound

43 whois tcp outbound

53 DNS tcp/udp inbound/outbound

(inbound is only needed if you run your own public DNS server you)

80 http tcp inbound/outbound

110 pop3 tcp inbound

113 ident tcp outbound

143 imap4 tcp inbound

443 https tcp inbound

465 smtp tls/ssl tcp/udp inbound/outbound

873 rsync tcp/udp outbound

993 imap4 ssl tcp inbound

995 pop3 ssl tcp inbound

2082 cpanel tcp inbound

2083 cpanel ssl tcp inbound

2086 whm tcp inbound

2087 whm ssl tcp inbound

2089 cp licence tcp outbound

2095 Webmail tcp inbound

2096 Webmail SSL tcp inbound

3306 mysql tcp (only if you need to connect remotely)

6666 chat tcp inbound


cPanel setup :

cPanel Installation Instructions:
cPanel now uses a universal install script which can be found at
You can use the following commands in the root
shell to download and start the installation script:

mkdir /home/cpins
cd /home/cpins
wget http://layer1.cpanel.net/latest
sh latest

SSH to your server(s) and enter following commands:

cd /usr/local/cpanel/whostmgr/docroot/cgi
wget http://www.netenberg.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz


Log into your server via SSH as root and execute the following:

rm -rf /var/netenberg/fantastico_de_luxe/
rm -rf /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/
rm -rf /usr/local/cpanel/3rdparty/fantastico*
rm -rf /usr/local/cpanel/base/frontend/*/fantastico
rm -f /usr/local/cpanel/base/frontend/x/cells/fantastico.html
rm -f /usr/local/cpanel/whostmgr/docroot/cgi/addon_fantastico.cgi

How do i fix the error “License File Expired” ?

First, check the license on http://verify.cpanel.net/ to ensure it is still licensed.
If it is not, please contact who you purchase the license from directly.

If your license lists as active and you see this error when trying to access cPanel or WHM: License File Expired, you will want to ensure that port 2089 is open for outbound TCP traffic.
After verifying that port 2089 is open, check to make sure that this command gives the IP that you expect: lynx -dump http://www.cpanel.net/showip.cgi. If that command shows the expected IP, run this from the command line as root, on the server: /usr/local/cpanel/cpkeyclt.


# rdate -s rdate.cpanel.net
# /usr/local/cpanel/cpkeyclt

HowTo :: install a Perl Module

Perl modules
A Perl module is a self-contained piece of Perl code that can be used by a Perl program or by other Perl modules. It is conceptually similar to a C link library, or a C++ class.

To manually install a Perl module:

  1. Download the Perl module from CPAN or other site.
  2. Extract the tarball, and then run the following commands (in that order):
  • perl Makefile.PL
  • make
  • make test
  • make install

From the WHM
Login to the: WHM >> Main >> Software >> Install a Perl Module

Enter the name of the Perl Module you wish to install in the field and click the button Search. Perl Module will be presented to you in a list. Find and can click on the module you wish to install.

The command Line

  1. SSH to the server and login as root.
  2. Type the following command at the prompt:
    • /scripts/realperlinstaller –force HTML ::Template

In this case, the module we want to install is HTML::Template.

What is /dev/shm and its practical usage ?

What is /dev/shm and its practical usage ?

/dev/shm is nothing but implementation of traditional shared memory concept. It is an efficient means of passing data between programs. One program will create a memory portion, which other processes (if permitted) can access. This will result into speeding up things on Linux.

If you type mount command you will see /dev/shm as a tempfs file system. Therefore, it is a file system, which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. By default almost all distro configured to use /dev/shm.

Nevertheless, where can I use /dev/shm?
You can use /dev/shm to improve the performance of application software or overall Linux system performance. On heavily loaded system, it can make tons of difference. For example VMware workstation/server can be optimized to improve your Linux host’s performance (i.e. improve the performance of your virtual machines).

For example, if you have 8GB RAM then remount /dev/shm as follows:

# mount -o remount,size=8G /dev/shm

To be frank if you have more than 2GB RAM and if you running multiple Virtual machines this hack always improves performance.

SSH Authorized Keys Automatic Login

SSH can automatically authenticate connections when the client presents an authorized key. A client gives it’s public key to a server and then when it connects the server knows it’s allowed in and automatically allows the connection. The Keys are specific to users, so a key for user_a will not let user_b in.

Few Simple Steps

  1. Create Keys

    If the keys don’t exists already you must create them. Look in your ~/.ssh for files called id_rsa and id_rsa.pub. If those files don’t exist say ssh-keygen -b 2048 -t rsa to create them.

  2. Place Keys on Server

    Copy id_rsa.pub to the server then append that to ~/.ssh/authorized_keys

Optionally you can use a DSA key, simply replace `rsa` with `dsa` above

SSH automatic login assistance script

The script automatically pushes your SSH private key to the server specified so you can have automatic SSH,scp and sftp authentication. If you don’t have a key the script will generate one for you, also this script assumes that the user running the script has a home directory on the remote host. Should note that this script will only push the RSA encrypted key.

The Script




# say: ./ssh_script.sh hostname

# Uploads your id_rsa.pub to the specified host, wrapped for readability

if [ ! -r ${HOME}/.ssh/id_rsa.pub ];then

ssh-keygen -b 2048 -t rsa


# Append to the copy on the remote server

cat ~/.ssh/id_rsa.pub | ssh ${USER}@$1 “cat – >> .ssh/authorized_keys”

if [ $? -eq 0 ]; then

echo “Success”


save the script say as  ssh_script.sh and execute it ./ssh_script.sh hostname