In our daily use, we may need to modify the YUM source for network reasons. One is to modify the network source, and the other is to modify the local source. /Etc/yum. repos. d/CentOS-Base.repo # network source modification/etc/yum. repos. d/CentOS-Meida.repo # Local source modification 1.1
In our daily use, we may need to modify the YUM source for network reasons.
One is to modify the network source, and the other is to modify the local source.
Are:/etc/yum. repos. d/CentOS-Base.repo # network source modification
/Etc/yum. repos. d/CentOS-Meida.repo # Local source modification
1.
1 |
Vi /etc/yum.repos.d/CentOS-Base.reop |
123456 |
[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 |
For example, to change the source to 163, then change the http://mirrorlist.centos.org/to the http://mirrorlist.163.com/
2.
1 |
Vi /etc/yum.repos.d/CentOS-Media.repo |
1234567 |
[c6-media]name=CentOS-$releasever - Mediabaseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/gpgcheck=1enabled=0 |
Baseurl = file: // mnt/iso/modified/
Use NFS to mount the disc image, directly use the disc, or other devices.
PS: by default, YUM searches for source files in the/etc/yum. repos. d/directory. If you don't want to use YUM all the time to add parameters to the source, back up all the repo files in this directory to other directories. Then COPY a COPY of the content for use.
For example:
123 |
mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/ cat /etc/yum.repos.d/bak/CentOS-Meida.repo |
C6-media
Name = CentOS-$ releasever-Media
Baseurl = file: // mnt/iso/
Gpgcheck = 1
Enabled = 1 pay attention to the red part
12345 |
Yum clean all clear YUM cache yum grouplist view installable component yum install installation package yum groupinstall installation package yum remove uninstall a package |