{"id":19638,"date":"2024-11-19T11:27:37","date_gmt":"2024-11-19T03:27:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19638\/"},"modified":"2024-11-19T11:27:37","modified_gmt":"2024-11-19T03:27:37","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e6%90%ad%e5%bb%ba%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19638\/","title":{"rendered":"\u5982\u4f55\u5728\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u5b89\u88c5gitlab"},"content":{"rendered":"<p>\u968f\u7740\u8f6f\u4ef6\u5f00\u53d1\u884c\u4e1a\u7684\u8fc5\u901f\u53d1\u5c55\uff0c\u7248\u672c\u63a7\u5236\u5de5\u5177\u6210\u4e3a\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u5de5\u5177\u4e4b\u4e00\u3002git\u4f5c\u4e3a\u73b0\u4ee3\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e4b\u4e00\uff0c\u53d7\u5230\u8d8a\u6765\u8d8a\u591a\u7684\u5f00\u53d1\u8005\u7684\u6b22\u8fce\u3002gitlab\u662f\u4e00\u6b3e\u529f\u80fd\u9f50\u5168\u7684\u57fa\u4e8eweb\u7684git\u5b58\u50a8\u5e93\u7ba1\u7406\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u63d0\u4f9b\u4ee3\u7801\u6258\u7ba1\u3001\u95ee\u9898\u8ffd\u8e2a\u3001\u4ee3\u7801\u5ba1\u67e5\u7b49\u591a\u79cd\u529f\u80fd\uff0c\u80fd\u591f\u63d0\u5347\u56e2\u961f\u534f\u4f5c\u6548\u7387\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u5b89\u88c5gitlab\uff0c\u4ee5\u4fbf\u4e8e\u56e2\u961f\u534f\u4f5c\u4f7f\u7528\u3002<\/p>\n<p>\u6b65\u9aa4\u4e00\uff1a\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305<\/p>\n<p>\u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u4ee5\u53ca\u6dfb\u52a0GitLab\u7684\u8f6f\u4ef6\u6e90\u3002\u4ee5\u4e0b\u662f\u5728\u57fa\u4e8eUbuntu\u7684Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5fc5\u8981\u8f6f\u4ef6\u5305\u7684\u547d\u4ee4\uff1a<\/p>\n<pre>sudo apt-get update -y &amp;&amp; sudo apt-get upgrade -y\nsudo apt-get install -y curl openssh-server ca-certificates<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b65\u9aa4\u4e8c\uff1a\u6dfb\u52a0GitLab\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u6dfb\u52a0GitLab\u7684\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab\u3002\u6839\u636e\u5b98\u65b9\u6587\u6863\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6dfb\u52a0GitLab\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab CE\u7248\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash\nsudo apt-get install gitlab-ce<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u8981\u5b89\u88c5GitLab EE\u7248\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.deb.sh | sudo bash\nsudo apt-get install gitlab-ee<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u4e0b\u8f7d\u901f\u5ea6\u8f83\u6162\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u52a0\u4e0a-x\u53c2\u6570\u6765\u8f93\u51fa\u4e0b\u8f7d\u8fdb\u5ea6\u3002<\/p>\n<p>\u6b65\u9aa4\u4e09\uff1a\u914d\u7f6eGitLab<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539GitLab\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u7aef\u53e3\u8bbe\u7f6e\u4e3a80\u6216443\uff08\u5982\u679c\u6709\u57df\u540d\u7684\u8bdd\uff09\uff0c\u5e76\u5c06external_url\u5c5e\u6027\u6307\u5411\u6211\u4eec\u7684\u4e3b\u673a\u6216\u57df\u540d\u3002\u53ef\u4ee5\u7528nano\u6216vi\u7b49\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\/etc\/gitlab\/gitlab.rb\uff0c\u627e\u5230\u4ee5\u4e0b\u4e24\u884c\u5e76\u4fee\u6539\u4e3a\u5bf9\u5e94\u7684\u503c\uff1a<\/p>\n<pre># \u4fee\u6539\u7aef\u53e3\nnginx['listen_port'] = 80\n\n# \u4fee\u6539external_url\nexternal_url 'http:\/\/example.com'<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u542f\u52a8GitLab\u5e76\u8fdb\u884c\u4e00\u4e9b\u521d\u59cb\u8bbe\u7f6e\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8GitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\uff0c\u76f4\u5230\u542f\u52a8\u5b8c\u6210\u3002\u5982\u679c\u65e0\u6cd5\u542f\u52a8\uff0c\u53ef\u4ee5\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\/var\/log\/gitlab\u4e2d\u7684\u9519\u8bef\u4fe1\u606f\u6765\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<p>\u5728\u542f\u52a8\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00http:\/\/server-ip\u6216http:\/\/example.com\uff08\u5982\u679c\u6709\u57df\u540d\u7684\u8bdd\uff09\u8fdb\u5165GitLab\u7684\u767b\u5f55\u754c\u9762\u3002\u9996\u6b21\u8bbf\u95ee\u4f1a\u63d0\u793a\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237\uff0c\u6839\u636e\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u5373\u53ef\u3002\u63a5\u7740\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u5fc5\u8981\u7684\u8bbe\u7f6e\uff0c\u5982\u6dfb\u52a0\u90ae\u7bb1\u670d\u52a1\u5668\u3001\u914d\u7f6eLDAP\u3001SSO\u7b49\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u6b65\u9aa4\u56db\uff1a\u4f7f\u7528GitLab<\/p>\n<p>GitLab\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u8fdb\u884c\u4ee3\u7801\u6258\u7ba1\u3001\u7248\u672c\u63a7\u5236\u3001\u95ee\u9898\u8ffd\u8e2a\u7b49\u64cd\u4f5c\u4e86\u3002\u5728\u767b\u5f55\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u65b0\u5efa\u9879\u76ee\u3001\u7f16\u8f91\u4ee3\u7801\u3001\u63d0\u4ea4\u4ee3\u7801\u3001\u5408\u5e76\u4ee3\u7801\u7b49\u7b49\u3002GitLab\u7684\u4f7f\u7528\u4e0e\u4f20\u7edf\u7684Git\u547d\u4ee4\u7c7b\u4f3c\uff0c\u4f46\u662f\u66f4\u52a0\u65b9\u4fbf\u3001\u76f4\u89c2\u3002\u6b64\u5916\uff0cGitLab\u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u5176\u4ed6\u65b9\u4fbf\u7684\u529f\u80fd\uff0c\u5982\u642d\u5efaCI\/CD\u6d41\u6c34\u7ebf\u3001\u5b9a\u5236\u5316\u95ee\u9898\u8ddf\u8e2a\u3001\u96c6\u6210\u7b2c\u4e09\u65b9\u5de5\u5177\u7b49\u7b49\u3002\u5728\u4f7f\u7528\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u60c5\u51b5\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u7ed3\u8bed<\/p>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u5b89\u88c5GitLab\uff0c\u4ee5\u53ca\u8fdb\u884c\u4e00\u4e9b\u57fa\u672c\u7684\u914d\u7f6e\u64cd\u4f5c\u3002\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u8fdb\u884c\u5b9a\u5236\u5316\u914d\u7f6e\uff0c\u4ee5\u4fbf\u66f4\u597d\u7684\u9002\u5e94\u5de5\u4f5c\u73af\u5883\u3002GitLab\u7684\u5f3a\u5927\u529f\u80fd\u53ef\u4ee5\u63d0\u9ad8\u56e2\u961f\u534f\u4f5c\u6548\u7387\uff0c\u4fc3\u8fdb\u9879\u76ee\u5f00\u53d1\u8fdb\u7a0b\u3002\u5efa\u8bae\u5f00\u53d1\u8005\u5c1d\u8bd5\u4f7f\u7528GitLab\u6765\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\uff0c\u4ee5\u4fbf\u66f4\u597d\u7684\u7ba1\u7406\u9879\u76ee\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u5b89\u88c5gitlab\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u8f6f\u4ef6\u5f00\u53d1\u884c\u4e1a\u7684\u8fc5\u901f\u53d1\u5c55\uff0c\u7248\u672c\u63a7\u5236\u5de5\u5177\u6210\u4e3a\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u5de5\u5177\u4e4b\u4e00\u3002git\u4f5c\u4e3a\u73b0\u4ee3\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e4b\u4e00\uff0c\u53d7\u5230\u8d8a\u6765\u8d8a\u591a\u7684\u5f00\u53d1\u8005\u7684\u6b22\u8fce\u3002gitlab\u662f\u4e00\u6b3e\u529f\u80fd\u9f50\u5168\u7684\u57fa\u4e8eweb\u7684git\u5b58\u50a8\u5e93\u7ba1\u7406\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u63d0\u4f9b\u4ee3\u7801\u6258\u7ba1\u3001\u95ee\u9898\u8ffd\u8e2a\u3001\u4ee3\u7801\u5ba1\u67e5\u7b49\u591a\u79cd\u529f\u80fd\uff0c\u80fd\u591f\u63d0\u5347\u56e2\u961f\u534f\u4f5c\u6548\u7387\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u5b89\u88c5gitlab\uff0c\u4ee5\u4fbf\u4e8e\u56e2\u961f\u534f\u4f5c\u4f7f\u7528\u3002 \u6b65\u9aa4\u4e00\uff1a\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305 \u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u4ee5\u53ca\u6dfb\u52a0GitLab\u7684\u8f6f\u4ef6\u6e90\u3002\u4ee5\u4e0b\u662f\u5728\u57fa\u4e8eUbuntu\u7684Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5\u5fc5\u8981\u8f6f\u4ef6\u5305\u7684\u547d\u4ee4\uff1a sudo apt-get update -y &amp;&amp; sudo apt-get upgrade -y sudo apt-get install -y curl openssh-server ca-certificates \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4\u4e8c\uff1a\u6dfb\u52a0GitLab\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab \u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u6dfb\u52a0GitLab\u7684\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab\u3002\u6839\u636e\u5b98\u65b9\u6587\u6863\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6dfb\u52a0GitLab\u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5GitLab CE\u7248\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash sudo apt-get install gitlab-ce \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u8981\u5b89\u88c5GitLab EE\u7248\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.deb.sh | sudo bash sudo apt-get install gitlab-ee \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u4e0b\u8f7d\u901f\u5ea6\u8f83\u6162\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u52a0\u4e0a-x\u53c2\u6570\u6765\u8f93\u51fa\u4e0b\u8f7d\u8fdb\u5ea6\u3002 \u6b65\u9aa4\u4e09\uff1a\u914d\u7f6eGitLab \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539GitLab\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u7aef\u53e3\u8bbe\u7f6e\u4e3a80\u6216443\uff08\u5982\u679c\u6709\u57df\u540d\u7684\u8bdd\uff09\uff0c\u5e76\u5c06external_url\u5c5e\u6027\u6307\u5411\u6211\u4eec\u7684\u4e3b\u673a\u6216\u57df\u540d\u3002\u53ef\u4ee5\u7528nano\u6216vi\u7b49\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\/etc\/gitlab\/gitlab.rb\uff0c\u627e\u5230\u4ee5\u4e0b\u4e24\u884c\u5e76\u4fee\u6539\u4e3a\u5bf9\u5e94\u7684\u503c\uff1a # \u4fee\u6539\u7aef\u53e3 nginx[&#8216;listen_port&#8217;] = 80 # \u4fee\u6539external_url [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19638","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19638"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19638\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}