If you have more than a few cPanel servers in your network, it may be a good idea to set up your own mirror to serve the files necessary to run cPanel updates. Doing this could save time and bandwidth, as well as prevent problems caused by mirrors being overloaded every time a new version of cPanel is released.
To start, you’ll need a physical or virtual server running a CentOS 7 minimal. I would recommend at least 50GB of space and 1GB of RAM, though more RAM wouldn’t be a bad idea if you have a lot of cPanel servers. If you do have a lot of servers, you may want to consider setting up several mirrors to help spread the load around. You can then either set up specific servers to use a certain mirror, or use round-robin DNS to link a hostname to the IP of each mirror you set up.
First, make sure to remove existing web servers:
Install firewalld:
Run the following script:
Now, make sure the cPanel-provided Varnish server is running:
Since this setup uses firewalld, by default the setup script will open ports 80 and 22. If you don’t want either of these enabled, you can remove them from the config like so:
And to add specific IPs to the public zone:
Alternatively, you can just remove firewalld and use iptables or whatever other firewall you want to use. Firewalld is only necessary during the installation process. Port 80 needs to be accessible by the hosts using the mirror.
Once the mirror is set up, you can confirm it is working by going to the hostname or IP of the server in a browser. You should see the cPanel downloads page loading. If you see other content, it means there’s another web server running on port 80 that needs to be disabled first.
To enable the mirror, simply add it to /etc/cpsources.conf:
When you run a cPanel update, it will pull sources from that mirror instead. cPanel recommend running an update from one server first in order to build the cache.
To start, you’ll need a physical or virtual server running a CentOS 7 minimal. I would recommend at least 50GB of space and 1GB of RAM, though more RAM wouldn’t be a bad idea if you have a lot of cPanel servers. If you do have a lot of servers, you may want to consider setting up several mirrors to help spread the load around. You can then either set up specific servers to use a certain mirror, or use round-robin DNS to link a hostname to the IP of each mirror you set up.
First, make sure to remove existing web servers:
yum remove httpd varnish
Install firewalld:
yum install firewalld
service firewalld start
systemctl enable varnish
Run the following script:
curl -L https://updateseeds.cpanel.net/install.sh | sh
Now, make sure the cPanel-provided Varnish server is running:
service httpupdate-varnish restart
systemctl httpupdate-varnish enable
/usr/sbin/httpupdate_varnish_update_vcl
Since this setup uses firewalld, by default the setup script will open ports 80 and 22. If you don’t want either of these enabled, you can remove them from the config like so:
firewall-cmd –zone=public –remove-service=ssh
And to add specific IPs to the public zone:
firewall-cmd –zone=public –add-rich-rule=’rule family=”ipv4″ source address=”1.2.3.4″ accept’
Alternatively, you can just remove firewalld and use iptables or whatever other firewall you want to use. Firewalld is only necessary during the installation process. Port 80 needs to be accessible by the hosts using the mirror.
Once the mirror is set up, you can confirm it is working by going to the hostname or IP of the server in a browser. You should see the cPanel downloads page loading. If you see other content, it means there’s another web server running on port 80 that needs to be disabled first.
To enable the mirror, simply add it to /etc/cpsources.conf:
HTTPUPDATE=your.mirror.com
When you run a cPanel update, it will pull sources from that mirror instead. cPanel recommend running an update from one server first in order to build the cache.
0 comments:
Post a Comment