Setup Local Repository CentOS 7

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

Mount your CentOS 7 installation DVD

# mount /dev/cdrom /mnt/

Next install vsftpd package and let the packages available over FTP to your local
clients.
# cd /mnt/Packages/
# rpm -ivh vsftpd-3.0.2-9.el7.x86_64.rpm
# systemctl enable vsftpd
# systemctl start vsftpd

Next install httpd package and let the packages available over HTTP to your local
clients.
# yum install httpd
# systemctl enable httpd
# systemctl start httpd

If you did a minimal CentOS installation, then you might need to install the
following dependencies first:
# rpm -ivh libxml2-python-2.9.1-5.el7.x86_64.rpm
# rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm
# rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm

# rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm

Create a storage directory to store all packages from CentOS DVD�s


# mkdir -pv /var/ftp/pub/centos/7/7
# mkdir -pv /var/www/html/centos/7/7
# vi /etc/yum.repos.d/localrepo.repo
[localrepo]
name=Unixmen Repository
baseurl=file:///var/ftp/pub/centos/7/7
gpgcheck=0
enabled=1
# cp -ar /mnt/* /var/www/html/centos/7/7
Again, mount the CentOS installation DVD 2 and copy all the files to
/localrepo/centos/7/7 directory.

Now, start building local repository:


# createrepo -v /var/www/html/centos/7/7
# createrepo -v /var/ftp/pub/centos/7/7
# createrepo --update
# yum repolist

Clean the Yum cache and update the repository lists:


# yum clean all
# yum update

Create a repository file called �localrepo.repo� under /etc/yum.repos.d/ directory


and add the following lines into the file
# vi /etc/yum.repos.d/localrepo.repo
[localrepo]
name=NapasLocalRepo
baseurl=file:///localrepo/centos/7/7
gpgcheck=0
enabled=1

After that, you can install packages only from the local repository by mentioning
the repository as shown below.
# yum install --disablerepo="*" --enablerepo="localrepo" ntp

Disable the Firewalld, enter the following commands:


# systemctl stop firewalld
# systemctl disable firewalld

To disable SELinux, edit file /etc/sysconfig/selinux


# vi /etc/sysconfig/selinux
[...]
SELINUX=disabled
[...]
Reboot your server to take effect the changes.

Publish Your Local Repository


Create a symbolic link in the default Apache root directory to our new repository
# ln -s /localrepo/centos /var/www/html/centos
Create a smbolic link in the default VSFTP root directory to our new repository
# ln -s /localrepo/centos /var/ftp/public/centos

Keeping the Repository Up-to-date


# 30 2 * * * rsync -avz rsync://centos.ar.host-engine.com/6.6/os/x86_64/
/var/www/html/repos/centos/6/6/

Client Side Configuration


# vi /etc/yum.repos.d/localrepo.repo
[localrepo]
name=Unixmen Repository
#baseurl=ftp://192.168.1.101/centos/7/7
baseurl=http://192.168.1.101/centos/7/7
gpgcheck=0
enabled=1

[base]
name=CentOS-$releasever - Base
baseurl=http://172.13.21.37/centos/7/7/
gpgcheck=0

[updates]
name=CentOS-$releasever - Updates
baseurl=http://172.13.21.37/centos/7/updates/x86_64/
gpgcheck=0
# yum repolist
# yum clean all
# yum update
# yum install --disablerepo="*" --enablerepo="localrepo" httpd

======================================================================
[base]
name=CentOS-$releasever - Base
baseurl=http://172.13.21.37/centos/7/7/
gpgcheck=0

[updates]
name=CentOS-$releasever - Updates
baseurl=http://172.13.21.37/centos/7/updates/x86_64/
gpgcheck=0
==============================================================
#!/bin/bash
echo "Running Rsync CentOS 7 Repository!"
/usr/bin/rsync -avz --delete --exclude='repo*'
rsync://mirrors.viethosting.com/centos/7/os/x86_64/ /var/www/html/centos/7/7
>/dev/null
/usr/bin/rsync -avz --delete --exclude='repo*'
rsync://mirrors.viethosting.com/centos/7/updates/x86_64/
/var/www/html/centos/7/updates/x86_64 >/dev/null
echo -e "\n"
echo "Running Rsync CentOS 6 Repository!"
/usr/bin/rsync -avz --delete --exclude='repo*'
rsync://mirrors.viethosting.com/centos/6/os/x86_64/ /var/www/html/centos/6/6
>/dev/null
/usr/bin/rsync -avz --delete --exclude='repo*'
rsync://mirrors.viethosting.com/centos/6/updates/x86_64/
/var/www/html/centos/6/updates >/dev/null
echo -e "\n"

echo "CreateRepo Updating CentOS 7 OS!"


/usr/bin/createrepo --update /var/www/html/centos/7/7
echo -e "\n"
echo -e "CreateRepo Updating CentOS 7 Update!"
/usr/bin/createrepo --update /var/www/html/centos/7/updates/x86_64
echo -e "\n"
echo "CreateRepo Updating CentOS 6 OS!"
/usr/bin/createrepo --update /var/www/html/centos/6/6
echo -e "\n"
echo "CreateRepo Updating CentOS 6 Update!"
/usr/bin/createrepo --update /var/www/html/centos/6/updates
echo -e "\n"
echo "Finished!"

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy