DEVTOME.COM HOSTING COSTS HAVE BEGUN TO EXCEED 115$ MONTHLY. THE ADMINISTRATION IS NO LONGER ABLE TO HANDLE THE COST WITHOUT ASSISTANCE DUE TO THE RISING COST. THIS HAS BEEN OCCURRING FOR ALMOST A YEAR, BUT WE HAVE BEEN HANDLING IT FROM OUR OWN POCKETS. HOWEVER, WITH LITERALLY NO DONATIONS FOR THE PAST 2+ YEARS IT HAS DEPLETED THE BUDGET IN SHORT ORDER WITH THE INCREASE IN ACTIVITY ON THE SITE IN THE PAST 6 MONTHS. OUR CPU USAGE HAS BECOME TOO HIGH TO REMAIN ON A REASONABLE COSTING PLAN THAT WE COULD MAINTAIN. IF YOU WOULD LIKE TO SUPPORT THE DEVTOME PROJECT AND KEEP THE SITE UP/ALIVE PLEASE DONATE (EVEN IF ITS A SATOSHI) TO OUR DEVCOIN 1M4PCuMXvpWX6LHPkBEf3LJ2z1boZv4EQa OR OUR BTC WALLET 16eqEcqfw4zHUh2znvMcmRzGVwCn7CJLxR TO ALLOW US TO AFFORD THE HOSTING.

THE DEVCOIN AND DEVTOME PROJECTS ARE BOTH VERY IMPORTANT TO THE COMMUNITY. PLEASE CONTRIBUTE TO ITS FURTHER SUCCESS FOR ANOTHER 5 OR MORE YEARS!

Creating a Merged YUM Repo on Amazon S3

V 1.0 11/28/2013 - © Alexey Zilber

PURPOSE

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: https://downloads.mariadb.org/mariadb/repositories/#mirror=yongbok&distro=CentOS&distro_release=centos6-amd64&version=5.5

Let's look at the code that it generates:

# MariaDB 5.5 CentOS repository list - created 2013-11-28 08:00 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

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 http://yum.mariadb.org/ and discover there's a 5.5.33a repo at http://yum.mariadb.org/5.5.33a/centos6-amd64/

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
# http://mariadb.org/mariadb/repositories/
[mariadb2]
name = MariaDB2
baseurl = http://yum.mariadb.org/5.5.33a/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

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 https://console.aws.amazon.com/iam/home?#security_credential 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
[myownrepo]
name = MyOwnRepo
baseurl = http://http://s3-us-west-2.amazonaws.com/myownrepo
gpgcheck=0

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)
 

Advertise with Anonymous Ads