September 23, 2014

Using Percona rsync repositories to set up the local CentOS mirror

One of the more popular support requests we get involves setting up the official Percona rsync repositories that can be used to set up local mirrors. I’m glad to announce that this was implemented recently. You can now access the rsync repository at:

rsync://rsync.percona.com/rsync/

Setting up the local mirror can be useful if you have a larger number of systems and you don’t want to download packages from the remote repository multiple times, it can also be useful if the original repository is slower or inaccessible.

Setting up the local repository

Create a folder on disk where the files will be downloaded. Make sure you have enough space for this, currently repository for CentOS 6 is almost 2GB.

[root@percona1]# mkdir -p /data/repo/percona/

After this use createrepo to create all the necessary repository files:

[root@percona1]# createrepo /data/repo/percona/

After the repository files have been created you can start the download from the Percona’s rsync server (following example will download packages for 64-bit CentOS 6, you should alter the version and architecture if needed):

[root@percona1]# rsync -avrt rsync://rsync.percona.com/rsync/centos/6/os/x86_64/ /data/repo/percona/

You can now use the local repository by creating the new percona-local.repo file in the /etc/yum.repos.d/ folder.

[root@percona1]# cat /etc/yum.repos.d/percona-local.repo
[percona-local]
name=Local Percona repository
baseurl=file:///data/repo/percona/
gpgcheck=1
enabled=1

To check if the repository is set up correctly you can run:

[root@percona1]# yum update

If the previous command runs without errors, you can install Percona software from your local repository. Following example will install Percona XtraBackup:

[root@percona1]# yum install percona-xtrabackup.x86_64

If you want to keep the repository up-to-date with the official Percona repository, you’ll need to run the above mentioned rsync command either manually or you should add it to the crontab.

Sharing the packages

Previous example showed how to use the packages locally. In order to be able to distribute those packages we’ll need to install a web server. This example will use Apache web server as an example.

First set up a symbolic link to the Apache directory (default is code>/var/www/html/):

[root@percona1]# ln -s /data/repo/percona /var/www/html/percona

You can now add this local repository to other servers. To use this local repository you need to create percona-local.repo file in the /etc/yum.repos.d/ older.

[root@percona1]# cat /etc/yum.repos.d/percona-local.repo
[percona-local]
name=Local Percona repository
#IP of the local repository server set up in the previous step
baseurl=http://192.168.70.61/percona/
gpgcheck=1
enabled=1

To check if the repository is set up correctly you can run:

[root@percona2]# yum update

You can now install Percona XtraBackup from your local repository:

[root@percona2]# yum install percona-xtrabackup.x86_64

Comments

  1. Moritz Schuepp says:

    The apt-repository is also accessible! Great! Thank you!!!!!!!!

  2. Міша says:

    We had the rsync-ing setup for a year, but recently the cronjob started failing: rsync: change_dir “/centos” (in rsync) failed: Permission denied (13)

    Indeed, simply trying to browse:
    % rsync rsync://rsync.percona.com/rsync/centos/
    Gives the same error… The centos subdirectory is a symlink (though rsync does not say, to where) and that directory is not (any longer) accessible…

  3. Alexey Bychko says:

    hello, it’s fixed now, some minor problems with rsync server.

    just checked:
    `–> rsync -avt rsync://rsync.percona.com/rsync/centos/6/os/x86_64/ percona/
    receiving file list … done
    ./
    Percona-SQL-50-debuginfo-5.0.92-b23.89.rhel6.x86_64.rpm
    Percona-SQL-client-50-5.0.92-b23.89.rhel6.x86_64.rpm
    Percona-SQL-devel-50-5.0.92-b23.89.rhel6.x86_64.rpm

  4. Міша says:

    Thanks. Yes, the original error is gone, but things aren’t quite back to normal anyway. The rsync-attempt now returns:

    could not make way for new symlink: 5
    could not make way for new symlink: 6
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1532) [generator=3.0.6]

    Looks like some links got rearranged on the server, which messes rsync-ing up for people, who already have a mirror set up…

  5. Alexey Bychko says:

    Міша, please use urls from our percona-release rpm, there are no symlinks.
    http://www.percona.com/downloads/percona-release/redhat/

Speak Your Mind

*