Guides‎ > ‎Other‎ > ‎YUM‎ > ‎CentOS‎ > ‎

Client Configuration

Client Configuration

Execute the following commands on the CentOS client machines that you want to use the local repository.

The configuration file created below uses variables, so it will work with v6 or v7 of CentOS and either i386 or x86_64.

  • Type cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original and press Enter
  • Type echo '[base]' > /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'name=CentOS-$releasever - Base' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/$basearch/' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgcheck=1' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/RPM-GPG-KEY-CentOS-$releasever' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '[updates]' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'name=CentOS-$releasever - Updates' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/updates/$basearch/' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgcheck=1' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/RPM-GPG-KEY-CentOS-$releasever' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '[extras]' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'name=CentOS-$releasever - Extras' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/extras/$basearch/' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgcheck=1' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/RPM-GPG-KEY-CentOS-$releasever' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo '[centosplus]' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'name=CentOS-$releasever - Plus' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/centosplus/$basearch/' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgcheck=1' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'enabled=0' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter
  • Type echo 'gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/RPM-GPG-KEY-CentOS-$releasever' >> /etc/yum.repos.d/CentOS-Base.repo and press Enter


OR paste the following text into the file /etc/yum.repos.d/CentOS-Base.repo and make sure you replace the contents of the existing file.

[base]
name=CentOS-$releasever - Base
baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/$basearch/
gpgcheck=1
gpgkey=
http://centos15.box293.local/yumrpms/centos/$releasever/production/os/$basearch/RPM-GPG-KEY-CentOS-$releasever

[updates]
name=CentOS-$releasever - Updates
baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/updates/$basearch/
gpgcheck=1
gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/
$basearch/RPM-GPG-KEY-CentOS-$releasever

[extras]
name=CentOS-$releasever - Extras
baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/extras/$basearch/
gpgcheck=1
gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/
$basearch/RPM-GPG-KEY-CentOS-$releasever

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://centos15.box293.local/yumrpms/centos/$releasever/production/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos15.box293.local/yumrpms/centos/$releasever/production/os/
$basearch/RPM-GPG-KEY-CentOS-$releasever


These commands will show you if the repository was found and will be used:

  • Type yum clean all and press Enter
  • Type yum repolist and press Enter
This should output something like:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id             repo name                                                  status
base                CentOS-6 - Base                                             6,575
extras              CentOS-6 - Extras                                              62
updates             CentOS-6 - Updates                                          1,577


OR:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                 repo name                                 status
base/7/x86_64                           CentOS-7 - Base                           9,007
extras/7/x86_64                         CentOS-7 - Extras                           265
updates/7/x86_64                        CentOS-7 - Updates                        1,352
repolist: 10,624

Symbolic Link

On the guides for creating the repositories, you'll notice I created a symbolic link:

/data/www/yumrpms/centos/7/production -> /data/www/yumrpms/centos/7/7.2.1511

The point of this is to make it easy to update your client machines to newer versions of CentOS when they are released. In the client configuration files above, the baseurl points to the symbolic link location.

When CentOS 7.3.xxxx is released, after downloading a building the new repository, all that is required is for you to delete and re-create the symbolic link.

The client .repo files don't need to be updated, all you need to do is run yum update and your CentOS machine will install all the newer client packages.