日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

【gitlab】gitlab快速部署教程

發(fā)布時(shí)間:2025/3/20 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【gitlab】gitlab快速部署教程 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

gitlab快速部署教程

部署環(huán)境

  • Ubuntu 16.04(親測(cè)可用)

開始部署

安裝依賴

sudo apt-get install curl openssh-server ca-certificates postfix

執(zhí)行完成后,出現(xiàn)郵件配置,選擇Internet那一項(xiàng)(不帶Smarthost的)

下載軟件包

下載頁(yè)面: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/

可以自行選擇想要部署的版本,使用命令curl進(jìn)行下載

curl -O https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/xenial/main/g/gitlab-ce/gitlab-ce_11.3.6-ce.0_amd64.deb

安裝軟件包

sudo dpkg –i gitlab-ce_11.3.6-ce.0_amd64.deb

如果安裝過程出現(xiàn)錯(cuò)誤則需要自行解決依賴等問題(筆者安裝時(shí)一切正常)

配置生成

sudo gitlab-ctl reconfigure

初次安裝使用請(qǐng)一定記得生成配置

檢查

輸入以下命令檢查是否安裝正確

sudo gitlab-ctl status

出現(xiàn)類似以下的結(jié)果,則說明運(yùn)行正常

run: gitlab-workhorse: (pid 1148) 884s; run: log: (pid 1132) 884s run: logrotate: (pid 1150) 884s; run: log: (pid 1131) 884s run: nginx: (pid 1144) 884s; run: log: (pid 1129) 884s run: postgresql: (pid 1147) 884s; run: log: (pid 1130) 884s run: redis: (pid 1146) 884s; run: log: (pid 1133) 884s run: sidekiq: (pid 1145) 884s; run: log: (pid 1128) 884s run: unicorn: (pid 1149) 885s; run: log: (pid 1134) 885s

 使用

使用的時(shí)候,系統(tǒng)管理員賬戶名稱為root,需要先設(shè)置一個(gè)root賬戶密碼。

如果出現(xiàn)502錯(cuò)誤的話,則將以下文件的讀權(quán)限打開

sudo chmod -R o+x /var/opt/gitlab/gitlab-rails

配置調(diào)整

部署域名調(diào)整

編輯配置文件

sudo nano /etc/gitlab/gitlab.rb

將內(nèi)部的external_url修改為自己的部署域名,例如:

  • 如果是局域網(wǎng)直接ip訪問的話,設(shè)置為http://xxx.xxx.xxx.xxx即可
  • 如果是外網(wǎng)通過域名訪問的話,設(shè)置為http://your.domain-name.com

然后,重新生成配置

sudo gitlab-ctl reconfigure

自行使用nginx部署

實(shí)際上,這個(gè)快速部署的軟件包內(nèi)是自帶nginx的,然而實(shí)際服務(wù)器部署的話,我們常常需要部署在系統(tǒng)原生的nginx上,我們可以按照這樣的方式進(jìn)行操作:

在nginx配置文件中添加配置:

# gitlab socket 文件地址 upstream gitlab {# 7.x 版本在此位置# server unix:/var/opt/gitlab/gitlab-rails/tmp/sockets/gitlab.socket;# 8.0+ 版本位置(11.x版本親測(cè)可用)server unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket; }server {listen *:80;server_name gitlab.liaohuqiu.com; # 請(qǐng)修改為你的域名server_tokens off; # don't show the version number, a security best practiceroot /opt/gitlab/embedded/service/gitlab-rails/public;# Increase this if you want to upload large attachments# Or if you want to accept large git objects over httpclient_max_body_size 250m;# individual nginx logs for this gitlab vhostaccess_log /var/log/gitlab/nginx/gitlab_access.log;error_log /var/log/gitlab/nginx/gitlab_error.log;location / {# serve static files from defined root folder;.# @gitlab is a named location for the upstream fallback, see belowtry_files $uri $uri/index.html $uri.html @gitlab;}# if a file, which is not found in the root folder is requested,# then the proxy pass the request to the upsteam (gitlab unicorn)location @gitlab {# If you use https make sure you disable gzip compression # to be safe against BREACH attackproxy_read_timeout 300; # Some requests take more than 30 seconds.proxy_connect_timeout 300; # Some requests take more than 30 seconds.proxy_redirect off;proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Frame-Options SAMEORIGIN;proxy_pass http://gitlab;}# Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression# WARNING: If you are using relative urls do remove the block below# See config/application.rb under "Relative url support" for the list of# other files that need to be changed for relative url supportlocation ~ ^/(assets)/ {root /opt/gitlab/embedded/service/gitlab-rails/public;# gzip_static on; # to serve pre-gzipped versionexpires max;add_header Cache-Control public;}error_page 502 /502.html; }

編輯gitlab配置文件

sudo nano /etc/gitlab/gitlab.rb

禁用掉自帶的nginx(如果原本沒有這句話的話需要加上)

nginx['enable'] = false

重啟nginx,重啟gitlab服務(wù)

sudo /usr/local/nginx/sbin/nginx -s reload sudo gitlab-ctl reconfigure

同樣的,如果再次出現(xiàn)502錯(cuò)誤的話,需要修改一下配置

sudo chmod -R o+x /var/opt/gitlab/gitlab-rails

轉(zhuǎn)載于:https://www.cnblogs.com/HansBug/p/9813627.html

總結(jié)

以上是生活随笔為你收集整理的【gitlab】gitlab快速部署教程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。