① 安装 Git

Linux 做为服务器端系统,Windows 作为客户端系统,分别安装 Git

服务器端:

#yum install -y git

安装完后,查看 Git 版本

[root@localhost ~]# git --version
git version 1.7.1

服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码

[root@localhost home]# id git
id: git:无此用户
[root@localhost home]# useradd git
[root@localhost home]# passwd git

③ 服务器端创建 Git 仓库

设置 /home/data/git/gittest.git 为 Git 仓库

然后把 Git 仓库的 owner 修改为 git

[root@localhost home]# mkdir -p data/git/gittest.git
[root@localhost home]# git init --bare data/git/gittest.git
Initialized empty Git repository in /home/data/git/gittest.git/
[root@localhost home]# cd data/git/
[root@localhost git]# chown -R git:git gittest.git/

Gitlab是什么?

GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

GitLab 5.0以前版本要求服务器端采用 Gitolite 搭建,5.0版本以后不再使用 Gitolite ,采用自己开发的 gitlab-shell 来实现。如果你觉得安装麻烦可以使用 GitLab Installers 一键安装程序。

Gitlab文档

gitlab英文官网:https://about.gitlab.com/

gitlab中文官网:https://www.gitlab.com.cn/

gitlab使用手册:https://docs.gitlab.com.cn/ce/README.html

Gitlab如何搭建?

1.安装gitlab所需要的依赖

sudo yum install curl policycoreutils openssh-server openssh-clients

发现出现错误:

根据提示可以选择按照以下进行依赖安装

sudo yum install curl policycoreutils openssh-server openssh-clients --skip-broken

 选择y

2.使sshd服务自动启动

sudo systemctl enable sshd

3.启动sshd服务

sudo systemctl start sshd

4.安装邮件服务器

sudo yum install postfix

5.使邮件服务器postfix自启动

sudo systemctl enable postfix

6. 启动邮件服务器postfix

sudo systemctl start postfix

7. 添加GitLab仓库,并安装到服务器上

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash

8.安装gitlab

sudo yum install gitlab-ce

安装完毕

如何启动GitLab?

1.启动,配置

sudo gitlab-ctl reconfigure

2.修改gitlab配置文件指定服务器ip和自定义端口

vi  /etc/gitlab/gitlab.rb

退出并保存
 
ps:注意这里设置的端口不能被占用,默认是8080端口,因为我这里8080已经使用,所以定义了其它端口,并在防火墙设置开放相对应得端口。
 

3.重置并启动GitLab

重新配置

gitlab-ctl reconfigure

重启

gitlab-ctl restart

访问gitlab:http://192.168.146.128:8888/

4. 处理502错误的方案

如果出现502的错误,那可能是端口的占用,导致启动不了应用。

Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

vim /etc/postfix/main.cf

inet_protocols = all
改成
inet_protocols = ipv4

 

在linux 下安装git的更多相关文章

  1. 环境部署(三):Linux下安装Git

    Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理,是目前使用范围最广的版本管理工具. 这篇博客,介绍下Linux下安装Git的步骤,仅供参考,当然,还是yum安装 ...

  2. Linux下安装Git

    Ubuntu12.04中默认没有安装Git.需要自行安装. 1. 安装Git 1.1 Ubuntu12.04下 可以使用apt-get方式安装,也可以下载源代码安装[1],我们这里使用apt-git安 ...

  3. [v]Linux下安装Git

    Ubuntu12.04中默认没有安装Git.需要自行安装. 1. 安装Git 1.1 Ubuntu12.04下 可以使用apt-get方式安装,也可以下载源代码安装[1],我们这里使用apt-git安 ...

  4. 关于在linux下安装git,以及在idea上将项目部署到码云上

    GIT 基于对linux感兴趣,并且也考虑到以后从事开发后也会用到linux,着实在闲余之际学学linux.最近在用VM虚拟机环境下学做一个项目,在git上卡了一点时间,但同时也收获  了不少,下面写 ...

  5. Linux下安装git本地库与服务器端远程库

    1.    git是一个分布式版本管理系统,关于该工具的详细介绍,我认为廖雪峰老师介绍的非常全面:https://www.liaoxuefeng.com/wiki/896043488029600. 不 ...

  6. git常用命令和linux下安装git教程

    Debian/Ubuntu下使用apt-get安装git #安装libz-dev libssl-dev $ apt-get install libcurl4-gnutls-dev libexpat1- ...

  7. linux 下安装git的步骤方法

    ①.获取github最新的Git安装包下载链接,进入Linux服务器,执行下载,命令为: wget https://github.com/git/git/archive/v2.17.0.tar.gz  ...

  8. linux下安装Git并生成SSH key

    系统:contens7.4 1.下载源码解压 wget https://github.com/git/git/archive/v2.3.0.zip unzip v2.3.0.zip cd git-2. ...

  9. Linux下安装{Git}

    环境 { "操作系统":"CentOS 7.5 64位", "CPU":"1核", "内存":&qu ...

随机推荐

  1. 检测Python程序本身是否已经在运行

    为runner.py实现一个函数,检测是否有其他的runner.py进程在正在执行? 除主要用到os模块,还用到了第三方模块psutil

  2. python_0基础开始_day09

    第九节 1,函数初始 s = "qwertyuiop"n = 0for i in s:    n += 1print(n)​lst = [1,2,3,4,5]n = 0for i ...

  3. python+minicap的使用

    说起Minicap,不得不提到STF,STF (Smartphone Test Farm) 是一个开源的web架构应用,用户可通过浏览器远程操作Android设备.调试Android应用.在设备上进行 ...

  4. vs nuget找不到包

    nuget.org https://api.nuget.org/v3/index.json

  5. iis 8.0 HTTP 错误 404.3 server 2012

    最近在学习WCF,发现将网站WCF服务放到IIS上时不能正常运行,从网上搜了一下: 解决方法,以管理员身份进入命令行模式,运行: "%windir%\Microsoft.NET\Framew ...

  6. Git复习(五)之多人协作、git push失败、git pull失败

    多人协作 多人协作时,大家都会往master和dev分支上推送各自的修改. 现在,模拟一个你的小伙伴,可以在另一台电脑(注意要把SSH Key添加到GitHub)或者同一台电脑的另一个目录下克隆: $ ...

  7. O001、写在最前面

    参考https://www.cnblogs.com/CloudMan6/p/5224114.html   <每天5分钟玩转 OpenStack>       1.系统讲解 OpenStac ...

  8. centos配置postfix邮件服务

    1.环境初始化 [root@mail ~]# rpm -q centos-release //查看系统版本 centos-release-7-5.1804.el7.centos.x86_64 [roo ...

  9. CentOS7 ab压力测试安装

    ①.ab(apache benchmark)安装 命令: yum -y install httpd-tools ②.ab测试的命令参数 命令: ab 或 ab -help 显示命令参数如下 ③.ab的 ...

  10. redis加入systemctl服务

    来自:https://blog.csdn.net/weixin_41114593/article/details/82383716 第一步 安装redis去官网下载最新的redis版本    安装官网 ...