1、安装依赖包
sudo apt-get update
sudo apt-get install curl openssh-server ca-certificates postfix
注:执行完成后,出现邮件配置,选择Internet那一项(不带Smarthost的)
2、添加gitlab 包服务并安装包
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
3、安装 gitlab-ce
sudo apt-get update
sudo apt-get install gitlab-ce
出现下图即为成功
4、修改服务器地址
sudo gedit /etc/gitlab/gitlab.rb
external_url 'http://192.168.0.88:8888' # 可以用ifconfig查看电脑的ip,可以添加端口号
5、启动各项服务
sudo gitlab-ctl reconfigure
6、检查GitLab是否安装好并且已经正确运行
sudo gitlab-ctl status
#如果得到类似下面的结果,则说明GitLab运行正常
7、访问及使用
http://192.168.0.88:8888
8、常用命令
sudo gitlab-ctl tail // 查看日志
sudo gitlab-ctl check-config //检查在gitlab中是否有任何配置。在指定版本中删除的rb
sudo gitlab-ctl deploy-page //安装部署页面
sudo gitlab-ctl diff-config //将用户配置与包可用配置进行比较
sudo gitlab-ctl remove-accounts //删除所有用户和组
sudo gitlab-ctl upgrade //升级
sudo gitlab-ctl service-list //查看所有服务
sudo gitlab-ctl once //如果GitLab服务停止了就启动服务,如果已启动就不做任何操作
sudo gitlab-ctl restart //重启GitLab服务
sudo gitlab-ctl start //如果GitLab服务停止了就启动服务,如果已启动就重启服务
sudo gitlab-ctl stop //停止GitLab服务
sudo gitlab-ctl status //查看GitLab服务状态
sudo gitlab-ctl reconfigure //reconfigure重新配置GitLab并启动(修改配置后,必须执行)
9、卸载
sudo gitlab-ctl uninstall
sudo dpkg -r gitlab-ce
sudo rpm -e gitlab-ce
reboot //(重启)
10、查看 GitLab 版本号
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION