Skip to content

Instantly share code, notes, and snippets.

@jpswade
Last active October 5, 2023 15:54
Show Gist options
  • Save jpswade/4e2826d5c88cee4eac72 to your computer and use it in GitHub Desktop.
Save jpswade/4e2826d5c88cee4eac72 to your computer and use it in GitHub Desktop.
Install cPanel for CentOS
#!/bin/bash
# setup_cpanel - Setup new cPanel Server.
# @see https://gist.github.com/jpswade/4e2826d5c88cee4eac72
# @see https://docs.cpanel.net/installation-guide/cpanel-dnsonly-installation/
set -e
### Settings
CPANEL_SCRIPT_URL=http://httpupdate.cpanel.net/
CPANEL_SCRIPT=latest
[[ "$1" == dnsonly ]] && CPANEL_SCRIPT=latest-dnsonly
echo ${CPANEL_SCRIPT}
### Logic
yum -y groupremove "FTP Server" "GNOME Desktop Environment" "KDE (K Desktop Environment)" "Mono" "Mail Server" "E-mail Server" "Web Server" "X Window System"
echo SELINUX=disabled>/etc/selinux/config
echo SELINUXTYPE=targeted>>/etc/selinux/config
chkconfig iptables off
service iptables stop
yum -y update
yum -y install perl nano
wget -N ${CPANEL_SCRIPT_URL}/${CPANEL_SCRIPT} -O ~/${CPANEL_SCRIPT}
sh ~/${CPANEL_SCRIPT} --force
/scripts/configure_rh_firewall_for_cpanel
# Remove the Trial License banner
mv /usr/local/cpanel/cpanel.lisc /root/trashfiles/
mv /root/.cpanel/datastore/_usr_local_cpanel_cpanel_-F /root/trashfiles/
/usr/local/cpanel/scripts/restartsrv_cpsrvd
/usr/local/cpanel/cpkeyclt
echo Done!
#EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment