Sunday, 31 January 2016

Configure Local Yum Repository in CentOS 6.5

configure-local-yum-repository-in-centos-6In RPM based Linux distros, sometimes it is getting very difficult to resolve dependencies especially if it exist in a chain manner. This is where the yum comes into play, but it requires a repository to connect and download the packages. If server has access to the Internet, then it is very easy to connect to public repositories on the Internet. However, private networks servers usually do not have access to the Internet. For such environment, we are required to setup a yum repository for easy and fast installation of packages.

Configure Local Yum Repository in CentOS 6:

Login to the Server that you want to setup as the Local Yum Repository Server.

Mount the CDROM and copy packages folder from cdrom to a local folder /var/ftp/pub/yum_repo.

mkdir –p /work/cdrom mount /dev/cdom /work/cdrom mkdir –p /var/ftp/pub/yum_repo cp /work/cdrom/Packages/* /var/ftp/pub/yum_repo umount /dev/cdrom

Install create-repo package (including dependencies) from the yum_repo folder.

cd /var/ftp/pub/yum_repo rpm –Uvh create-repo*

yumserver-2016-01-18-01-07-49

Go to the local yum folder and create repository.

cd /var/ftp/pub/yum_repo createrepo .

yumserver-2016-01-18-01-13-33
yumserver-2016-01-18-01-15-15
yumserver-2016-01-18-01-16-55

Once the repository created successfully, add it to the server yum repo profile as /etc/yum.repos.d/rhel_local.repo.

vi /etc/yum.repos.d/rhel_local.repo

image

Test configuration by query the yum repolist.

yumserver-2016-01-19-21-39-18

At this point the Local yum repository is successfully configured for the local server. However, our objective is to make it accessible by all the servers on the network, therefore we required to setup FTP services on this server.

yum install vsftpd chkconfig vsftpd on service vsftp start

Set necessary configurations for vsftpd.

vi /etc/vsftpd/vsftpd.conf

and set following parameter.

image

Save the configuration file and restart the vsftpd service.

service vsftpd restart

Allow FTP port in Firewall.

system-config-firewall-tui

image

Select the service ftp and press space key to enable it.

image

Press Close to return to main screen.

image

Press Ok.

image

Press Yes to confirm apply the changes.

To check that ftp service is accessible, browse the server from another machine browser.

image

Now, update the baseurl in rhel_local to use the ftp protocol.

vi /etc/yum.repos.d/rhel_local.repo

image

yum repolist

image

Now, the Local Yum Repository has been configured for your network. Just copy the rhel_local.repo file to /etc/yum.repos.d/ to all servers on your network to use it.

Furthermore, we use CentOS 6.5 to demonstrate the configuration. However, the configuration is quite similar in other linux distros.

Configure Local Yum Repository in CentOS 6.5


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment