部署
1、前期准备:
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix
2、信任 GitLab 的 GPG 公钥:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
3、配置镜像路径
gitlab-ce是社区版,免费;gitlab-ee是企业版,收费。
# ce
sudo vim /etc/apt/sources.list.d/gitlab-ce.list
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main
# ee
sudo vim /etc/apt/sources.list.d/gitlab-ee.list
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/ubuntu xenial main
4、安装 gitlab-ce/ee
sudo apt-get update
sudo apt-get install gitlab-ce
or
sudo apt-get install gitlab-ee=10.8.4-ee.0
5、修改gitlab的端口和地址
编辑gitlab.rb
sudo gedit /etc/gitlab/gitlab.rb
将如下数据进行更改
external_url 'http://gitlab.example.com'
比如说更改为
external_url 'http://192.168.100.100:8080'
更改之后,需要执行如下代码,来重新初始化配置才能生效:
sudo gitlab-ctl reconfigure
6、启动gitlab
sudo gitlab-ctl start
7、其它命令
停止
sudo gitlab-ctl stop
开启
sudo gitlab-ctl start
确认配置(修改配置后,必须执行)
sudo gitlab-ctl reconfigure
查看日志
sudo gitlab-ctl tail
查看 GitLab 版本号
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
还原
- 本地代码库路径
/var/opt/gitlab/git-data/
- 备份
gitlab-rake gitlab:backup:create
/var/opt/gitlab/backups/
- 还原
eg:1528446365_2018_06_08_10.8.4-ee_gitlab_backup.tar
cp 1528446365_2018_06_08_10.8.4-ee_gitlab_backup.tar /var/opt/gitlab/backups/1528446365_2018_06_08_10.8.4-ee_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1528446365_2018_06_08_10.8.4-ee
网友评论