Preset Cpanel Servers

To preset a server:

First login and go to the WHM > Server Configuration > Basic cPanel/WHM

1) Check that the main ip is the server primary ip
2) Make sure that the primary and secondary ns are set to ns1 and ns2 (or
how they had been prior to a reload)
Next go to WHM > Server Configuration > Tweak Settings:

Leave all the settings alone…ADD the following:
1) Under Domains: “Prevent users from parking/adding on common
internet domains. (ie”
2) Under Mail: “Attempt to prevent pop3 connection floods”
3) “Default catch-all/default address behavior for new accounts.” Select
4) “Email users when they have reached 80% of their bandwidth”
5) “Include a list of Pop before SMTP senders in the X-PopBeforeSMTP header
when relaying mail. (exim 4.34-30+ required)”
6) “Silently Discard all FormMail-clone requests with a bcc: header in the
subject line”
7) “Track the origin of messages sent though the mail server by adding the
X-Sender headers (exim 4.34+ required)”
Cool Under Software: “Loader to use for internal cPanel PHP” select
9) Under Status: “The load average that will cause the server status to
appear red (leave blank for default):” >> 5
10) Under System: “Allow Sharing Nameserver Ips”
11) “Use jailshell as the default shell for all new accounts and modified

Click save at the bottom
Next, WHM > Server Configuration > Update Config:

1) Select ‘Automatic (RELEASE Tree)’
2) Verify that the cPanel Package Update and Security Package Update are
also set to ‘Automatic’
Next WHM > Security > Shell Fork Bomb Protection:

1) Enable Protection
Next, go to WHM > Security > Tweak Security please enable:

1) Php open_basedir Tweak
2) Compilers Tweak
3) SMTP Tweak
Next, WHM > Service Configuration:

1) Exim Configuration editor – enable Verify the existence of email senders

2) FTP configuration – Make sure Anonymous FTP is disabled
3) Nameserver Setup – Be sure that the nameserver is running
4) Service Manager – Check to monitor all EXCEPT the following:
Entropychat, Interchange, Melange, Tomcat and Exim on Another Port
Next, WHM > Cluster/Remote Access > Setup Remote Access Key:

1) Connect to SSH (if not already) and run the script:
pico /usr/local/cpanel/Cpanel/rvwhmkey
2) Copy/paste the key into the space provided, click ctrl x to exit, y to
save and hit enter to return to the prompt.

(NOTE: if there is no pico, an alternate method can be used: vi
/usr/local/cpanel/Cpanel/rvwhmkey; then press ‘i’ to insert text; paste
text; hit ‘esc’ to stop inserting text; press ‘:wq’ to save and exit- if you
need to exit without saving- ‘:q!’ will bring you back to prompt)
Next, back to WHM > Account Functions > Create a New Account:

1) Create an account with domain ‘‘, username ‘rvadmin’ and
password of <same as root>
Next, WHM > System Health > Background Process Killer:

1) Click all open boxes and save.
Next, WHM > cPanel xx.xx.xx > Addon Modules:

1) Click on cPanel Pro, Clamavconnector, Modbandwidth, Modsecurity and
Addonupdates and click ‘save’ to install.
Next, WHM > cPanel xx.xx.xx > Addon Scripts:

1) Click all and click ‘save’ to install.
Next, WHM > Add-ons:


Important Scripts

Resore pkg

cat /root/finallist | awk -F. ‘{print $1}’ > /root/list0
for i in `cat /root/list0`;do /scripts/restorepkg $i;done

to copy the dailybackups for a list of  users to a user home from server backup

for i in `cat /root/thewebcousers`; do
cp -rp /backup/cpbackup/daily/$i.tar.gz /home/thewebco
chown thewebco.thewebco /home/thewebco/$i.tar.gz


for i in `cat /root/a2z`; do
grep -rl c99shell /home/$i*/public_html/* >> /root/c99list
grep -rl r57shell /home/$i*/public_html/* >>  /root/r57list


 for i in `ps aux |  grep /usr/local/apache/bin/httpd | sort -rn +2 -3 | awk ‘{print $2}’`; do ll /proc/$i | grep -E ‘\/home\/’; done


cat /etc/trueuserdomains | awk -F: ‘{print $2}’ | sed ‘s/ //g’ > /root/tt
for i in `cat /root/tt`;do
/scripts/runweblogs $i;


Ruby on Rails Installation Script

cd /usr/src
tar -xzvf ruby-1.8.5.tar.gz
cd ruby-1.8.5/
make test
make install
cd /usr/src
tar -zxvf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb
gem update
gem install rails –include-dependencies
rails /usr/local/rails
mv /usr/local/rails/public/.htaccess /usr/local/rails/public/.htaccessfile
echo “RewriteBase /rails” > /usr/local/rails/public/.htaccess
cat /usr/local/rails/public/.htaccessfile >> /usr/local/rails/public/.htaccess
mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conffile
echo “Alias /rails /usr/local/rails/public” > /usr/local/apache/conf/httpd.conf
cat /usr/local/apache/conf/httpd.conffile >> /usr/local/apache/conf/httpd.conf
cd /usr/local/cpanel/apache
/usr/local/apache/bin/apxs -iac mod_log_bytes.c
/usr/local/apache/bin/apxs -iac mod_bwlimited.c
/usr/local/apache/bin/apxs -iac mod_bandwidth.c
/etc/rc.d/init.d/httpd restart

Ruby on Rails Issue

1) First remove all gems

gem uninstall rails
gem uninstall mongrel
gem uninstalled fastthread

2) Now run cPanel’s Ruby installation script


3) Now second command as required by cPanel


4) It seems cPanel’s “fast head” forgets to install, fast Thread

gem install fastthread

5) App’s don’t run still? – The issue in my case was outdated GEM! Mongrel did not want to run with the old version. So run:

gem update –system

6) Restart cPanel (not required but I like to do it)

/etc/init.d/cpanel restart