gitlab的搭建node
yum -y install curl policycoreutils openssh-server openssh-clients
systemctl enable sshd
systemctl start sshd
yum -y install postfix
systemctl enable postfix
systemctl start postfix
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
ornginx
yum install firewalld
systemctl unmask firewalld
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash yum install gitlab-ce
執行上面的命令,會一直 time out ,因此咱們要換成國內的源.git
如下操做針對CentOS 7 ,其餘的請戳 https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/web
vi /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key
注意,若是對應配置文件下有文件gitlab_gitlab-ce.repo
,重命名一下,否則會默認加載這個致使上面的文件不起做用.redis
查看目前的yum進程,並殺死sql
ps -a PID TTY TIME CMD 18781 pts/0 00:00:00 sudo 18783 pts/0 00:00:00 bash 18796 pts/0 00:00:00 yum 18855 pts/0 00:00:00 sudo 18856 pts/0 00:00:00 yum 18871 pts/0 00:00:00 ps kill -9 18796 kill -9 18856
而後安裝:緩存
sudo yum makecache
sudo yum install gitlab-ce
上面執行完了,是這樣的展現結果bash
sudo gitlab-ctl reconfigure gitlab: GitLab should be reachable at http://iZ2851te7e5Z gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab: And running reconfigure again. gitlab: gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab: It looks like GitLab has not been configured yet; skipping the upgrade script. 驗證中 : gitlab-ce-8.7.6-ce.0.el7.x86_64 1/1 已安裝: gitlab-ce.x86_64 0:8.7.6-ce.0.el7 完畢!
默認安裝的是最新的gitlab-ce的包,若是須要特定的版本能夠在官網去下載特定的版本 地址:服務器
https://packages.gitlab.com/gitlab/gitlab-ce/
gitlab-ctl reconfigure
Username: root
Password: 5iveL!fe
測試地址(默認80端口):ssh
http://127.0.0.1/
gitlab-rake gitlab:backup:create
默然的備份目錄爲: /var/opt/gitlab/backups 備份文件名相似: 1393513186_gitlab_backup.tar
vi /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = '/mnt/gitlab_backups'
提示:gitlab數據的恢復或者遷移成功的前提——兩臺服務器的gitlab的版本必須相同,若不相同則可能遷移或者恢復失敗
好比/var/opt/gitlab/backups下的1458217074_gitlab_backup.tar
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
停服務
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
恢復數據
gitlab-rake gitlab:backup:restore BACKUP=1458213020
BACKUP後面跟的是備份文件的時間戳,好比恢復備份文件1458217074_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1458217074
gitlab-ctl start
server { listen *:82; server_name gitlab.123.123.cn; server_tokens off; ## Don't show the nginx version number, a security best practice
gitlab-ctl restart
默認狀況下gitlab是沒有啓用自帶的redis的(雖然redis已經和gitlab一塊兒啓動):
ok: run: gitlab-workhorse: (pid 14263) 1s ok: run: logrotate: (pid 14271) 0s ok: run: nginx: (pid 14278) 1s ok: run: node-exporter: (pid 14284) 0s ok: run: postgres-exporter: (pid 14288) 1s ok: run: postgresql: (pid 14303) 0s ok: run: prometheus: (pid 14312) 1s ok: run: redis: (pid 14317) 0s ok: run: redis-exporter: (pid 14320) 0s ok: run: sidekiq: (pid 14330) 1s ok: run: unicorn: (pid 14336) 0s
啓用自帶的redis,修改/etc/gitlab/gitlab.rb:
redis['port'] = 6379
redis['bind'] = '127.0.0.1'
[root@localhost ~]# gitlab-ctl reconfigure
能夠看到redis-server和端口6379,redis已經開始工做了:
Running handlers: Running handlers complete Chef Client finished, 15/397 resources updated in 25 seconds gitlab Reconfigured!
[root@localhost ~]# gitlab-ctl restart
[root@localhost ~]# ps -ef|grep redis
root 639 632 0 14:54 ? 00:00:00 runsv redis
root 649 632 0 14:54 ? 00:00:00 runsv redis-exporter
root 653 639 0 14:54 ? 00:00:00 svlogd -tt /var/log/gitlab/redis
root 668 649 0 14:54 ? 00:00:00 svlogd -tt /var/log/gitlab/redis-exporter
gitlab-+ 14317 639 0 16:36 ? 00:00:00 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:6379
gitlab-+ 14320 649 0 16:36 ? 00:00:00 /opt/gitlab/embedded/bin/redis_exporter -web.listen-address=localhost:9121 -redis.addr=unix:///var/opt/gitlab/redis/redis.socket
root 14376 8935 0 16:36 pts/2 00:00:00 grep --color=auto redis
訪問一下gitlab主頁和各頁面,而後查看redis裏的緩存清況,已經出現緩存內容了:
[root@localhost ~]# /opt/gitlab/embedded/bin/redis-cli
127.0.0.1:6379> keys *
1) "resque:gitlab:cron_job:admin_email_worker"
2) "resque:gitlab:cron_job:repository_archive_cache_worker"
3) "resque:gitlab:limit_fetch:probed:repository_import"
4) "cache:gitlab:last_commit_id_for_path:2af1c3ff162bb2...................
詳細文檔:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/redis.md