Gitlab搭建安装及使用中遇到的问题。
一、CentOS7安裝gitlab-ce
1.下載及安裝rpm軟件包。
下載RPM包
curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.9.8-ce.0.el7.x86_64.rpm
安裝RPM包
rpm -i gitlab-ce-8.9.8-ce.0.el7.x86_64.rpm
2.修改Gitlab配置文件。
vim /etc/gitlab/gitlab.rb
external_url 'http://gitlab.federico.xin:7389'? 以上的配置文件是確定gitlab監聽的域名以及ip地址,當我們設置完成后執行以下命令將配置寫入所有配置文件當中。
重新加載配置文件
gitlab-ctl reconfigure
3.啟動Gitlab服務并檢查服務是否正常啟動。
啟動Gitlab
gitlab-ctl start
ok: run: gitlab-workhorse: (pid 5294) 0s ok: run: logrotate: (pid 5296) 0s ok: run: nginx: (pid 5300) 0s ok: run: postgresql: (pid 5302) 0s ok: run: redis: (pid 5306) 0s ok: run: sidekiq: (pid 5309) 0s ok: run: unicorn: (pid 5312) 0s檢查Gitlab進程是否成功啟動
ps aux|grep git
git 5271 57.6 11.2 399596 212268 ? Rl 10:29 0:07 ruby /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru git 5294 0.0 0.2 37768 4036 ? Ssl 10:29 0:00 /opt/gitlab/embedded/bin/gitlab-workhorse -listenNetwork unix -listenUmask 0 -listenAddr /var/opt/gitlab/gitlab-workhorse/socket -authBackend http://localhost:8080 -authSocket /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket -documentRoot /opt/gitlab/embedded/service/gitlab-rails/public -pprofListenAddr root 5296 0.0 0.0 11628 1408 ? Ss 10:29 0:00 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper root 5300 0.0 0.1 37608 2920 ? Ss 10:29 0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx gitlab-+ 5302 0.2 1.8 532352 34240 ? Ss 10:29 0:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data gitlab-+ 5306 0.0 0.4 37400 7864 ? Ssl 10:29 0:00 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0 git 5309 43.8 3.0 159376 58368 ? Rsl 10:29 0:02 ruby /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/sidekiq -q post_receive -q mailers -q archive_repo -q system_hook -q project_web_hook -q gitlab_shell -q incoming_email -q common -q pages -q elasticsearch -q default -e production -r /opt/gitlab/embedded/service/gitlab-rails -t 4 -c 25 git 5312 0.0 0.0 11632 1516 ? Ss 10:29 0:00 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper gitlab-+ 5313 0.0 0.2 41700 5172 ? S 10:29 0:00 nginx: worker process gitlab-+ 5314 0.0 0.0 37760 1492 ? S 10:29 0:00 nginx: cache manager process gitlab-+ 5315 0.0 0.0 37760 1492 ? S 10:29 0:00 nginx: cache loader process gitlab-+ 5330 0.0 0.0 532584 1184 ? Ss 10:29 0:00 postgres: checkpointer process gitlab-+ 5331 0.0 0.0 532584 1192 ? Ss 10:29 0:00 postgres: writer process gitlab-+ 5332 0.0 0.0 532584 944 ? Ss 10:29 0:00 postgres: wal writer process gitlab-+ 5333 0.0 0.1 533572 2384 ? Ss 10:29 0:00 postgres: autovacuum launcher process gitlab-+ 5334 0.0 0.0 26556 1264 ? Ss 10:29 0:00 postgres: stats collector process git 5339 0.0 0.0 4308 344 ? S 10:29 0:00 sleep 1 gitlab-+ 5340 0.0 0.4 638200 7964 ? Ss 10:29 0:00 postgres: gitlab gitlabhq_production [local] idle root 5342 0.0 0.0 112656 960 pts/0 S+ 10:29 0:00 grep --color=auto git root 32239 0.0 0.0 4328 488 ? Ss 09:41 0:00 runsvdir -P /opt/gitlab/service log: ........................................................................................................................................................................................................................................................................................................................................................................................................... root 32260 0.0 0.0 4320 540 ? S 09:41 0:00 svlogd -tt /var/log/gitlab/redis root 32343 0.0 0.0 4320 536 ? S 09:41 0:00 svlogd -tt /var/log/gitlab/postgresql root 32426 0.0 0.0 4320 540 ? S 09:42 0:00 svlogd -tt /var/log/gitlab/unicorn root 32458 0.0 0.0 4320 544 ? S 09:42 0:00 svlogd -tt /var/log/gitlab/sidekiq root 32468 0.0 0.0 4176 344 ? Ss 09:42 0:00 runsv gitlab-workhorse root 32469 0.0 0.0 4320 540 ? S 09:42 0:00 svlogd -tt /var/log/gitlab/gitlab-workhorse root 32475 0.0 0.0 4320 340 ? S 09:42 0:00 svlogd -tt /var/log/gitlab/nginx root 32487 0.0 0.0 4320 540 ? S 09:42 0:00 svlogd -tt /var/log/gitlab/logrotate? 以上,我們已經將Gitlab服務啟動完成,并監聽在7389端口,下面我們開始配置前端nginx反向代理Gitlab。
二、配置Nginx反向搭理Gitlab
1.修改Nginx配置文件
vim /etc/nginx/conf.d/gitlab.conf
upstream git{server ip:port; }server{listen 80;server_name gitlab.federico.xin;location / {client_max_body_size 500m;proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://git;index index.html index.htm;} }2.檢查并重啟Nginx
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successfulnginx -s reload
三、使用Gitlab過程中遇到的各種問題以及解決措施
1.fatal: The remote end hung up unexpectedly
? 在push代碼到庫時,出現上述報錯,原因是因為上傳的git包過大,可以通過以下設置解決此問題。
git config http.postBuffer 524288000
2.error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
? 出現以上問題同樣是因為上傳軟件包過大,需要我們在nginx參數中進行調整設置文件傳輸大小的限制。需要注意的是,如果是反向代理的Gitlab需要我們將兩臺服務器的nginx都進行設置。
grep -r "client_max_body_size" /var/opt/gitlab/
vim /var/opt/gitlab/nginx/conf/nginx.conf
client_max_body_size 500m;nginx -t
nginx -s reload
轉載于:https://www.cnblogs.com/Cherry-Linux/p/8276317.html
總結
以上是生活随笔為你收集整理的Gitlab搭建安装及使用中遇到的问题。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【junit】junit4单元测试ecl
- 下一篇: 41)子类和父类的内存关系