Common CentOS Yum Repository Configurations
Configuring a Local Yum Repository
Mount and Use an ISO Image Directly
- Backup the original yum repository configuration file
1
| cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
|
- Mount the ISO image
1
| mount -t iso9660 -o loop /home/OracleLinux-R6-U5-Server-x86_64-dvd.iso /mnt
|
- Edit the configuration file
1
| vi /etc/yum.repos.d/local.repo
|
The content of the configuration file is as follows:
1 2 3 4 5
| [local_server] name=local_repo baseurl=file:///mnt enabled=1 gpgcheck=0
|
- Clear Yum Cache and Generate a New Cache
1
| yum clean all && yum makecache
|
Configuring a Yum Repository for China
- Backup the original yum repository configuration file
1
| cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
|
- Download the Alibaba Cloud Yum repository configuration file
1
| sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
|
- Clear Yum cache and generate a new cache
1
| yum clean all && yum makecache
|