环境搭建- -Git
本文仅介绍 Centos 或 Redhat 系列源码编译安装最新版本的 Git 服务。
简介
Git 是一个分布式版本管理工具,具体内容可参考 Git 基础知识
安装
Centos Or Redhat 安装
- 获取源码包
先到官网获取源码包的地址,本文档使用的包体是: git-2.9.5.tar.gz - 下载
1
2
3# 根据上一步获取到的资源地址下载到本地,若无公网可以先通过其他有公网的服务器下载,在上传到 git-server 服务器上。
_source="https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz"
wget -P /opt/package/third-apps ${_source} - 下载服务器旧版本的 git(由于之前 yum 安装过 git)
1
rpm -qa | grep -i ^git | xrags rpm -e --nodeps
- 环境预配置
1
2
3
4
5
6# 创建 git 用户
useradd git -s /usr/local/bin/git-shell
# 在家目录下创建 .ssh/authorized_keys
mkdir /home/git/.ssh
touch /home/git/.ssh/authorized_keys
chmod 600 /home/git/.ssh/authorized_keys - 源码编译安装
1
2
3
4
5
6
7
8cd /opt/packge/third-apps
tar -zxf git-2.9.5.tar.gz
cd git-2.9.5
./configure
make -j 2 # 根据服务器的 cpu 核数来定
make install
# 创建软连接,此步骤非必须
ln -s /usr/local/bin/git /usr/bin/git - 验证
1
2git --version
# git version 2.9.5
推荐文章
-
2022-04-25
安装 Centos 7.9
-
2023-07-14
-
2023-08-23
-
2021-08-10
升级 fastdfs
-
2023-01-10
JumpServer 是广受欢迎的开源堡垒机,是符合 4A 规范的专业运维安全审计系统。