Gitlab服务器

Gitlab搭建内网服务器

概念:Git是版本管理工具,GitServer是远程管理仓库,但是这个仓库没有界面只能命令行管理。多个仓库时又很麻烦,Gitlab是一个私有的仓库Web管理工具,基于RoR。GitHub则可以看成一个世界级公开的GitLab。

总结起来大概如下: 
* 支持类似于github那样强大而又简单的UI交互型操作 
* 支持安装包部署在自己服务器上,安全、开源,并且免费 
* 支持邮件服务 
* 支持分支保护(权限机制,以免被人胡乱push)等等

搭建gitlab

环境centos7.4   内存4G     ip:192.168.100.204

#yum install curl policycoreutils openssh-server openssh-clients  ##安装ssh 配置防火墙

#systemctl enable sshd

#systemctl start sshd

#firewall-cmd --permanent --add-service=http  ##添加http服务到firewalld

#systemctl reload firewalld

下载、安装

#curl –sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

 

#yum install -y gitlab-ce 

#vi /etc/gitlab/gitlab.rb             ##修改配置文件

 

配置访问ip及端口或使用域名

#gitlab-ctl reconfigure               ##使配置文件生效  每次修改后都需要执行

#gitlab-ctl start                              ##启动gitlab显示ok run 表示成功

 

访问       如安装了Apache占用80端口,请更改Apache的默认端口

#访问出现502

首先保证Gitlab可用运行内存大于4G,端口未被占用 
再赋予权限:chmod -R 755 /var/log/gitlab 
再重置重启 
访问后仍然可能遇到502,不过我刷新2次就一切ok了。。

# 首次需要配置root账户密码

 

# 配置完毕后,跳转至登录界面,使用账户:root 以及刚刚设置的密码即可正常登录!

 

 

 

 

 

开发人员主机上安装git     ip:192.168.100.205

#yum -y  install git

#git config --global user.name "zhanghongyu"    ##用户

#git config --global user.email [email protected]      ##email

#mkdir /opt/zhanghongyu         ##创建一个版本库存放目录

#cd /opt/zhanghongyu          

#git init       ##把这个目录变成Git可以管理的仓库

#ssh-keygen  -t rsa C [email protected]      ##生成密匙

 

# cd /root/.ssh/

# cat id_rsa.pub

#复制密钥

 

访问192.168.100.204  添加ssh密钥

 

在gitlab上创建测试文件

 

 

# git clone http://192.168.100.204/bk/zhanghongyu.git    #进行克隆

 

 

验证结果

 

猜你喜欢

转载自blog.csdn.net/Richardlygo/article/details/82715538
今日推荐