Configure the Yum Server in Centos7/RHEL7/Fedora22

Configure the Yum Server in Centos7/RHEL7/Fedora22

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 : techitinfo
  • 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.

techit@techitinfo:~$ll CentOS-7*
-rwxrwxrwx 2 techit techit 7769948160 Apr 11 15:48 CentOS-7-x86_64-Everything-1511.iso*
-rwxrwxrwx 2 techit techit  632291328 Mar 18  2016 CentOS-7-x86_64-Minimal-1511(1).iso*
techit@techitinfo:~$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    
techit@techitinfo:~$

2.) Mount the iso on /centos7iso directory.

Extract the iso on yum server.

[root@techitinfo /]# cd centos7iso/
[root@techitinfo centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[root@techitinfo centos7iso]# mount -o loop,ro /centos7iso/CentOS-7-x86_64-Everything-1511.iso /centos7iso/
[root@techitinfo centos7iso]# ls
CentOS-7-x86_64-Everything-1511.iso  lost+found
[root@techitinfo centos7iso]# cd ..
[root@techitinfo /]# cd centos7iso/
[root@techitifo 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@techitinfo 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@techitinfo /]# rpm -qa vsftpd
[root@techitinfo /]# cd /centos7iso/Packages/
[root@techitinfo Packages]# rpm -ivh vsftpd-
vsftpd-3.0.2-10.el7.x86_64.rpm           vsftpd-sysvinit-3.0.2-10.el7.x86_64.rpm  
[root@techitinfo 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@techitinfo Packages]#systemctl start vsftpd
[root@techitinfo ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@techitinfo ~]# firewall-cmd --permanent --add-service=ftp
success
[root@techitinfo ~]# firewall-cmd --reload
success
[root@techitinfo ~]#

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@techitinfo /]# cp -r /centos7iso/* /var/ftp/pub/centos7/
[root@techitinfo /]# cd /var/ftp/pub/centos7/
[root@techitinfo 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@techitinfo 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@techitinfo ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: Centos7
Cleaning up everything
Cleaning up list of fastest mirrors
[root@techitinfo ~]# 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@techitinfo ~]#

#yum list To list all the packages in repository.

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

9.) Clean the cache and check whether yum server is responding or not.

To clear the cache and list of the repository as we have done earlier in server configuration.

[root@client1 etc]#yum clean all; yum repolist all
Loaded plugins: fastestmirror
Cleaning repos: Centos7
Cleaning up everything
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             enabled: 9,007
repolist: 9,007
[root@client1 etc]#

#yum list To list all the packages in repository.

[root@client1 etc]# yum list all
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-tui.x86_64              1:1.0.6-27.el7              @anaconda
NetworkManager-wifi.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

If your output is like this then you have successfully configured a yum client.!!!

Working With Yum Command ..

  • # yum help This will display usage information.
[root@client1 ~]# yum help 
Loaded plugins: fastestmirror
Usage: yum [options] COMMAND

List of Commands:
check          Check for problems in the rpmdb
check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
  • # yum search <keyword> This will lists the packages by keywords.
    [root@client1 ~]# yum search net-tool
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    ======================== N/S matched: net-tool =======================
    net-tools.x86_64 : Basic networking tools
    
    Name and summary matches only, use "search all" for everything.
    [root@client1 ~]#

    #yum install <package name> and yum remove <package name> This will install and remove the software.

[root@client1 ~]# ifconfig
-bash: ifconfig: command not found
[root@client1 ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution
.....
Transaction Summary
=================================================
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y

[root@client1 ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe9d:5e61  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:9d:5e:61  txqueuelen 1000  (Ethernet)
        RX packets 10063  bytes 12479079 (11.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1436  bytes 249583 (243.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 188  bytes 14552 (14.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 188  bytes 14552 (14.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@client1 ~]#
  • #yum info <package name> This will gives the detailed information of the package.
  • [root@client1 ~]# yum info net-tools
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Installed Packages
    Name        : net-tools
    Arch        : x86_64
    Version     : 2.0
    Release     : 0.17.20131004git.el7
    Size        : 917 k
    Repo        : installed
    From repo   : Centos7
    Summary     : Basic networking tools
    URL         : http://sourceforge.net/projects/net-tools/
    License     : GPLv2+
    Description : The net-tools package contains basic networking tools,
                : including ifconfig, netstat, route, and others.
                : Most of them are obsolete. For replacement check iproute package.
    [root@client1 ~]#

    #yum provides <pathname> This will display packages that match the pathname specified.

[root@client1 ~]# yum provides /etc/yum.conf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
yum-3.4.3-132.el7.centos.0.1.noarch : RPM package installer/updater/manager
Repo        : Centos7
Matched from:
Filename    : /etc/yum.conf

yum-3.4.3-132.el7.centos.0.1.noarch : RPM package installer/updater/manager
Repo        : @anaconda
Matched from:
Filename    : /etc/yum.conf
[root@client1 ~]#
  • # yum group list This will show the group list.
    [root@client1 ~]# yum group list
    Loaded plugins: fastestmirror
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Loading mirror speeds from cached hostfile
    Available Environment Groups:
       Minimal Install
       Compute Node
       Infrastructure Server
       File and Print Server
       Basic Web Server
       Virtualization Host
       Server with GUI
       GNOME Desktop
       KDE Plasma Workspaces
       Development and Creative Workstation
    Available Groups:
       Compatibility Libraries
       Console Internet Tools
       Development Tools
       Graphical Administration Tools
       Legacy UNIX Compatibility
       Scientific Support
       Security Tools
       Smart Card Support
       System Administration Tools
       System Management
    Done
    [root@client1 ~]#

    # yum group install <group name> This will install a group.

[root@client1 ~]# yum group install "Security Tools"
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
.....
Transaction Summary
================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.9 M
Installed size: 60 M
Is this ok [y/d/N]:y
  • #yum history This will show the summary of install and remove transactions.
[root@client1 ~]# yum history
Loaded plugins: fastestmirror
ID     | Login us             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------
     2 | root <root>          | 2016-09-17 11:18 | Install        |    1  <
     1 | System <unset>       | 2016-09-17 10:11 | Install        |  285 > 
history list
[root@client1 ~]#
[root@client1 ~]# yum --disablerepo="*" --enablerepo=Centos7 install bind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-29.el7 will be installed

......
Transaction Summary
================================================
Install  1 Package (+1 Dependent package)

Total download size: 2.8 M
Installed size: 6.9 M
Is this ok [y/d/N]: y

This will disable all repositories accept Centos7 repository !!!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *