Setup Local YUM Server in RHEL 6.0 /CentOS 6.x / Scientific Linux 6.x step by step

Keywords : yum, yum server, Setup Local YUM Server in  RHEL 6.0 /CentOS 6.x / Scientific Linux 6.x step by step

Yellowdog updater, Modified (Yum)is a software package manager that installs, updates and removes packages on RPM-based Linux distributions. Yum makes it easier to maintain groups of machines without having to manually update each one using rpm.

Yum uses an online repository by default, but you can also configure it to use a local repository of packages. Following are the step-by-step instructions to configure a local yum repository server. The steps provided here are tested in REHEL 6.0 but should work fine with CentOS 6.3 and Scientific Linux 6.x too.

Step – 1 First you need to copy Packages in our Linux system. Insert your distribution disk (in my case Red Hat 6.0 server 64 edition). Browse the CD contents, you will see a directory named as “Packages”. Open it and copy all the files form it to ‘/var/ftp/pub‘.

Step – 2 Go to ‘/var/ftp/pub‘ directory.

1

Step – 3 Now you need to install vsftpd server first. Issue following command in the terminal:

# rpm -ivh vsftpd-2.2.2-6.el6.x86_64.rpm

2


Step – 4 Start the vsftpd server by issuing following command in the terminal:

# service vsftpd start

3

You should see response like below screen shot, if it fails try using ‘service vsftpd restart‘.

Step – 5 Install createrepo package if it is not installed. This package will be used to create your local repository. Issue the following command:

# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm

7

Above package depends upon following two packages:

(a) deltarpm

(b) python-deltarpm

So if you get any error like below screen shot you have to install these packages first.

4

Step – 5.1 Install deltarpm package by issuing following command in the terminal:

# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

5

Step – 5.2 Install pythondeltarpm package by issuing following command in the terminal:

# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

6

Now Install createrepo package if it is not installed. This package will be used to create your local repository. Issue the following command:

# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm

7

Step – 6 Create a repo file called myyumserver.repo in /etc/yum.repos.d/ directory.

# nano /etc/yum.repos.d/myyumserver.repo

Step – 7 Once the file is open , insert the text shown in below screen shot:

8

Step – 8 Create the repository by issuing following command in the terminal:

# createrepo -v /var/ftp/pub/

9

You should see output something like this:

10

11

Step – 9 Delete or rename all the other repo files except the newly created repo file in /etc/yum.repos.d/ i.e in our example it is mylocalyumserver.repo.

Step -10 Update yum by issuing following command in the terminal:

# yum update

12

Client side configuration:

Step – 11 Create a repo file in your client system as mentioned above in the /etc/yum.repos.d/ directory

Step -12 Remove or rename the existing repositories.

Step -13 Then modify the baseurl as mentioned below:

[myyumserver]
comment ="My Local Repository"
baseurl=ftp://192.168.1.3/pub/
gpgcheck=0
enabled=1

You can change the IP address mentioned above with your server’s IP. That’s it. Now you can install packages using following command:

# yum install <package_name>

See below screen shots for your reference:

14

Please like and share if you find this post useful. Don’t forget to like the facebook page of Techawarey. 🙂 🙂

 

6 Thoughts to “Setup Local YUM Server in RHEL 6.0 /CentOS 6.x / Scientific Linux 6.x step by step”

  1. James

    Thanks for a great tutorial. How can i update the packages with the latest ones released?

    1. Thanks for the comment…

      I am sorry i have a little experience with Red Hat,,, But you can do the following .. It might help you…

      In Red Hat linux, you have two options :

      Either get the license from Red Hat or get a new image Red Hat linux.

      Change the content of yum server with new one and then issue the command to upgrade the packages.

  2. Mahesh Pejgude

    Thanks very helpful 🙂

  3. Anonymous

    Thank you very much as you published such a nice steps

Leave a comment....