官網 gitlab.comnginx
1、Install and configure the necessary dependenciesgit
sudoapt-get install postfixredis
2. Download the Omnibus package and install everythingsql
wgethttps://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.9.4-omnibus.1-1_amd64.debshell
sudodpkg -i gitlab_7.9.4-omnibus.1-1_amd64.deb數據庫
3. Configure and start GitLabbootstrap
sudogitlab-ctl reconfigureubuntu
4. Browse to the hostname and logincentos
Username: root
Password: 5iveL!fe瀏覽器
1.Install and configure the necessary dependencies
sudo yum install postfix
sudo yum install cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh
2.Download the Omnibus package and install everything
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.9.4_omnibus.1-1.el6.x86_64.rpm
sudo rpm -i gitlab-7.9.4_omnibus.1-1.el6.x86_64.rpm
3.Configure and start GitLab
sudo gitlab-ctl reconfigure
4.Browse to the hostname and login
Username: root
Password: 5iveL!fe
安裝完成後,在瀏覽器輸入gitlab服務器的IP地址,就能夠訪問。用戶名root,密碼是5iveL!fe。
當gitlab安裝完成後,根據本身的環境,要修改配置。
如:
gitlab修改nginx端口,綁定IP等
gitlab修改ssh端口
gitlab修改訪問url等
gitlab修改數據庫類型(這個不必,由於這裏的數據庫只存儲些用戶名,gitlab代碼放在/var/opt/gitlab/git-data/下)
gitlab修改redis,gunicorn配置等等
全部的配置在/etc/gitlab/gitlab.rb中修改,修改完配置後執行gitlab-ctl reconfigure生效
gitlab全部的工程目錄都在/var/opt/gitlab/下
# ls /var/opt/gitlab/
backups bootstrapped git-data gitlab-rails gitlab-shell logrotate nginx postgresql redis
修改配置示例:
#grep -v '#' gitlab.rb |grep -v ^$
external_url 'http://gitlab.sec.com'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
nginx['listen_addresses']= ['10.18.103.1']
修改url是別人經過url拉取代碼,IP對客戶端透明。修改ssh port及nginx綁定IP等爲環境須要解決衝突。
gitlab定時自動備份
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
gitlab修改備份路徑:
修改/etc/gitlab/gitlab.rb文件
gitlab_rails['backup_path'] = '/mnt/backups'
gitlab恢復
# 中止相關數據鏈接服務
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# 從1393513186編號備份中恢復
gitlab-rake gitlab:backup:restore BACKUP=1393513186
# 啓動Gitlab
sudo gitlab-ctl start
Gitlab遷移
把備份文件拷貝到gitlab的備份目錄下,根據上面gitlab恢復步驟便可。