Local source Linux yum yum configuration and LAN source configuration

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/baidu_39459954/article/details/80619307

First, the local YUM source configuration under Linux

Local sources depends on the python yum resolution, make sure the system components are installed successfully python and yum

1.1, ISO mirror mounts local

ISO image uploaded to the system directory / root, using the mirror mount command to / mnt

[root@yc ~]# mount /root/CentOS-7-x86_64-DVD-1708.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only

Optional: Configure the next boot automatically mount, edit / etc / fstab write boot automatically mount content

[root@yc ~]# vi /etc/fstab

Writes the following

/root/CentOS-7-x86_64-DVD-1708.iso /mnt iso9660 defaults,loop,ro 0 0

1.2, create a local repo file

Edit the file /etc/yum.repos.d/local.repo

[root@yc ~]# vi /etc/yum.repos.d/local.repo

Writes the following, file back to the directory / mnt consistent with the previous section ISO mount directory

[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0

1.3, modify the file yumRepo.py

The system python version edited yumRepo.py
comes with python version Linux6 2.6, edit the following files

[root@yc ~]# vi /usr/lib/python2.6/site-packages/yum/yumRepo.py

Linux7 version 2.7 comes with python, edit the following files

[root@yc ~]# vi /usr/lib/python2.7/site-packages/yum/yumRepo.py

Find (vi input after editing / remote, to find)

remote = url + '/' +relative

Modify change

remote = url + '/mnt' + relative

1.4, you can now use the local YUM to install software

yum -y install xxx
yum group list hidden
yum groupinstall “X Window System”
Local yum

Two, Linux LAN YUM Source Configuration

2.1, server configuration

This example uses CentOS7 configuration example, substantially the same as other types of Linux systems, reference may be modified

2.1.1, yum server should be installed the following software

yum, createrepo, httpd, use rpm -q httpd createrepo yum check for installation

[root@yc ~]# rpm -q httpd createrepo yum
httpd-2.4.6-80.el7.centos.x86_64
createrepo-0.9.9-28.el7.noarch
yum-3.4.3-154.el7.centos.noarch

If not installed can be installed using the rpm -ivh or yum

[root@yc ~]# yum install httpd createrepo

2.1.2, open firewall port 80 or turn off the firewall

CentOS7 use a firewall to firewall, open port 80 as follows:

[root@yc ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent 
success
[root@yc ~]# firewall-cmd --reload
success
[root@yc ~]# firewall-cmd --zone=public --query-port=80/tcp
yes
[root@yc ~]# firewall-cmd --zone=public --list-ports
80/tcp

Optional: turn off the firewall command

systemctl stop firewalld.service

2.1.3, ready to install package

Into the system disk, mount it to / mnt, can also be used CD iso file system, the mount / mnt, create / yumsource / CentOS7 directory used to store software packages:

[root@yc ~]# mkdir /yumsource/CentOS7

All packages will be copyed all directories on CD / yumsource / CentOS7.

[root@yc ~]# cp -a /mnt/* /yumsource/CentOS7

Note: repodata comes from the system disk copy of overall package, if the package is a collection of rpm organize their own, you can use createrepo, re-create a new repodate

createrepo /yumsource/CentOS7

2.1.4 configuration Selinux rights or closed Selinux

If the selinux is on, execute the following command to give permission

[root@yc ~]# chcon -R -t httpd_sys_content_t /yumsource

Or simply rude closed selinux

vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled,保存后退出,重启系统生效。

2.1.5, released configuration source

This example uses a web server to provide the installation source is publishing yum, of course, also be used to achieve the same functionality as ftp.
Should first install the apache web server (yum install httpd), are as follows /etc/httpd/conf/httpd.conf.

[root@yc ~]# vi /etc/httpd/conf/httpd.conf

Comment or delete DocumentRoot "/ var / www / html
" adding:

DocumentRoot "/yumsource"
<Directory "/yumsource">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Http restart the service:

[root@yc ~]# systemctl restart httpd.service 

Options: Set the boot from the start:

[root@yc ~]# systemctl enable httpd.service

Use browser to open verification, http://192.168.88.58/CentOS7/ :
Verify HTTP Service
Description: In the process of configuring the http if found to be a normal visit, may be the reason selinux or firewall.

2.2 Client Configuration

Repo configuration file

vi /etc/yum.repos.d/Server58.repo
[Server58]
name=Red Hat
baseurl=http://192.168.88.58/CentOS7/
gpgcheck=1
gpgkey=http://192.168.88.58/CentOS7/RPM-GPG-KEY-CentOS-7

You can now use yum to install software as the source server 192.168.88.58

yum clean all
yum install postgres

yum LAN
After testing, the above can be achieved in several ways install yum source, different versions and methods can be implemented, to see which one he chose.

Guess you like

Origin blog.csdn.net/baidu_39459954/article/details/80619307