Configuring local yum repository with FTP for CentOS 5.5

Configuring Yum Server

Step 1:

Check if vsftpd is installed on your system or not
[root@ns1 ~]# rpm -q vsftpd
package vsftpd is not installed

Step 2:

Insert the media and if vsftpd is not already installed on your system install it
[root@ns1 ~]# cd /media/CentOS_5.5_Final/CentOS/
[root@ns1 CentOS]# rpm -ivh vsftpd-2.0.5-16.el5_4.1.i386.rpm
warning: vsftpd-2.0.5-16.el5_4.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing…                ########################################### [100%]
1:vsftpd                 ########################################### [100%]
[root@ns1 CentOS]#

Step 3:

copy the contents of media in /var/ftp/pub/centos5.5/.
[root@ns1 CentOS]# cp -rvf /media/CentOS_5.5_Final/ /var/ftp/pub/centos5.5/
You can also use .iso file without extracting packages from it. So, in this case you will have to do the following instead of using cp command as shown above.
[root@ns1 CentOS]# mkdir /var/ftp/pub/centos5.5
[root@ns1 CentOS]# mount -o loop CentOS-5.5-i386-bin-DVD.iso /var/ftp/pub/centos5.5
You will have to make an entry in /etc/fstab so that the contents of .iso should be available in /var/ftp/pub/rhel5.4 on your next reboot.
/root/CentOS-5.5-i386-bin-DVD.iso   /var/ftp/pub/centos5.5/    iso9660  defaults,loop    0   0
here I am assuming that your .iso image is stored in /root directory.

Step 4:

As we want to use our local repository for package instalaltion, we will move the two files in /etc/yum.repos.d/ to /root. We can also change the value of enabled=0 in these files. In this case there will be no need to move them from /etc/yum.repos.d/
[root@ns1 CentOS]# cd /etc/yum.repos.d/
[root@ns1 yum.repos.d]# ll
total 16
-rw-r–r– 1 root root 2245 Apr 25  2010 CentOS-Base.repo
-rw-r–r– 1 root root  626 Apr 25  2010 CentOS-Media.repo
[root@ns1 yum.repos.d]# mv CentOS-* /root/

Step 5:

Create a file named base.repo in /etc/yum.repos.d  with the following contents
[base]
name=CentOS Base
baseurl=ftp://192.168.1.250/pub/centos5.5/
enabled=1
gpgcheck=0
192.168.1.250 is the ip address of your system which you are configuring as yum server.
You can also use the baseurl as shown below. If you choose the above you need step 6, if you choose below configuration, you need don’t need step 6.
[base]
name=CentOS Base
baseurl=file:///var/ftp/pub/centos5.5/
enabled=1
gpgcheck=0

Step 6:

You need to start vsftpd demon and mark it on at runlevel 345 so that this service starts automatically  no next reboot.
[root@ns1 yum.repos.d]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@ns1 yum.repos.d]# chkconfig vsftpd –level 345 on
Step 6 is must if your server is going to act as a yum server for other clients.

Configuring yum client

Step 1:

Create a file named base.repo in /etc/yum.repos.d  with the following contents
[base]
name=CentOS Base
baseurl=ftp://192.168.1.250/pub/centos5.5/
enabled=1
gpgcheck=0

And your system is ready to send request to yum server.

Advertisements
Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: