linux Configure Local yum Source Configure Domestic yum Source and Configure epel Source

  • 2021-08-31 09:53:31
  • OfStack

1. Configure the local yum source

1. Mount the ISO image


mount -o loop /mnt/yum-iso/CentOS-7-x86_64-DVD-1611.iso /mnt/cdrom

2. Configure the yum source file


#iso.repo You must use the .repo End 
[root@node5 ~]# cat /etc/yum.repos.d/iso.repo 
[iso]
name=iso
baseurl=file:///mnt/cdrom
enable=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

# Clear the system of all yum Cache 
[root@node5 yum.repos.d]# yum clean all

# Generate yum Cache 
[root@node5 yum.repos.d]# yum makecache


# Note: 
[iso]						#yum The name of the source, which is the only one on this server 1 Of, used to distinguish different yum Source 			
name= iso					# Right yum Source description information 
baseurl=file:///mnt/cdrom	#yum Path to the source , It can also be FTP(ftp://...) , HTTP(http://...) , local (file:/// The location of the CD mount directory) 
enabled=1					# For 1 Which means that the yum Source; 0 Is disabled 
gpgcheck=0					# For 1 Using public key validation rpm The correctness of the package; 0 Is not checked 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 # Specify to proceed rpm Verified public key file address 

3. Set up boot to mount iso image file automatically


# In /etc/fstab File, at the end of the 1 Row addition 
[root@node5 ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                    ext3    defaults        1 1
LABEL=/boot             /boot                 ext3    defaults        1 2
tmpfs                   /dev/shm             tmpfs   defaults        0 0
devpts                  /dev/pts              devpts  gid=5,mode=620  0 0
sysfs                   /sys                  sysfs   defaults        0 0
proc                    /proc                 proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                 swap    defaults       0 0
/mnt/yum-iso/CentOS-7-x86_64-DVD-1611.iso    /mnt/cdrom           iso9660  loop           0 0

2. Configure the domestic yum source and epel source

1. First back up the original repo file


[root@node5 ~]# cd /etc/yum.repos.d/
[root@node5 yum.repos.d]# mkdir repo_bak
[root@node5 yum.repos.d]# mv *.repo repo_bak/
[root@node5 yum.repos.d]# ls
repo_bak

2. Download the repo file provided by domestic mirror image


[root@node5 yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@node5 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@node5 yum.repos.d]# ls
CentOS7-Base-163.repo Centos-7.repo repo_bak

# Note: Centos-7.repo It's in the file 1 Sentence: baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
#$releasever Represents the version number of the system, which can be used cat /etc/centos-release View version number 
#[root@node5 yum.repos.d]# cat /etc/centos-release
#CentOS Linux release 7.4.1708 (Core)
#$basearch Represents the processor type, such as x86_64

# Clear the system of all yum Cache 
[root@node5 yum.repos.d]# yum clean all

# Generate yum Cache 
[root@node5 yum.repos.d]# yum makecache

3. Install the epel source


# Installation official epel Source 
[root@node5 yum.repos.d]# yum install -y epel-release

[root@node5 yum.repos.d]# ls
CentOS7-Base-163.repo Centos-7.repo epel.repo epel-testing.repo repo_bak

# Install Ali's epel Source 
[root@node5 yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo

[root@node5 yum.repos.d]# yum clean all

[root@node5 yum.repos.d]# yum makecache

4. View the yum sources available to the system and all yum sources


[root@node5 yum.repos.d]# yum repolist enabled

[root@node5 yum.repos.d]# yum repolist all

The above is linux configuration of local yum source, configuration of domestic yum source, configuration of epel source step details, more information about linux configuration source please pay attention to other related articles on this site!


Related articles: