在Linux系統(CentOS7)上安裝Git
阿新 • • 發佈:2018-12-18
一、在CentOS7上配置yum源與epel源
centos7配置aliyun的yum源和epel源 centos7配置阿里雲yum源: 1、切換到/etc/yum.repos.d/目錄下
cd /etc/yum.repos.d
2、將CentOS-Base.repo 改為CentOS-Base.repo.backup
mv CentOS-Base.repo CentOS-Base.repo.backup
3、下載阿里雲yum源到/etc/yum.repos.d/目錄下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
centos7配置阿里雲epel源: 1、切換到/etc/yum.repos.d/目錄下
cd /etc/yum.repos.d
2、下載epel源
wget https://mirrors.aliyun.com/repo/epel-7.repo wget http://mirrors.aliyun.com/repo/epel-6.repo
[ps: yum -y install epel-release也是安裝的阿里雲的epel源] 清楚快取:
yum clean all && yum makecache
【上面的yum源和epel源,如果只安裝一個,在每一個結束時都要清楚快取 yum clean all && yum makecache】
二、在CentOS7上安裝Git
yum remove git
2、安裝編譯環境
#安裝gcc yum install gcc #安裝g++ yum install gcc-c++ #安裝其它所需的包 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel yum install gcc perl-ExtUtils-MakeMaker
3、下載原始碼
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
4、進入指定目錄
cd /root/
5、解壓檔案
tar zxvf git-2.9.5.tar.gz
6、進入解壓目錄
cd git-2.9.5/
7、配置安裝目錄並且編譯和安裝
./configure --prefix=/root/git-2.9.5 && make && make install
8、將編譯好的git新增到全域性變數
vim /etc/profile #git 新增到檔案最後 export PATH="$PATH:/root/git-2.9.5/bin" #儲存 :wq
9、立即生效配置的變數
source /etc/profile
10、檢視版本
git --version此部落格轉載自:centos7配置aliyun的yum源和epel源;centos7安裝git過程