Configure centos Yum Source
Yum configuration file
In the/etc/yum. Repo. d/directory and in the. Repo file, the configuration syntax is segmented. Each segment is configured with a software repository. The configuration syntax is as follows:
[Repositoryid]
Name = some name for this repository
Baseurl = URL: // server1/path/to/Repository/
URL: // server2/path/to/Repository/
URL: // server3/path/to/Repository/
Upload list = URL: // path/to/upload list/Repository/
Enabled = 0/1
Gpgcheck= 0/1
Gpgkey = a URL pointing to the ascii-armored GPG key file for the repository
Where:
Repositoryid: used to specify a repository
Name: Specifies the name of a readable repository.
Baseurl: used to specify the URL of the Repository. It can be of the following types:
HTTP is used to specify the source of the remote HTTP protocol
FTP is used to specify the source of the remote FTP protocol
File is used for local images or NFS mounted file systems
Repository list: Specifies the image site of the repository.
Enabled: used to specify whether to use the repository. The default value is 1.
Gpgcheck: used to specify whether to check the GPG signature of the software package
Gpgkey: used to specify the URL of the GPG signature file
The following variables are often used in name baseurl:
$ Releasever Current System Version Number
$ Basearch platform architecture of the current system
The line starting with "#" in the file is a comment line.
If the repository list is specified, the system selects the repository closest to you from the centos image site.
Not all domestic images are in the centos image site list. You can directly use baseurl to specify the repository closest to you.
Baseurl can specify multiple Ur l, and the system will check the warehouse you listed in sequence so that another server can be used when a server goes down.
To speed up the update, only one URL can be specified in the baseurl
Set network update source
CentOS-Base.repo file instance, in this file does not set the listing list, use baseurl only specify a URL, it is best to use the domestic source, the speed is faster, the domestic here to three, you can set
Baseurl = http://developer.centos.org/#releasever/ OS /javasbasearch/mirror.centos.org replacement
For any one:
163 Source: mirrors.163.com
Source of Sohu: mirrors.sohu.com
Source of HKUST: centos.ustc.edu.cn
[Base]
Name = centos-$ releasever-Base
Baseurl = http://developer.centos.org/#releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
[Updates]
Name = centos-$ releasever-Updates
Baseurl = http://developer.centos.org/#releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
[Addons]
Name = centos-$ releasever-Addons
Baseurl = http://developer.centos.org/#releasever/addons/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
[Extras]
Name = centos-$ releasever-extras
Baseurl = http://developer.centos.org/#releasever/extras/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
[Centosplus]
Name = centos-$ releasever-plus
Baseurl = http://developer.centos.org/#releasever/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
Set local update source
Using the installation disc as the update source, you can modify the CentOS-Media.repo file, which is a configuration instance below.
C6-media
Name = centos-$ releasever-Media
Baseurl = file: // media/centos/
File: // media/CDROM/
File: // media/cdrecorder/
Gpgcheck = 1
Enabled = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-beta
To use the c6-media repository, you need to set the base repository in the CentO S-base. Repo file to unavailable using enabled = 0.
If you have used a network update source before, the local repomd. xml file is newer than the CD file. In this case, you need to use the local CD as the source and delete the new local cache file first.
# Yum clean all <= clear existing Cache
# Yum makecache <= cache again
Local directory as the source
I use centos6.5. This version of DVD is divided into two ISO images smaller than 4G. To facilitate the installation of software packages, copy all the software packages under the packages of these two ISO images to the same directory, run the createrepo command to create a local software repository. The following operations are performed:
# Yum install createrepo install software first
# Mkdir/Media/centos
# Mount/dev/CDROM/mnt (dvd1 is mounted at this time)
# Cp/mnt/packages/*/Media/centos/
... After the copy is complete...
# Cp/mnt/repodata/*-i386-comps.xml/Media/centos this is groupfile
# Umount/mnt
# Mount/dev/CDROM/mnt (dvd2 is mounted at this time)
# Cp/mnt/packages/*/Media/centos/
... After the copy is complete...
# Mv/Media/centos/X-i386-comps.xml/Media/centos/i386-comps.xml
The name is too long. It must be changed to a short point and placed in the same directory as the RPM software package.
# Createrepo-g/Media/centos/i386-comps.xml/Media/centos
... A long wait...
After that, edit the local ground source configuration file.
# Vi/etc/yum. Repo. d/CentOS-Media.repo
C6-media
Name = centos-$ releasever-Media
Baseurl = file: // media/centos/
Gpgcheck = 1
Enabled = 1 <= change here to 1
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
In addition, to use the source we configured, remember to change the Enabled = 1 of other configurations to Enabled = 0.
First clear the previous Cache
# Yum clean all
Update Cache
# Yum makecache
View Software Group
# Yum grouplist
More detailed commands about Yum: http://netcake.blog.51cto.com/8663272/1547278
Centos image source settings