Creating a Merged YUM Repo on Amazon S3

V 1.0 11/28/2013 - © Alexey Zilber


Making repository snapshots and maintaining your own repository can provide you with a safeguard against external repositories going down. Duplicate packages and streamlining your repo configs is also possible. We'll focus on CentOS using YUM to setup our own repository on Amazon's S3 service.

Setup an Amazon AWS Account

First, you'll need somewhere to store your repo. I recommend using Amazon's S3 service for it's redundency and speed. Go ahead and Singup here. Once you've signed up, login to the AWS Management Console. Once you're logged in, click on S3 and create your bucket. Go ahead and name it something simple, using all lowercase letters. I'm going to call it 'myownrepo' for this exercise. For the region, choose one that is nearest to the location you'll be pulling data from:

Setup a CentOS Server/Instance

Whether you want to use an Amazon EC2 instance or you're using a server is up to you. In this example, we'll be setting up a merged info for multiple version of MariaDB. Go ahead and launch an instance of CentOs 6.x or setup a server.

Setup MariaDB Repositories

Once your server is up and running, let's go ahead and add two MariaDB repositories. One will be the current 5.5.x version, which can be auto configured using this url:

Let's look at the code that it generates:

# MariaDB 5.5 CentOS repository list - created 2013-11-28 08:00 UTC
name = MariaDB
baseurl =

Go ahead and paste this into /etc/yum.repos.d/MariaDB.repo

Now lets setup another one with an older version. Lets use version 5.5.33a for the older version. We can grok around and discover there's a 5.5.33a repo at

Let's go ahead and use that in a new code block that we'll save as /etc/yum.repos.d/MariaDB2.repo. Here's the second code block:

# MariaDB 5.5 CentOS repository list - created 2013-11-28 08:00 UTC
name = MariaDB2
baseurl =

Go ahead and run

yum makecache

Install the tools and Configure them

We will now install all the tools we need:

yum -y install s3cmd reposync createrepo

After these tools are installed, run:

s3cmd --configure

You will need to enter your AWS keys that you can grab here under *Access Keys (Access Key ID and Secret Access Key)*.

Let's now setup the directories we'll need to merge the repositories. We'll want 2 directories for this. Create /tmp/maria1 and /tmp/maria2.

Pulling and Merging the Repositories

Cd into /tmp/maria1. We'll want to pull the current, active MariaDB repo into here. Run:

reposync --repoid=MariaDB

Now, cd into /tmp/maria2 and run:

reposync --repoid=MariaDB2

Copy all the files from /tmp/maria2/MariaDB2/rpms/ into /tmp/maria1/MariaDB/rpms/.

Now go into /tmp/maria1/MariaDB and run:

createrepo -m .

You've now created a merged repo!

Sync over the repository to S3

Let's copy over the repository to S3 so you can use it:

s3cmd -P sync . s3://myownrepo/

Complete the config

Now, let's go ahead and delete both /etc/yum.repos.d/MariaDB.repo and /etc/yum/repos.d/MariaDB2.repo. We're going to create /etc/yum.repos.d/myown.repo with this code:

# My Own Merged Repo
name = MyOwnRepo
baseurl = http://

Now run <code> yum clean all yum makecache <code>

Congratulations! You have now merged two repos into your own!

If you ever want to update your own repository, follow these steps, but substitute your own repo for the 'old version'.

Internet | Unix/Linux | Computing | Systems

QR Code
QR Code creating_a_merged_yum_repository (generated for current page)