Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
What is Plesk Mirror Setup Tool v3.1.4 and how to use it?
Answer
Plesk Mirror Setup Tool can be used if it is required to have a local Plesk repository (mirror) for use in an internal network environment.
A mirror - is a website available via HTTP, which can be used as a source for installing/upgrading Plesk family products using autoinstaller. A mirror can be used in either of the following ways:
-
by changing DNS resolving and setting up the mirror web host so that http://autoinstall.plesk.com (for Plesk Linux) or http://autoinstall-win.plesk.com/ (for Windows) would point to the mirror;
-
by specifying the URL to the mirror in the
SOURCE
variable of the /root/.autoinstallerrc or C:\.autoinstallerrc file on the machine where autoinstaller is launched;# SOURCE=http://uri.of.local.mirror/here/
-
by specifying the mirror URL in the --source option when launching autoinstaller in interactive mode.
The main feature set of the Mirror Setup Tool allows providers to manage selected Plesk versions and operating systems. The tool also offers an interface for managing pre-launch testing of upcoming Plesk releases.
The tool should be launched on a Linux system. The mirror (rsync) can be running on Linux or Windows systems.
Please feel free to discuss the tool in the special thread on the Plesk Forum.
Note: Plesk Windows and Plesk Linux mirrors CAN NOT be located in the same folders. Mirrors MUST be created in separate paths.
Note: If after following this guide, an update/upgrade of Plesk using this new mirror shows any error like "The requested URL returned error: 404 Not Found", it's required to re-synchronize the mirror again as such file is missing.
Below are the instructions on how to use the tool and typical scenarios:
-
Prerequisites:
-
Each Plesk for Linux version requires around 500MB of free disk. For Windows, it's 4GB.
-
Virtual host used for mirroring should have all script handlers (php, pl, cgi, py, fcgi etc) disabled;
-
Virtual host or directory used for mirroring should have the option
+FollowSymLinks
set; -
Unless the other sources are specified,
rsync://rsync.autoinstall.plesk.com/autoinstall
andrsync://ch.origin.autoinstall-win.plesk.com/autoinstall
for Plesk Windows must be accessible from the machine, where the script is being run, and from the destination machine; -
PHP must be compiled with the support of the below extensions on the machine, where the script is being run (see http://www.php.net/manual/en/ssh2.installation.php ):
- ssh2_connect
- simplexml
- XML DOM
Below are sample instructions on compiling PHP with the required extensions (they can be different depending on the operating system version):
-
CentOS 7:
# yum install gcc php-devel php-pear libssh2 libssh2-devel make
# pecl install -f ssh2
# echo extension=ssh2.so > /etc/php.d/ssh2.ini
# service httpd restart
# php -m | grep ssh2 -
AlmaLinux:
# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# pecl install -f https://pecl.php.net/get/ssh2-1.1.2.tgz
-
-
When all the prerequisites are met download the tool using the following link: mirrorctlv3.1.4.zip and use the instructions below.
Note: Plesk Onyx mirrors are available since version 3.1.1 of the utility. Make sure you are using the latest version from this article.
-
Unzip the archive.
-
Select required products and OSes that you would like to mirror. You may use the
show-all-releases
command to view available products andos-list
command to view OSes supported by particular product. -
Create configuration of repository on local server with
cfg --add
andcfg --remove
options. -
Save the current configuration of the repository using
cfg --export
option. It will be saved to amirror.xml
file on the specified path. -
Use
cfg --import
option to load configuraion which was saved earlier, or configuration of an existing mirror, which was created usingmirrorctl
utility and, then, saved to `path/mirror.xml. -
Create a mirror for needed product versions and OSes using
update
command. Note, that from this repository you will be able to install only the product versions and OSes which were specified in the mirror configuration. All other versions will not be available in this repository forautoinstaller
utility. -
If you need to mirror a server different from the official repository, you may use the
push
command. Using that command you can upload product versions and OSes specified in a configuration file to an existing mirror, specified using--path
. (This command may work incorrectly with a mirror, which was not created using mirrorctl tool).
-
-
User Interface and Syntax
Note: for Plesk for Windows mirroring specify
--win
option for all commands used (see below); Use separate configuration files for Plesk Windows and Plesk Linux mirrors. If the below descriptions are not clear, try reading the "Use Case Examples" section below.-
Options for working with an external source repository:
show-all-releases [--win] [--src-host=
<URL to source repository>
] - list available product versions.
product-list - obsoleted byshow-all-releases
option. Not shown in help anymore.
os-list --release=<product release>
- list available OSes for the selected product version. -
Options for configuring local repository:
cfg --add [--win] --release=
<product release>
--os=<product os>
[--cfg-file=<path to config file>
] - add OS for selected version of product to repository.
cfg --remove [--win] --release=<product release>
--os=<product os>
[--cfg-file=<path to config file>
] - remove OS for selected version of product from repository.
cfg --check [--win] [--cfg-file=<path to config file>
] - check validity of config file, including compliance of the required product versions and operating systems with their presence in 'plesk.inf3
' file.
cfg --import --path=<repository path>
- get configuration from local repository.
cfg --export --path=<repository path>
- save configuration to local repository -
Options for synchronizing the local repository:
update [--win] --path=
<repository path>
- sync current state of repository according to the changes in configurationNote: The update command works only with the default repository ( rsync://autoinstall.plesk.com ). If you need to synchronize your mirror with another mirror you need to use the push command below.
push [--win] --src-host=
<URL to source reposity>
--path=</repository/path>
[--cfg-file=<config>
] [--private-key=<key>
--public-key=<key>
] - merge local repository to main repository and apply changes to configuration of main repository.Note : To avoid confusion when synchronizing with main repository, the configuration file used for the push command is recommended to be different from the one used for the update command.
-
Common options:
version – display the tool version
help, -h, --help – list available commands -
Miscellaneous options:
--path: is used to specify path to the receiving host. May include login, password, hostname, port and path in the file system
Format:
CONFIG_TEXT: --path=[login[:password@][host:][port]/path/to/repository
Note: The path must exist, and the user with specified login must have "rwx" access to it.
Examples: Using all parameters:
CONFIG_TEXT: --path=root:mypassword@server.domain.com:344/path/to/repository
Specifying username:
CONFIG_TEXT: --path=root@server.domain.com:/path/to/repository
Specifying port. Current username will be used along with corresponding ssh keys:
CONFIG_TEXT: --path=server.domain.com:4322/path/to/repository
Specifying username and password. Default port will be used:
CONFIG_TEXT: --path=root:mypassword@server.domain.com:/path/to/repository
Specifying local repository:
CONFIG_TEXT: --path=/path/to/repository
--src-host - used to specify parameters for a source repository in the format of rsync command (see "man rsync").
Format:
Using rsync daemon as a source:
CONFIG_TEXT: --src-host=rsync://[user@]host[:port]/path
Note: When using rsync protocol, start
rsyncd
daemon on the source host and configure it to be accessible from both the target server and the server where the tool is being run.Get data through an SSH connection:
CONFIG_TEXT: --src-host=[user@]host:/path
Note: When using SSH protocol for synchronizing data from the specified repository you need to set up authorization via SSH keys so that the user specified in --path option could login without a password to the source host as a user specified in the --src-host option. Additionally, the user under which the tool is being run on the local machine should able to be authorized on the needed host without password using SSH keys as a user specified in --src-host option.
Get data from the local disk:
CONFIG_TEXT: --src-host=/path
Note: Local source host for push command can be specified only in combination with local --path (i.e. when source and destination repositories are physically located on the same machine).
-
-
Common use case scenarios
-
Common precondition:
Download the latest available version, unzip it and go to the mirrorctl directory:
# wget --output-document=/opt/mirrorctl.zip https://plesk.zendesk.com/hc/article_attachments/12388062580887/mirrorctl-3.1.4.zip
# unzip /opt/mirrorctl.zip
# cd ./mirrorctl-3.1.4/
Use Case 1 - Creating a mirror for a limited list of product versions/OSesIt is required to create a mirror where only these product versions/OSes are available:
CONFIG_TEXT: Plesk Onyx for Ubuntu 16 x86_64, CentOS 7 x86_64
Plesk 12.5 for CentOS 6 i386
Plesk Onyx for WindowsInstructions:
-
Create mirror configuration by adding the needed OSes for the needed product versions:
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=ubt16.04_x86_64
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=cos7_x86_64
# ./mirrorctl cfg --add --release=PLESK_12_5_30 --os=cos6_i386
# ./mirrorctl cfg --add --win --release=PANEL_17_5_30_WIN --cfg-file=./plesk_win_mirror -
Create a directory for the mirror:
# mkdir /var/www/html/mirror/
# mkdir /var/www/html/mirror_windows/ -
Synchronize the mirror with the official repository:
# ./mirrorctl update --path=/var/www/html/mirror/
# ./mirrorctl update --win --path=/var/www/html/mirror_windows/ --cfg-file=./plesk_win_mirror -
Check the list of releases available in the created mirror:
# ./mirrorctl show-all-releases --src-host=/var/www/html/mirror/
# ./mirrorctl show-all-releases --win --src-host=/var/www/html/mirror_windows/ -
Check the list of mirrored OSes for a particular release:
# ./mirrorctl os-list --release=PLESK_17_5_30 --src-host=/var/www/html/mirror/
Use Case 2 - Setting up periodic updates for your mirrorIt is required to have an own mirror (where only a limited list of product versions/OSes is available) to get periodically updated with the latest product releases.
Instructions:
-
Create mirror configuration by adding the needed OSes for the needed product versions:
# /home/user/mirrorctl/mirrorctl cfg --add --release=PLESK_17_5_30 --os=ubt16.04_x86_64 --cfg-file=/var/www/html/mirror/myconfig.xml
# /home/user/mirrorctl/mirrorctl cfg --add --release=PLESK_17_5_30 --os=cos7_x86_64 --cfg-file=/var/www/html/mirror/myconfig.xml
# /home/user/mirrorctl/mirrorctl cfg --add --release=PLESK_12_5_30 --os=cos6_i386 --cfg-file=/var/www/html/mirror/myconfig.xml
# /home/user/mirrorctl/mirrorctl cfg --add --win --release=PANEL_17_5_30_WIN --cfg-file=/var/www/html/mirror/windows_myconfig.xml -
Configure crontab to automatically update the mirror:
# crontab -l
# m h dom mon dow command
59 23 * * * cd /home/user/mirrorctl/ && ./mirrorctl update --path=/var/www/html/mirror/ --cfg-file=/var/www/html/mirror/myconfig.xml > ./mirror-cron.log 2>&1
59 22 * * * cd /home/user/mirrorctl/ && ./mirrorctl update --win --path=/var/www/html/mirror_windows/ --cfg-file=/var/www/html/mirror/windows_myconfig.xml > ./mirror-cron-win.log 2>&1
Use Case 3 - Adding OSesIt is required to add a particular OS for a particular product version to my mirror.
Instructions:
-
Import the current configuration of the repository which you earlier created using mirrorctl utility:
# ./mirrorctl cfg --import --path=/var/www/html/mirror/ --cfg-file=myconfig
-
Add the needed OS for the needed product version (Plesk 12.0.18 on CentOS 5):
# ./mirrorctl cfg --add --release=PLESK_12_0_18 --os=cos5_i386 --cfg-file=myconfig
-
Synchronize the mirror:
# ./mirrorctl update --path=/var/www/html/mirror/ --cfg-file=myconfig
Use Case 4 - Downloading a particular OS/versionIt is required to download a particular OS for a particular product version to my mirror from the official repository without downloading other mirrored versions/OSes.
Instructions:
-
Generate a configuration file containing only the OSes/product versions that you wish to download:
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=cos6_x86_64 --cfg-file=./temp-config
-
Download the specified OSes to an existing repository using push command:
# ./mirrorctl push --path=/var/www/html/mirror/ --cfg-file==./temp-config
Use Case 5 - Creating a mirror for testing new product versionsIt is required to create a test mirror for a new product version, test that version and upload only that tested version (without the latest Plesk updates which I have not yet tested) to the main repository.
Instructions:
-
Create a test mirror for all OSes of the new product version:
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=all --cfg-file=./test-config
# ./mirrorctl update --path=/var/www/html/test-mirror/ --cfg-file=./test-config -
Test the new version.
-
Upload the whole product version to the main repository.
# ./mirrorctl push --src-host=/var/www/html/test-mirror/ --path=/var/www/html/mirror/ --cfg-file=./test-config
Note: If --src-host option is not used, then the new product version will be uploaded from the official repository and may be different from the one you have tested.
Use Case 6 - Creating a mirror for testing product releases for new OSesIt is required to create a test mirror with a particular list of OSes for already mirrored product versions with the latest updates, test those OSes and then upload some of the tested OSes to the main repository.
Instructions:
-
Create a test mirror where several OSes will be available for PLESK_17_5_30:
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=ubt16.04_x86_64 --cfg-file=./test-config
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=cos7_x86_64 --cfg-file=./test-config
# ./mirrorctl update --path=/var/www/html/test-mirror/ --cfg-file=./test-config -
Get the list of available product releases and OSes from the test mirror created above:
# ./mirrorctl show-all-releases --src-host=/var/www/html/test-mirror/
# ./mirrorctl os-list --release=PLESK_17_5_30 --src-host=/var/www/html/test-mirror/ -
Generate a new configuration file containing only those releases and OSes from the test mirror which you would like to add to the main mirror:
# ./mirrorctl cfg --add --release=PLESK_17_5_30 --os=cos7_x86_64 --src-host=/var/www/html/test-mirror/ --cfg-file=push.xml
-
Check the created configuration file on the availability of the releases/OSes in the test repository:
# ./mirrorctl cfg --check --src-host=/var/www/html/test-mirror/ --cfg-file=push.xml
-
Upload the selected releases and OSes from the test mirror to the main repository:
# ./mirrorctl push --src-host=/var/www/html/test-mirror/ --path=/var/www/html/mirror/ --cfg-file=push.xml
Note: If --src-host option is not used, then the new product version will be uploaded from the official repository and may be different from the one you have tested. If the --cfg-file option is not specified, the default configuration file
BUILD/config.xml
(relatively to the directory where the tool is located) will be used. I.e. only the versions/OSes from that configuration file will be uploaded to the main repository. If the --cfg-file option is specified incorrectly, the configuration file specified for the push command will be used.
Use Case 7 - Managing Remote MirrorsThe tool can work with remote repositories, but with certain limitations. Below you may find examples of using --path and --src-host options in cases when remote destination mirror or remote destination and source mirrors are used.
Examples of using --path option for a remote destination mirror:
-
Using a particular user, password and host:
CONFIG_TEXT: --path=user:UserSecurePassword@mymirror.tld:344/var/www/html/
--path=user:UserSecurePassword@192.168.100.100:22/var/www/html/
--path=root:RootSecurePassword@localhost:/var/www/html/ -
Using SSH keys authorization (both private and public keys are required):
CONFIG_TEXT: --path=192.168.100.100:/var/www/html/
If default RSA pair (id_rsa & id_rsa_pub) for current user does not exist, then default DSA pair (id_dsa & id_dsa.pub) from
$HOME/.ssh/
folder will be used.CONFIG_TEXT: --path=user@mymirror.tld:344/var/www/html/
-
Using particular SSH keys as additional options for
mirrorctl
utility:CONFIG_TEXT: --path=root@mymirror.tld:344/var/www/html/ --private-key=~/.ssh/id_mirror --public-key=~/.ssh/id_mirror.pub
Examples of using --src-host option for a remote source mirror:
-
Using rsync via SSH protocol:
CONFIG_TEXT: --src-host=test@192.168.100.100:/var/www/html/test-mirror/
--src-host=mytestmirror.tld:/var/www/html/test-mirror/ -
In the above case it is forbidden to specify user password or SSH port (22).
-
In case --src-host option is used, the user who launches the tool must have SSH keys authorization set up for him to be able to connect to the host specified under --src-host option and under the user specified via that option.
-
If the --src-host option is used along with the --path option, then, again, the user specified in the --path option must have SSH keys authorization set up for him to be able to connect from the host specified in the --path option to the host specified under --src-host option and under the user specified via --src-host option.
-
Using rsync daemon on the source host:
CONFIG_TEXT: --src-host=rsync://mytestmirror.tld:873/testmirror
Example of rsync configuration:
# head /etc/rsyncd.conf
[testmirror]
path = /var/www/html/test-mirror/
comment = Test repository# cat /etc/xinetd.d/rsync
service rsync
{
# disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
Use Case 8 - Configure mirror as a source for EZ templatesThe mirror created with Mirror Setup Tool can be easily configured as a source for EZ templates:
-
Configure your virtual host with the mirror to be an alias for http://autoinstall.plesk.com:
Add the following to theVirtualHost
section of the Apache configuration:CONFIG_TEXT: ServerAlias "autoinstall.plesk.com"
If domain used for mirror is managed by Plesk, just add domain alias to the domain with Web service enabled.
-
Make host
autoinstall.plesk.com
resolving to your mirror IP.
Configure DNS severs used for resolving on your VZ nodes to resolve hostautoinstall.plesk.com
to your mirror IP.
Or add "<mirror IP> autoinstall.plesk.com
" to the end of/etc/hosts
file on your VZ nodes:# echo "192.168.10.10 autoinstall.plesk.com" >> /etc/hosts
-
Make symlinks used by EZ templates point to the mirrored releases.
In console: change directory to the mirror root and create symlinks pointed to the mirrored releases (for example Plesk Onyx):# cd /var/www/html/mirror/
# ln -s PSA_17.5.30 PANEL
# ln -s SITEBUILDER_17.0.15 PANEL_SITEBUILDER
# ln -s PSA_17.5.30 PSA17
# ln -s SITEBUILDER_17.0.15 SITEBUILDER17
# for d in . debian ubuntu; do ln -snfT PSA_17.5.30 $d/PANEL; ln -snfT PSA_17.5.30 $d/PSA17; done
# for d in . debian; do ln -snfT SITEBUILDER_17.0.15 $d/PANEL_SITEBUILDER; ln -snfT SITEBUILDER_17.0.15 SITEBUILDER17; done
# for d in . debian ubuntu; do ln -snfT NGINX17 $d/NGINX; done
# for php in PHP52 PHP53 PHP54 PHP55 PHP56 PHP70; do for d in . debian ubuntu; do ln -snfT "${php}_17" "$d/PANEL_${php}"; done; doneNote: In some cases it is needed to add read/execute permissions to all for the mirror recursively:
# chmod -R a+rx /var/www/html/mirror/
-
Comments
0 comments
Please sign in to leave a comment.