git:是一种版本控制系统,是一个命令,是一种工具python
gitlib:是基于实现功能的开发库git
github:是一个基于git实现的在线代码仓库软件github
gitlib能够搭建一个相似于github同样的系统,通常用于企业或者学校等内部网络搭建私服。gitlab免费支持私人仓库,而github须要收费。若是公司团队开发的代码不想托管到github收费平台,就能够选择搭建公司gitlab服务。vim
安装sshcentos
sudo yum install -y curl policycoreutils-pythonopenssh-server
ssh服务设置开机自启动浏览器
sudo systemctl enable sshd
启动ssh服务服务器
sudo systemctl start sshd
安装防火墙(若是已经安装了防火墙而且已经在运行状态,则可直接进行第6步)网络
yum install firewalld systemd -y
开启防火墙ssh
service firewalld start
添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。curl
sudo firewall-cmd --permanent --add-service=http
重启防火墙
sudo systemctl reload firewalld
安装Postfix以发送通知邮件
sudo yum install postfix
postfix服务设置开机启动
sudo systemctl enable postfix
启动postfix
sudo systemctl start postfix
若是centos7没有安装wget,则安装wget命令
yum -y install wget
下载gitlab镜像
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
安装gitlab
rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
若是出现了改图,则安装成功
修改gitlab配置文件指定服务器ip
vim /etc/gitlab/gitlab.rb
修改external_url 'http://localhost',把localhost改为搭建gitlab的服务器ip地址
重置配置文件
gitlab-ctl reconfigure
重启gitlab
gitlab-ctl restart
访问gitlab页面
直接在浏览器输入ip访问
第一次进入直接点修改密码
建立用户,点击New User
点击New group建立组
建立项目