yum install centos domestic source

This article is excerpted: https: //blog.csdn.net/liqz666/article/details/81939181

When we deploy docker needs centOs environment, but because centOs comes with a foreign yum, may be deployed docker will produce an unstable state, so we can install to replace the country's foreign yum yum.

1. Log

2. Check the network status, because our Ali cloud yum is required by the network to download, if there is no network, then all operations are in vain, enter the command ifconfig to view, if the command prompt is not found, indicating that the tool is not installed net-tools , enter the command yum install net-tools installation tool, the next will come out a lot of things, you can enter commands directly through y; Now enter ifconfig to view network status, you can see ip address ens33, indicating the network status is connected, of course, you can also enter the ip lingk, ip addr view is also possible.

[the root @ localhost ~] # the ifconfig 
- the bash: the ifconfig: No command found 

[the root @ localhost ~] # yum the install NET-Tools 

......... 

Is the this OK [Y / D / Y: N] 

. ........ 

already installed: 
  NET -tools.x86_64 0: 2.0-0.22 .20131004git.el7 

finished! 

[root @ localhost ~] # ifconfig

3. We list the default yum /etc/yum.repos.d/ by ll command -> CentOS-Base.repo, first of all we use the command cd /etc/yum.repos.d/ enter into it through the command wget http://mirrors.aliyun.com/repo/Centos-7.repo download Ali cloud yum -> Centos-7.repo, and found wget command does not take, because, wget plug-in is not installed, we will start with carried out under the command cd ~ home directory by yum -y install wget wget installed plug-ins, and then return to the cd /etc/yum.repos.d/ download Ali cloud yum

[root @ localhost ~] # LL /etc/yum.repos.d/ 
[root @ localhost ~] # cd /etc/yum.repos.d/ 
[root @ localhost yum.repos.d] # wget HTTP: // mirrors.aliyun.com/repo/Centos-7.repo 
- bash: wget: not found command 
[root @ localhost yum.repos.d] # yum -y install weget 
...... 
[root @ localhost yum.repos .d] # wget http://mirrors.aliyun.com/repo/Centos-7.repo 
- bash: wget: command not found 
[root @ localhost /] # cd ~ 
[root @ localhost ~] # yum -y install wget 
...... 
already installed: 
  wget.x86_64 0: 1.14-15.el7_4.1
Finished! 
[root @ localhost ~] # cd /etc/repos.d/ 
-bash: cd: /etc/repos.d/ : No such file or directory 
[root @ localhost ~] # cd /etc/yum.repos.d/ 
[root @ localhost yum.repos.d] # wget http://mirrors.aliyun.com/repo/Centos-7.repo

4. Next file backup we CentOs default yum command (mv source files backup file) mv CentOS-Base.repo CetnOs-Base.repo.bak, attention must first pass in the /yum.repos.d/ ll yum command to view, make sure the file name is correct, Centos-7.repo represented Ali cloud yum.CentOS-Base.repo is centOs default yum, after successful backup again, the backup file can see the yum CentOS-Base. repo.bak, after the backup is successful, should be replaced by the original yum command mv Centos-7.repo with Ali cloud yum CentOs-Base.repo.

[root @ localhost yum.repos.d] # mv CentOs-Base.repo CentOs-Base.repo.bak 
mv: Unable to get " CentOs-Base.repo " file status (stat): No such file or directory 
[root @ yum.repos.d localhost] # LL 
total volume of 36 
-rw-R & lt -. r-- the root. 1 2523 the root. 6 dated 16 06:22 Centos-7.repo // aliyun yum
 -rw-R & lt - R- -. 1 root root 1664 4 Yue 29 00:35 CentOS-Base.repo // default yum
 -rw-r -. r-- 1 root root 1309 00:35 CentOS- 4 Yue 29 CR.repo
 -RW- r - r-- 1 root root 649 4 Yue 00:35 CentOS- 29. Debuginfo.repo
 -rw-r -. r-- 1 root root 314 4 Yue 00:35 CentOS- 29 fasttrack.repo 
... .. 
[root @ localhost yum.repos.d] #  mv-CentOS CentOS-Base.repo Base.repo.bak 
[yum.repos.d root @ localhost] # mv Centers 7.repo-centos-Base.repo 
[yum.repos.d root @ localhost] # cd ~

5, and finally by cd ~ to switch home directory using the command yum clean all conduct a thorough empty, then use the command yum makecache build a cache, and finally use the command yum update yum update once, and on the Ok

[root @ localhost yum.repos.d] # cd ~ 
[root @ localhost ~] # yum Clean All 

........... 

[root @ localhost ~] # yum makecache 
Loaded plugins: fastestmirror 
.. .... 
metadata cache has been established 
[root @ localhost ~] # yum Update 
...... 
finished!

At this point we have the configuration finished! ! !

Guess you like

Origin www.cnblogs.com/zty1304368100/p/11225215.html