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.

gaurav@blackhat:~$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*
gaurav@blackhat:~$scp -r CentOS-7-x86_64-Everything-1511.iso root@192.168.1.1:/centos7iso
root@193.168.1.41's password: 
CentOS-7-x86_64-Everything-1511.iso                             100% 7410MB  13.5MB/s 09:08    
gaurav@blackhat:~$

2.) Mount the iso on /centos7iso directory.

Extract the iso on yum server.

[root@ittroubleshooter /]# cd centos7iso/
[root@ittroubleshooter centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[root@ittroubleshooter centos7iso]# mount -o loop,ro /centos7iso/CentOS-7-x86_64-Everything-1511.iso /centos7iso/
[root@ittroubleshooter centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[root@ittroubleshooter centos7iso]# cd ..
[root@ittroubleshooter /]# cd centos7iso/
[root@ittroubleshooter 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
[root@ittroubleshooter 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.

[root@ittroubleshooter /]# rpm -qa vsftpd
[root@ittroubleshooter /]# cd /centos7iso/Packages/
[root@ittroubleshooter Packages]# rpm -ivh vsftpd-
vsftpd-3.0.2-10.el7.x86_64.rpm           vsftpd-sysvinit-3.0.2-10.el7.x86_64.rpm  
[root@ittroubleshooter 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%]
[root@ittroubleshooter Packages]#systemctl start vsftpd
[root@ittroubleshooter ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@ittroubleshooter ~]# firewall-cmd --permanent --add-service=ftp
success
[root@ittroubleshooter ~]# firewall-cmd --reload
success
[root@ittroubleshooter ~]#

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.

[root@ittroubleshooter /]# cp -r /centos7iso/* /var/ftp/pub/centos7/
[root@ittroubleshooter /]# cd /var/ftp/pub/centos7/
[root@ittroubleshooter 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
[root@ittroubleshooter 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.

[root@ittroubleshooter ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: Centos7
Cleaning up everything
Cleaning up list of fastest mirrors
[root@ittroubleshooter ~]# 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
[root@ittroubleshooter ~]# 

#yum list To list all the packages in repository.

[root@ittroubleshooter ~]# 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.

[root@client1 ~]# rpm -qa | grep ftp
[root@client1 ~]# scp -r root@192.168.1.1:/var/ftp/pub/centos7/Packages/ftp-0.17-66.el7.x86_64.rpm /root/
root@192.168.1.1's password: 
ftp-0.17-66.el7.x86_64.rpm                    100%   61KB  60.5KB/s   00:00    
[root@client1 ~]# ls
anaconda-ks.cfg  ftp-0.17-66.el7.x86_64.rpm
[root@client1 ~]# 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%]
[root@client1 ~]# rpm -qa | grep ftp
ftp-0.17-66.el7.x86_64
[root@client1 ~]# 

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

Be the First to Comment!

Notify of
avatar
wpDiscuz