CentOS7 编译安装 Git 服务器 Centos 7.0 + Git 2.2.0 + gitosis (实测 笔记)
环境:
系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡)
系统版本:CentOS-7.0-1406-x86_64-DVD.iso
服务器IP:192.168.1.31 域名:www.domain.com SSH端口:8200(默认为22)
安装步骤:
1.显示服务器版本
[root@tCentos7 ~]# cat /etc/redhat-release
#CentOS Linux release 7.0.1406 (Core)
[root@tCentos7 ~]# uname -a
#Linux tCentos7 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@tCentos7 ~]# ifconfig
#服务器IP192.168.1.31
2.安装git
#2.1 下载git-2.2.0.tar.gz 到 /usr/local/src
[root@tCentos7 ~]# cd /usr/local/src
[root@tCentos7 ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz
#2.2 安装依赖的库
[root@tCentos7 ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
#2.3 删除原本的安装的git
[root@tCentos7 ~]# yum remove git -y
#2.4 编译安装
[root@tCentos7 ~]# cd /usr/local/src
[root@tCentos7 ~]# tar -zvxf git-2.2.0.tar.gz
[root@tCentos7 ~]# cd git-2.2.0
[root@tCentos7 ~]# make prefix=/usr/local/git all
[root@tCentos7 ~]# make prefix=/usr/local/git install
#2.5 增加软连接
[root@tCentos7 ~]# ln -s /usr/local/git/bin/* /usr/bin/
[root@tCentos7 ~]# git --version
#如何能显示版本号,即表示成功
3.安装gitosis
[root@tCentos7 ~]# yum install python python-setuptools
[root@tCentos7 ~]# cd /usr/local/src
[root@tCentos7 ~]# git clone git://github.com/res0nat0r/gitosis.git
[root@tCentos7 ~]# cd gitosis
[root@tCentos7 ~]# python setup.py install
#显示Finished processing dependencies for gitosis==0.2即表示成功
*******************************************************
4.修改客户端git连接端口(如果GIT服务器为默认SSH端口为22,则不需要以下步骤)
#修改开发机客户端配置文件(可以省略每次输入端口)
[root@tCentos7 ~]# mkdir ~/.ssh
[root@tCentos7 ~]# vim ~/.ssh/config
#打开后,编辑文件,添加以下代码
host www.domain.com
hostname www.domain.com
port 8200
#修改后,开发机客户端即可用以下方式进行连接访问
#git clone ssh://git@www.domain.com/gitosis-admin.git
#否则需要需要加上端口进行访问
#git clone ssh://git@www.domain.com:8200/gitosis-admin.git
*******************************************************
5.在开发机客户端上,生成密钥并上传到服务器上
ssh-keygen -t rsa
#一路回车,不需要设置密码
#从开发机客户端,上传刚生成的公钥到服务器(如果修改端口,按4进行配置指定端口)
scp ~/.ssh/id_rsa.pub root@www.domain.com:/tmp/
#显示已经上传的密钥
[root@tCentos7 ~]# ls /tmp/id_rsa.pub
6.服务器上生成git用户,使用git用户并初始化gitosis
#6.1 增加git用户
[root@tCentos7 ~]# adduser -m git
#6.2切换用户
[root@tCentos7 ~]# su - git
#6.3 服务器的公钥(刚才开发机客户端上传),导入后此开发机客户端即可以管理git服务器。
[root@tCentos7 ~]# gitosis-init < /tmp/id_rsa.pub
#显示以上信息即表示成功
#Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
#Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
#6.4 删除密钥
[root@tCentos7 ~]# su - root
[root@tCentos7 ~]# rm -rf /tmp/id_rsa.pub
6.在开发机客户端,复制git管理项目(git服务器管理,也是一个git仓库)
mkdir -p /repo
cd /repo
git clone git@www.domain.com:gitosis-admin.git
7.在开发机客户端,增加及设置管理项目
cd /repo/gitosis-admin
#查看已经上传密钥
ls keydir
cat keydir/vicowong\@VICO.pub #vicowong@VICO.pub为已经上传的开发机生成的公密
#显示密钥最后的符串为密钥用户名 这里为vicowong@VICO
vim gitosis.conf
#在文件尾增加以下内容
[group test-git] # 组名称
writable = test-git # 项目名称
members = vicowong@VICO #密钥用户名
#提交修改
git add .
git commit -a -m "add test-git repo"
git push
9.在开发机客户端,初始,增加及使用项目test-git
cd /repo
mkdir test-git
cd test-git
git inti
touch readme
git add .
git commit -a -m "init test-git"
git remote add origin git@www.domain.com:test-git.git
git push origin master
CentOS7 编译安装 Git 服务器 Centos 7.0 + Git 2.2.0 + gitosis (实测 笔记)的更多相关文章
- CentOS安装Git服务器 Centos 6.5 + Git 1.7.1.0 + gitosis
1.安装扩展 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel 2.下载git ...
- Centos7编译安装Xen环境(vtpm)
编译xen环境(http://www.lvtao.net/server/574.html#comment-1882): yum update yum groupinstall "Develo ...
- centos7 编译安装新版LNMP环境
centos7 编译安装新版LNMP环境 环境版本如下: 1.系统环境:Centos 7 x86_64 2.NGINX:nginx-1.11.3.tar.gz 3.数据库:mariadb-10.0.2 ...
- CentOS7编译安装Nginx-1.8.1和编译参数
CentOS7编译安装Nginx-1.8.1和编译参数 Web服务器Nginx LNMP是一组众所周知的Web网站服务器架构环境,即由Linux+Nginx+MySQL+PHP(MySQL有时也 ...
- centos7编译安装MySQL5.7.9
title: centos7编译安装MySQL5.7.9 date: 2016-05-12 16:20:17 tags: --- Centos7编译安装mysql5.7.9 mysql5.7有更好的性 ...
- CentOS7编译安装httpd-2.4.41 php7.3
CentOS7编译安装httpd-2.4.41 php7.3 安装参考环境: CentOS Linux release 7.5.1804 (Core) 一.安装依赖包 httpd安装的依赖包 # yu ...
- shopnc编译安装IM服务器node.js
编译安装IM服务器node.js下载地址http://www.nodejs.org/download/ 选择Source Code node-v0.12.0 # ./configure # make ...
- Windows 编译安装 nginx 服务器 + rtmp 模块
有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...
- Centos7 编译安装PHP7
Centos7 编译安装PHP7 编译安装的方式可以让组件等设置更加合理,但需要你对PHP的代码及各种配置非常的熟悉,以下为大致的安装流程,大家可以参考 1.下载编译工具 yum groupinsta ...
- CentOS7编译安装php7.1配置教程详解
这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考. 1.首先安装依赖包: yum install libxml2 libxml2-devel openss ...
随机推荐
- monkeyrunner脚本录制
1.在窗口输入 monkeyrunner monkey_recorder.py 调用录制脚本工具 2.在窗口输入 monkeyrunner monkey_playback.py d:\game ...
- checked 全选 反选 示例
不多说看例子: 右上侧全选,然后每个栏又有一个栏目全选. 反选解决办法: function selectSubscibe(_class) { $("." + _class + &q ...
- C#网络编程数据传输中封装数据帧头的方法
在C/S端编程的时候,经常要在C端和S端之间传数据时自定义一下报文的帧头,如果是在C/C++,封装帧头是一件很简单的事情,直接把unsigned char *强转为struct就行,但是在C#中,并没 ...
- 关于display:none 和visibility:hidden 的区别
1.占据空间 :none 隐藏后不占据空间 visibility占据空间 2.回流与渲染:none产生回流与渲染 ? 可以通过oprea中的Profiler 工具测试. 关于回流的详细介绍:http: ...
- 关于一些对map和整行读取文件操作
public static void main(String[] args) { Map<String, String> map = new HashMap<String, Stri ...
- WEB端实现打印
首先需要下载一个JQ插件: 地址: http://files.cnblogs.com/files/SabWoF/jq%E6%89%93%E5%8D%B0%E6%8F%92%E4%BB%B6%E5%AE ...
- Weblogic集群
http://dead-knight.iteye.com/blog/1942514 http://www.cnblogs.com/HondaHsu/p/4267972.html#undefined
- Linux内核源代码获取教程
Linux内核源代码获取方法 什么叫Linux 什么叫Linux内核 Linux内核源代码的获取 什么叫Linux? Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UN ...
- 主机ping不同虚拟机
前提:今天加班时,一不小时把网线踢掉了,然而虚拟机怎么都ping不通了,试过很多办法; 最后.... 简单粗暴的重启了我的主机,对,是主机,不是虚拟机,ok,问题解决; over...
- 详细讲述MySQL中的子查询操作 (来自脚本之家)
继续做以下的前期准备工作: 新建一个测试数据库TestDB: ? 1 create database TestDB; 创建测试表table1和table2: ? 1 2 3 4 5 6 7 8 9 1 ...