Configure the Yum Server in Centos7/RHEL7/Fedora22

PART2: YUM (Yellowdog Updater Modified)

YUM (Yellowdog Updater Modified) is an open source package management application. YUM is the standard method which is used for getting, installing, deleting, querying, and managing RPM software packages.Using YUM, Packages are downloaded from collections called repositories, which may be online, on a network, and/or on installation media.

Features:

  • YUM come with Command-line and graphical versions.Command-line version can be run on a system with a minimal number of software packages.The graphical versions offer ease-of-use and a user-friendly graphical interface to software management.
  • Automatic resolve the dependencies of software without the user need to know the details.
  • YUM  also offer a powerful search engine to search for software’s.
  • Ability to specify particular software versions or architectures.

YUM uses a configuration file at /etc/yum.conf

We use 2 server,one as the YUM server and other as YUM client server. Let look at below details for more understanding.

  • YUM server Hostname     :  ittroubleshooter
  • YUM server ip address     :  192.168.1.1
  • YUM client Hostname     :  client1
  • YUM client ip address     :  192.168.1.2

To configure the YUM server the steps are:

1.) Download  Centos7 iso on the server.

Download the Centos 7 iso from Centos site(https://www.centos.org/download/). I already downloaded the centos7 iso on my base machine.

Now, I am copy the  iso from my machine to yum  server.

[email protected]:~$ll CentOS-7*
-rwxrwxrwx 2 gaurav gaurav 7769948160 Apr 11 15:48 CentOS-7-x86_64-Everything-1511.iso*
-rwxrwxrwx 2 gaurav gaurav  632291328 Mar 18  2016 CentOS-7-x86_64-Minimal-1511(1).iso*
[email protected]:~$scp -r CentOS-7-x86_64-Everything-1511.iso [email protected]:/centos7iso
[email protected]'s password: 
CentOS-7-x86_64-Everything-1511.iso                             100% 7410MB  13.5MB/s 09:08    
[email protected]:~$

2.) Mount the iso on /centos7iso directory.

Extract the iso on yum server.

[[email protected] /]# cd centos7iso/
[[email protected] centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[[email protected] centos7iso]# mount -o loop,ro /centos7iso/CentOS-7-x86_64-Everything-1511.iso /centos7iso/
[[email protected] centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[[email protected] centos7iso]# cd ..
[[email protected] /]# cd centos7iso/
[[email protected] centos7iso]# ls
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL
[[email protected] centos7iso]#

After mount the iso on /centos7iso directory, .iso is exacted on read only mode.

3.) Make sure that vsftpd package is installed, if not install it.

Before copy the exacted data on /var/ftp/pub/centos dir. Make sure vsftpd package is installed and start the service of vsftpd.

[[email protected] /]# rpm -qa vsftpd
[[email protected] /]# cd /centos7iso/Packages/
[[email protected] Packages]# rpm -ivh vsftpd-
vsftpd-3.0.2-10.el7.x86_64.rpm           vsftpd-sysvinit-3.0.2-10.el7.x86_64.rpm  
[[email protected] Packages]# rpm -ivh vsftpd-3.0.2-10.el7.x86_64.rpm 
warning: vsftpd-3.0.2-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.2-10.el7              ################################# [100%]
[[email protected] Packages]#systemctl start vsftpd
[[email protected] ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[[email protected] ~]# firewall-cmd --permanent --add-service=ftp
success
[[email protected] ~]# firewall-cmd --reload
success
[[email protected] ~]#

Make sure port is open for ftp service on firewall.

4.) Copy all the extracted data to other directory(/centos7).

Copy entire data from /centos7iso to /centos7 directory.

[[email protected] /]# cp -r /centos7iso/* /var/ftp/pub/centos7/
[[email protected] /]# cd /var/ftp/pub/centos7/
[[email protected] centos7]# ls
centos7          EFI   GPL     isolinux  Packages  RPM-GPG-KEY-CentOS-7   TRANS.TBL
CentOS_BuildTag  EULA  images  LiveOS    repodata  RPM-GPG-KEY-CentOS-Testing-7
[[email protected] centos7]#

5.) Make a repo file as “centos7.repo” in /etc/yum.repo.d/ directory.

The file which we make inside /etc/yum.repo.d, will be functioning as the repository address and configuration file. Create the file with following details.

#vi /etc/yum.repo.d/centos7.repo

[Centos7]
Name=Centos7 repository
baseurl=file:///var/ftp/pub/centos7
enabled=1
gpgcheck=0

~
~
:wq

[Centos7] is the short name given to the repository.

Name is the complete name of repository.

baseurl is the location of the extended data dump.

enable is to enable or disable the repository. (Where “1” means enable and “0” means disabled).

gpgcheck used for check all packages’ signatures are checked. (Where “1” Enable GPG signature-checking on all packages and “0” Disable GPG signature-checking on packages).

6.) Clean the yum cache and check the package list using yum command.

To clear the cache and list of the repository use the following command.

[[email protected] ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: Centos7
Cleaning up everything
Cleaning up list of fastest mirrors
[[email protected] ~]# yum repolist 
Loaded plugins: fastestmirror
Centos7                                                                                                                    | 3.6 kB  00:00:00     
(1/2): Centos7/group_gz                                                                                                    | 155 kB  00:00:00     
(2/2): Centos7/primary_db                                                                                                  | 5.3 MB  00:00:00     
Determining fastest mirrors
repo id                                   repo name                           status
Centos7                                   Centos7 repository                   9,007
repolist: 9,007
[[email protected] ~]# 

#yum list To list all the packages in repository.

[[email protected] ~]# yum list 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
NetworkManager.x86_64             1:1.0.6-27.el7     @anaconda
NetworkManager-libnm.x86_64       1:1.0.6-27.el7     @anaconda
NetworkManager-team.x86_64        1:1.0.6-27.el7     @anaconda
NetworkManager-tui.x86_64         1:1.0.6-27.el7     @anaconda
acl.x86_64                        2.2.51-12.el7      @anaconda
aic94xx-firmware.noarch           30-6.el7           @anaconda
alsa-firmware.noarch              1.0.28-2.el7       @anaconda

Now configure the yum client and check whether yum server is responding to it.

7.) Make sure that ftp package is installed, if not install it.

Copy the ftp package from yum server(192.168.1.1) and install the ftp package.

[[email protected] ~]# rpm -qa | grep ftp
[[email protected] ~]# scp -r [email protected]:/var/ftp/pub/centos7/Packages/ftp-0.17-66.el7.x86_64.rpm /root/
[email protected]'s password: 
ftp-0.17-66.el7.x86_64.rpm                    100%   61KB  60.5KB/s   00:00    
[[email protected] ~]# ls
anaconda-ks.cfg  ftp-0.17-66.el7.x86_64.rpm
[[email protected] ~]# rpm -ivh ftp-0.17-66.el7.x86_64.rpm 
warning: ftp-0.17-66.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                    ################################# [100%]
Updating / installing...
   1:ftp-0.17-66.el7            ################################# [100%]
[[email protected] ~]# rpm -qa | grep ftp
ftp-0.17-66.el7.x86_64
[[email protected] ~]# 

8.) Make a repo file  /etc/yum.repo.d/ as “centos7.repo”

# vi /etc/yum.repo.d/centos7.repo

[Centos7]
Name=Centos7 repository
baseurl=ftp://192.168.1.1/pub/centos7/
enabled=1
gpgcheck=0

Note: baseurl=ftp:///192.168.1.1/pub/centos7/ refers to the server’s ftp address.

Continue with next page …

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of