Friday, 22 November 2013

Setup Yum Server on Linux step by step.

Yellowdog updater, Modified (Yum) is a software package manager that installs, updates and removes packages on RPM-based Linux distributions. Yum uses an online repository by default, and we can also configure it to use a local repository packages.

Use the below steps to setup yum serer on your linux server:
First of all mount the contents of your CentOS 6.2 DVD in the /mnt directory or wherever you want.

[root@Packages]#mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only.

Install vsftpd package, so that we can use this  as a FTP serer to share our repository in the client systems.
Change to the directory where you mounted CentOS DVD.

#cd /mnt/Packages
#rpm -ivh vsftpd (tab) vsftpd-2.2.2-11.el6.i686.rpm

Start the FTP service:

#service vsftpd start

Install createrepo package if it is not installed. This package will used to create our local repository:

[root@Packages]#rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
error: Failed dependencies:
      deltarpm is needed by createrepo-0.9.8-4.el6.noarch.rpm
      python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch.rpm

It shows us the dependency problem. So install missing dependencies first:

[root@Packages]#rpm -ivh deltarpm-3.5-0.5.200900810git.el6.x86_64.rpm
Preparing....           ##########################################[100%]
1:deltarpm             ##########################################[100%]

[root@Packages]#rpm -ivh python-deltarpm-3.5-0.5.200900810git.el6.x86_64.rpm
Preparing....           ##########################################[100%]
1:python-deltarpm  ##########################################[100%]

Now install the createrepo package:
[root@Packages]#rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
Preparing....           ##########################################[100%]
1:createrepo          ##########################################[100%]

Create a folder called yum (you can use your own) in /var/ftp directory to save all the packages from CentOS DVD.
Copy all the files in the yum folder from the DVD.

[root@Packages]# mkdir /var/ftp/yum
[root@Packages]#cp /mnt/Packages/* /var/ftp/yum/

After all packages are copied, create a repo file called it.repo in /etc/yum.repos.d directory.

[root@Packages]#vi /etc/yum.repos.d/it.repo
and type the following entries and save the files:

[not-install]
baseurl=ftp://ip address of server/yum
gpgcheck=0

Now it's time to create our repository:

[root@Packages]#createrepo /var/ftp/yum

Client side configuration:
Create a repo file in your client system as mentioned above in the /etc/yum.repos.d/ directory:

 [client@ss]#vi /etc/yum.repos.d/it.repo
and type the following entries and save the files:

[not-install]
baseurl=ftp://ip address of yum server/yum
gpgcheck=0

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

No comments:

Post a Comment