REDHAT 7 local source and yum network source configuration

Local yum source configuration

In our newly installed REDHAT 7 system, there is no configuration source. In order to save space and improve the operation efficiency, many packages are not installed. When we find that there are missing packages, we need to install them by ourselves. The installation needs to use the yum source. The configuration of local source can install packages without network.

Using df-h to check the disk capacity, it is found that there is no sr0, so the first step is to mount the disk.
Warm tip: you can't use the local source without sr0

[root@deng- order]# df -h
//File system capacity used available used% Mount point
/dev/sda2        10G  1.3G  8.8G   13% /
devtmpfs        286M     0  286M    0% /dev
tmpfs           296M     0  296M    0% /dev/shm
tmpfs           296M  8.8M  287M    3% /run
tmpfs           296M     0  296M    0% /sys/fs/cgroup
/dev/sda3       9.6G   33M  9.5G    1% /data
/dev/sda1       497M  112M  385M   23% /boot
tmpfs            60M     0   60M    0% /run/user/0
/dev/sdb1       976M  2.6M  907M    1% /d1

Mount sr0 to the root iso Directory: Mount / dev / sr0 / iso

[root@deng- order]# df -h
//File system capacity used available used% Mount point
/dev/sda2        10G  1.3G  8.8G   13% /
devtmpfs        286M     0  286M    0% /dev
tmpfs           296M     0  296M    0% /dev/shm
tmpfs           296M  8.8M  287M    3% /run
tmpfs           296M     0  296M    0% /sys/fs/cgroup
/dev/sda3       9.6G   33M  9.5G    1% /data
/dev/sda1       497M  112M  385M   23% /boot
/dev/sr0        3.8G  3.8G     0  100% /iso
tmpfs            60M     0   60M    0% /run/user/0
/dev/sdb1       976M  2.6M  907M    1% /d1

Modify / etc/yum.repos.d/base.repo after mounting

[root@deng- ~]# vim /etc/yum.repos.d/base.repo 
[base]
name=base
baseurl=file:///iso
enabled=1
gpgcheck=0  

Configure this local source to complete

yum network source configuration

In the REDHAT 7 system, it is often not enough to only have local source. The installation package of local source is limited, but we need to use our network source. The premise of using network source is to have network.

Address of the network source:
Alibaba open source image station: https://mirrors.aliyun.com
Netease open source image station: https://mirrors.163.com

[base]
name=base
baseurl=file:///iso
enabled=1
gpgcheck=0

[163.com]
name=163.com
baseurl= https://mirrors.163.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0

[aliyun]
name=aliyun
baseurl= https://mirrors.aliyun.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0

The source can be added at the bottom. When the first source has no package, the second source will be selected. Multiple sources can be selected.

Keywords: network yum CentOS vim

Added by sledge4 on Tue, 31 Dec 2019 17:35:47 +0200