How to create a Plesk Mirror
When you deploy Plesk to various instances on your local network you can save the world (and yourself) from a lot of internet traffic by creating a local mirror.
This is a duplicate of the original installer files needed to deploy Plesk which are downloaded once and can then be used from a machine on your network – which makes the installation much faster. This used to be a bit of a pain, but thanks to a new knowledge base article – and Ivan Butorin for telling me about this – it’s become so much easier to do.
In this example I’ll set the mirror up on my NC10 netbook running CentOS 6.5.
Download the helper script
Parallels have provided a small utility which will take care of the heavy lifting for us. You can get it from the above mentioned KB article. Download it to your local machine like this:
wget http://kb.parallels.com/Attachments/18911/Attachments/mirrorctl.zip unzip mirrorctl.zip cd mirrorctl
Now we can use the tool with ./mirrorctl
Add the ssh2 extension to PHP
If it was as easy as calling one file anyone could do it. Let’s make sure it gets much more complicated than it really needs to be!
The above script is written in PHP, and as we’ve learnt in a previous article we can run PHP scripts from the command line. That’s the good news.
The bad news is that the script requires the ssh2 extension which is available from this website and sadly not installed on CentOS by default. In fact what we have to do is
- install a few additional packages
- create ssh2 as a PECL extension
- and add it to the php.ini file
Sound Chinese? Let’s try this! First we install some (very possibly) missing packages:
yum install php-devel openssl-devel make gcc
Next we’ll grab hold of libssh2 from here: http://libssh2.org. You can find the latest version for your OS on that website. Let’s download it and compile it from source:
wget http://libssh2.org/download/libssh2-1.4.3.tar.gz tar -zxvf libssh2-* cd libssh2* ./configure make make install
That wasn’t everything… Now we need to grab the ssh2 component and do the same thing:
wget http://pecl.php.net/get/ssh2 tar -zxvf ssh2 cd ssh2-* phpize ./configure --with-ssh2 make make install
If all this went without any error messages you should find a new extension here: /usr/lib/php/modules/ssh2.so. We need to add this to our PHP configuration file and add this extension to it:
vi /etc/php.ini extension=ssh2.so
And Finally: work with the mirror tool
cd back into the mirrorctl directory and check if it works:
./mirrorctl show-all-releases ./mirrorctl os-list --release=PLESK_11_5_30
These commands will show you which versions are available (for example, PLESK_11_5_30), and in which flavours. The tool will show Linux distributions by default. Specify –win to display Windows flavours.
To configure the tool to build a local mirror for Plesk 11.5.3 on CentOS in 64bit you’d do this:
./mirrorctl cfg --add --release=PLESK_11_5_30 --os=cos6_x86_64
Trying to add OS ‘cos6_x86_64’ into config file… ok
Run this command multiple times to add more configurations. Then to begin the monumental download, execute this:
mkdir /mirror ./mirrorctl update --path=/mirror
All files will be copied into /mirror. Obviously you need to specify a directory that’s available to the machine you’d like to install Plesk to. Run the same command to perform an incremental update of the entire mirror (updates will be much faster than the initial installation).
Installing Plesk from your local mirror
You can find an autoinstaller file for your system here: http://www.parallels.com/download/plesk/installer/. You can specify ‘–source server:/path’ as an option to specify your mirror. To install from the above example mirror, this is how we’d do it:
wget http://autoinstall.plesk.com/plesk-installer chmod +x ./plesk-installer ./plesk-installer --source firstname.lastname@example.org:/mirror