yum source essential skills, different yum source configurations to adapt to different environments!!

Posted by wildwobby on Tue, 14 Dec 2021 21:40:33 +0100

Source configuration of [Linux dictionary]

preface

The YUM software warehouse can complete the tasks of installing, uninstalling, and automatically upgrading rpm packages. It can automatically find and solve the dependencies between rpm packages without requiring the administrator to install each rpm package one by one and manually, making it easier for the administrator to maintain a large number of Linux servers. Especially in the local network with a large number of Linux hosts, building a "source" server can greatly alleviate the dependence on the Internet for software installation and upgrading.

1, YUM introduction

The predecessor of YUM is YUP (Yellow dog Updater, Software Updater of Yellow dog Linux). It was originally developed by TSS company (Terra Soft Solutions, INC.) using Python language. Later, it was improved by the Linux development team of Duke University and named YUM (Yellow dog Updater, Modified).

  • To successfully use the YUM mechanism to update the system and software, you need to have a file containing various rpm installation packages and their dependencies
    A software repository that relies on software. The server that provides the software repository is also called the "source" server. In the client, only
    To correctly specify the address and other information of the software warehouse, you can install or update the software through the corresponding "source" server.

yum command at: [Linux dictionary] compile and install with yum Command & Tar It has been discussed in detail in this article, so I won't go into too much detail here.

2, How to provide YUM source

2.1 configuration of local source warehouse

cd /etc/yum.repos.d/
vim local.repo
[local]							#Warehouse category
name=local						#Warehouse name
baseurl=file:///mnt 				# Specify the URL access path as the CD mount directory
enabled=1						#Open this yum source. This is the default item and can be omitted
gpgcheck=0						#Do not verify the signature of the package

mount /dev/sr0 /mnt      #Mount the CD to the / mnt directory (provided that the virtual machine is mounted on the CD)

yum clean all && yum makecache	##Clean up the yum cache and update it	

yum repolist ###inspect

2.2 ftp source configuration

Mainly ideas
Server configuration:
1) Install vsftpd server software
2) Create and make the source of yum remote ftp site
3) Start ftp service

[root@192 ~]# yum -y install vsftpd 
[root@192 ~]# mkdir  /var/ftp/centos7   #Create a disk mount directory
[root@192 ~]# mount /dev/sr0 /mnt    #Mirror mount
[root@192 ~]# cp -rf /mnt/* /var/ftp/centos7/  & mkdir /var/ftp/other  #Create directory repodata data file  
[root@192 ~]# cd /var/ftp/other/ 
[root@192 ~]# createrepo -g /mnt/repodata/repomd.xml ./    #Tools to create warehouse data files
[root@192 ~]# systemctl start vsftpd

[root@192 ~]# systemctl status vsftpd

[root@192 repodata]# systemctl is-enabled vsftpd
disabled
[root@192 repodata]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@192 repodata]# systemctl is-enabled vsftpd
enabled
[root@192 ~]# cd /etc/yum.repos.d/
[root@192 yum.repos.d]# ls
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo
CentOS-CR.repo         CentOS-Media.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo
[root@192 yum.repos.d]# mkdir repo.bak
[root@192 yum.repos.d]# mv CentOS-* repo.bak/
[root@192 yum.repos.d]# ls
repo.bak
[root@192 yum.repos.d]# 

Client configuration:
1) Create configuration file for remote yum source
2) Verify the results by installing the software using yum
Client configuration:

vi /etc/yum.repos.d/ftp.repo 

[ftp]   #Warehouse category
name=ftp  #Warehouse name (description)
baseurl=ftp://192.168. 10.20/cetnos7 #url access path 
enabled=1    #Enable this software warehouse
gpgcheck=0    #Verify the signature of the package

Note: I will not use verification here, such as using
gpgcheck=1	//Verify the signature of the package
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 	// Location of GPG public key file

[other]
name=ftp
baseurl=ftp://192.168.10.20/other
enabled=1    #Enable this software warehouse
gpgcheck=0  #Verify the signature of the package

2.3 network source

① centOS7 Tsinghua source

vim CentOS7-Base-tsinghua.repo

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$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
baseurl=http://mirrors.tuna.tsinghua.edu.cn/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
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

② 163 yum source

Download link: wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

vim  CentOS7-Base-163.repo   #Edit 163 yum network source
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

③ Alibaba cloud

Download address: wget http://mirrors.aliyun.com/repo/Centos-7.repo

vim CentOS7-Base-aliyun.repo   #Edit Alibaba cloud yum network source
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

summary

Note: other network sources
1) http://ftp.sjtu.edu.cn/centos #Shanghai Jiaotong University, but the server is located in Beijing, the network center of China education network. Northern users and education network users recommend fast.
2) http://centos.ustc.edu.cn , # China University of science and technology, the server is located in Hefei. Recommended by Southern users.
3) http://mirrors.sohu.com/ , Sohu's open source image server, which is located in Shandong Unicom. Fast speed, recommended by users all over the country. Often download CD images with FireFox

Topics: Linux Operation & Maintenance CentOS