Local Update Server For Centos-7

INGREDIENTS

1. Server Machine = Centos 7
    IP = 172.16.121.59
    RPMs = httpd, rsync

2. Client Machine = CentOS 7
     IP = 172.16.169.12


PROCESSING

1. First we configure the server…..

# yum install httpd rsync
# mkdir -pv /var/www/html/centos/7

Now you have to select a CentOS mirror to sync it with local server. You can select mirrors from Centos page……



If you want to sync 64 bit repos directory with every package available then use the below command…..

For Centos mirror servers list visit....
https://www.centos.org/download/mirrors/

#/usr/bin/rsync -avrt rsync://mirror.cuegee.de/centos/7/ --exclude=debug/ /var/www/html/centos/7/
OR
#/usr/bin/rsync -avrt rsync://mirror.cuegee.de/centos/7/ --exclude=debug/ /var/www/html/centos/7/
OR
//If you want to download only updates packages to for 64 bit machine then use the below command//
#/usr/bin/rsync -avrt rsync://mirror.cuegee.de/centos/7/updates/ --exclude=debug/ /var/www/html/centos/7/updates/

For epel mirror
# rsync -avrt rsync://fedora-epel.mirrors.tds.net/fedora-epel --exclude=debug/ /SHARE/EPEL/7/

//*************But first create the appropriate directory on local machine.**********************//

The time it will take depends on your internet downloading speed.


2. Now configure httpd to share files with client machines

# cd /etc/httpd/conf.d
# vi repo.conf

Alias /CENTOS /SHARE/CENTOS
<directory /SHARE/CENTOS>
                Options Indexes FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
</directory>

Alias /EPEL /SHARE/EPEL
<directory /SHARE/EPEL>
           Options Indexes FollowSymLinks
           AllowOverride None
           Order allow,deny
           Allow from all

</directory>

# service httpd start
# chkconfig httpd on

You can check it in browser ...http://172.16.120.25/centos


3. Now go to Client machine

# cd /etc/yum.repos.d/
# vi Centos-Base.repo //Comment the mirror URLs and change the baseurl as following//
# CentOS-Base.repo
    [base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://172.16.120.25/CENTOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/release=$releasever&arch=$basearch&repo=updates&infra=$infra
"CentOS-Base.repo" 52L, 1968C
baseurl=http://172.16.120.25CENTOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


#additional packages that may be useful

[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://172.16.120.25/CENTOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


#additional packages that extend functionality of existing packages

[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://172.16.120.25/CENTOS/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


#contrib - packages by Centos Users

[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=http://172.16.120.25/CENTOS/$releasever/contrib/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


# yum clean all
# yum clean metadata
# yum update                                                                                    //Now you will see the available update packages//

Same as above change the epel.repo file To turn on automatic update on client machine 

# yum -y install yum-cron
# /etc/init.d/yum-cron start
# chkconfig yum-cron on


No comments:

Post a Comment