由于Centos7默认的yumm源在国外,访问速度较慢所以更新为阿里的yum源,提高速度。
[root@ansible-fcm ~]# cd /etc/yum.repos.d/ #保存本地yum的地方
[root@ansible-fcm yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 2523 Jun 15 2018 CentOS-Base.repo
[root@ansible-fcm yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak #首先需要备份原来的文件,防止丢失
[root@ansible-fcm yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #将下载的文件保存为/etc/yum.repos.d/CentOS-Base.repo
--2019-04-04 03:04:57-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 183.60.159.231, 183.60.159.227, 183.60.159.225
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|183.60.159.231|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
100%[============================================================================================================================================================================>] 2,523 --.-K/s in 0s
2019-04-04 03:04:57 (309 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
[root@ansible-fcm yum.repos.d]# yum makecache #更新yum
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Metadata Cache Created
[root@ansible-fcm yum.repos.d]# git --version
bash: git: command not found...
[root@ansible-fcm yum.repos.d]# yum -y install git #使用yum安装git
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Installed:
git.x86_64 0:1.8.3.1-20.el7
Dependency Installed:
perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-20.el7 perl-TermReadKey.x86_64 0:2.30-20.el7
Complete!
[root@ansible-fcm yum.repos.d]# git --version
git version 1.8.3.1