Setup Local YUM Server in RHEL/CentOS


Setup Local YUM Server in RHEL

/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.













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













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

# service vsftpd start












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



















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.














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














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













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



















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:


























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

# createrepo -v /var/ftp/pub/









You should see output something like this:



























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




























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

See below screen shots for your reference:



























Ref.  Techawarey.files.wordpress.com

Thank You.

Comments