Your web hosting partners since 2004.
Buy now »

How to setup a cPanel server using OpenVZ

To make it super simple and easy to setup cPanel on an OpenVZ server, we've created a script to do the heavy lifting for you.

You just need to configure the definitions at the top of the script, then run it.

CTID=1234
CTID_IP=123.123.123.123
CTID_IP_MAIL=123.123.123.124
CTID_HOSTNAME=XXXX.example.com
DISK_SPACE=50G
OS_TEMPLATE=centos-7-x86_64
NAMESERVER_1=1.1.1.1
NAMESERVER_2=1.1.1.2
NAMESERVER_3=1.1.1.3

#logic
vzctl create ${CTID} --ostemplate ${OS_TEMPLATE} --hostname ${CTID_HOSTNAME} --ipadd ${CTID_IP} --ipadd ${CTID_IP_MAIL}
vzctl set ${CTID} --diskspace ${DISK_SPACE}:${DISK_SPACE} --save
vzctl set ${CTID} --nameserver ${NAMESERVER_1} --nameserver ${NAMESERVER_2} --nameserver ${NAMESERVER_3} --save
vzctl set ${CTID} --onboot yes --save
vzctl start ${CTID}
vzctl exec ${CTID} 'yum -y groupremove "FTP Server" "GNOME Desktop Environment" "KDE (K Desktop Environment)" "Mono" "Mail Server" "E-mail Server" "Web Server" "X Window System"'
vzctl exec ${CTID} echo SELINUX=disabled>/etc/selinux/config
vzctl exec ${CTID} echo SELINUXTYPE=targeted>>/etc/selinux/config
vzctl exec ${CTID} chkconfig iptables off
vzctl exec ${CTID} service iptables stop
vzctl exec ${CTID} yum -y update
vzctl exec ${CTID} yum -y install perl nano
vzctl exec ${CTID} cd /home
vzctl exec ${CTID} wget -N https://securedownloads.cpanel.net/latest -O /home/latest
vzctl exec ${CTID} sh /home/latest --force
vzctl exec ${CTID} /scripts/configure_rh_firewall_for_cpanel

echo Done!
#EOF

Simply copy this to something like setup_cpanel_vz.sh on the hardware node, then run it using sh setup_cpanel_vz.sh.

That's it!

Last updated: 2022-02-20

« Go Back

Order now »

The support has been fantastic with help in areas they are not obliged to offer but still do.