CentOS6.5-install yum, centos6.5-install yum
1. Uninstall yum from the original system
Rpm-qa | grep yum | xargs rpm-e -- nodeps
(Xargs processes each line of information sent from rpm-qa | grep yum using the command following xargs)
2. Create a directory intallyum_mirrors.163.com to download the rpm package.
Download the yum Installation File
Note: If the file cannot be found during the download, log on to: http://mirrors.163.com/centos/6/ OS /x86_64/ to find the package name of the corresponding installation package, modify the following package name, and then download.
Wget http://mirrors.163.com/centos/6/ OS /x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
Wget http://mirrors.163.com/centos/6/ OS /x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
Wget http://mirrors.163.com/centos/6/ OS /x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
3. In the currentInstallyum_mirrors.163.comDirectoryLs | grep yum | xargs rpm-ivh -- nodeps
[Root @ ApacheInstallyum_mirrors.163.com] #Ls | grep yum | xargs rpm-ivh -- nodeps
Preparing... ######################################## ### [100%]
1: yum-metadata-parser ################################### ####### [1, 33%]
2: yum-plugin-fastestmirro ################################### ####### [1, 67%]
3: yum ####################################### #### [100%]
[Root @ Apache installyum_mirrors.163.com] #
If other installation packages on which this installation depends are not installed, continue to download the dependent installation packageInstallyum_mirrors.163.comDirectory, continueLs | grep yum | xargs rpm-ivh -- nodepsInstall
Until yum is installed successfully.
4. Back up the repo file in the/etc/yum. repos. d directory.
Cd/etc/yum. repos. d
Mv CentOS-Base.repo CentOS-Base.repo.bak
5. Download The reop file from mirrors.163.com.
[Root @ Apache yum. repos. d] #Wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
6. Set the installation package that can be updated without updating the CentOS6-Base-163.repo. Edit enabled = 0 in the following [updates]. If enabled is not in the configuration, enabled = 1 is configured by default, enabled = 0 must be added to disable update.
[Updates] name = CentOS-$ releasever-Updates-163.com
Baseurl = http://mirrors.163.com/centos/?releasever/updates/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
7. yum clean all
8. yum makecache
8. yum search vsftpd test whether the yum function is OK
-------- End Of Text --------
Yum clean all # $ releasever and $ basearch are found from the system, such as 6 and x86_64, then generate the/var/cache/yum/x86_64/6/base/packages/directory (the directory is empty), cat/var/cache/yum/x86_64/6/extras/packages/(the directory is empty) and other directories.
Yum makecache # obtain metadata information from the yum network repository-create a metadata cache locally and deploy the metadata in the directories (/var/cache/yum/) generated by yum clean all.
PS:
Where do the $ releasever and $ basearch variable values in/etc/yum. repos. d/CentOS6-Base-163.repo files get from? Obtain these built-in variables from the system (such as arch, rpm-qi centos-release)
When installing other rpm packages in yum, it is from/etc/yum. repos. d/find the repo file in the directory (. repo), and the value of the baseurl with enabled = 1 will be found. If the baseurl value contains a variable such as $ releasever and $ basearch, go to the system (arch, rpm-qi centos-release) to find the values of $ releasever and $ basearch, and then use this baseurl to access the yum network repository. If the baseurl is set to non-variable (sed-I's/$ releasever/6/G'/etc/yum. repos. d/CentOS-Base.repo and sed-I's/$ baseurl/x86_64/G'/etc/yum. repos. d/CentOS-Base.repo), then after yum clean all (clearing the local metadata cache), yum directly accesses the yum network repository based on baseurl. Of course, you can download the repo file directly at http://mirrors.163.com/.help/and other website directories.