{"id":19203,"date":"2024-11-19T08:54:21","date_gmt":"2024-11-19T00:54:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19203\/"},"modified":"2024-11-19T08:54:21","modified_gmt":"2024-11-19T00:54:21","slug":"%e8%af%a6%e8%a7%a3gitlab%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83%e7%9a%84%e6%90%ad%e5%bb%ba%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19203\/","title":{"rendered":"\u8be6\u89e3gitlab\u751f\u4ea7\u73af\u5883\u7684\u642d\u5efa\u65b9\u6cd5"},"content":{"rendered":"<p>\u4e00\u3001\u5f15\u8a00<\/p>\n<p>\u5728\u5f53\u4eca\u8f6f\u4ef6\u5f00\u53d1\u884c\u4e1a\u4e2d\uff0cGit\u4f5c\u4e3a\u7248\u672c\u63a7\u5236\u5de5\u5177\u5df2\u7ecf\u6210\u4e3a\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002GitLab\u5219\u662f\u5728Git\u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u670d\u52a1\u3002GitLab\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u3001\u5408\u4f5c\u548c\u90e8\u7f72\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u642d\u5efaGitLab\u7684\u751f\u4ea7\u73af\u5883\uff0c\u5e2e\u52a9\u5f00\u53d1\u56e2\u961f\u66f4\u597d\u5730\u5229\u7528GitLab\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u3002\u672c\u6587\u5c06\u57fa\u4e8eUbuntu 18.04 LTS\u7248\u672c\uff0c\u8be6\u7ec6\u8bf4\u660eGitLab\u7684\u5b89\u88c5\u3001\u914d\u7f6e\u548c\u8fd0\u884c\u3002<\/p>\n<p>\u4e8c\u3001\u5b89\u88c5GitLab<\/p>\n<ol>\n<li>\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879<\/li>\n<\/ol>\n<p>GitLab\u5728Ubuntu 18.04 LTS\u7684\u5b89\u88c5\u9700\u8981\u8bb8\u591a\u4f9d\u8d56\u9879\u3002\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86EPEL\u548c\u76f8\u5173\u7684\u4f9d\u8d56\u9879\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a<\/p>\n<pre>sudo apt-get update\nsudo apt-get install -y curl openssh-server ca-certificates postfix<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5GitLab\u7684\u5305<\/li>\n<\/ol>\n<p>\u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u6dfb\u52a0GitLab\u5b98\u65b9\u7684\u8f6f\u4ef6\u5305\u3002\u4e3a\u6b64\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.deb.sh | sudo bash<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u4e0b\u8f7d\u811a\u672c\u5e76\u5b89\u88c5GitLab\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<ol>\n<li>\u5b89\u88c5GitLab<\/li>\n<\/ol>\n<p>\u5b8c\u6210\u4e0b\u8f7d\u548c\u5b89\u88c5\u5305\u4e4b\u540e\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u5b89\u88c5GitLab\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo EXTERNAL_URL=\"http:\/\/gitlab.example.com\" apt-get install gitlab-ee<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u8fd9\u91cc\u5fc5\u987b\u66ff\u6362\u201chttp:\/\/gitlab.example.com\u201d\u4e3a\u60a8\u81ea\u5df1\u7684GitLab\u670d\u52a1\u5668\u7684URL\u3002<\/p>\n<ol>\n<li>\u542f\u52a8GitLab<\/li>\n<\/ol>\n<p>\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8GitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd0\u884c\u6b64\u547d\u4ee4\u65f6\uff0cGitLab\u5c06\u81ea\u52a8\u542f\u52a8\u5e76\u914d\u7f6e\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5GitLab\u7684\u72b6\u6001\uff1a<\/p>\n<pre>sudo gitlab-ctl status<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u6240\u6709\u7ec4\u4ef6\u90fd\u5df2\u542f\u52a8\uff0c\u5219\u4f1a\u8f93\u51faOK\u3002<\/p>\n<p>\u4e09\u3001\u914d\u7f6eGitLab<\/p>\n<ol>\n<li>\u8fdb\u884c\u57fa\u672c\u8bbe\u7f6e<\/li>\n<\/ol>\n<p>\u5728\u5b89\u88c5\u540e\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8f93\u5165GitLab\u7684URL\u3002\u9996\u6b21\u767b\u5f55\u65f6\uff0c\u9700\u8981\u8bbe\u7f6e\u7ba1\u7406\u5458\u5bc6\u7801\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/p>\n<ol>\n<li>\u914d\u7f6eSSL\u8bc1\u4e66<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u4fdd\u62a4\u60a8\u7684\u670d\u52a1\u5668\uff0c\u5efa\u8bae\u4f7f\u7528SSL\u8bc1\u4e66\u8fdb\u884c\u8bbf\u95ee\u3002\u53ef\u4ee5\u901a\u8fc7\u514d\u8d39\u7684Let\u2019s Encrypt\u8bc1\u4e66\u6765\u514d\u8d39\u83b7\u53d6SSL\u3002\u5728\u6b64\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5certbot\uff1a<\/p>\n<pre>sudo apt-get install -y certbot<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u83b7\u53d6\u5e76\u914d\u7f6e\u8bc1\u4e66\uff1a<\/p>\n<pre>sudo certbot --nginx -d gitlab.example.com<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u64cd\u4f5c\u7ed3\u675f\u540e\uff0c\u9700\u8981\u91cd\u65b0\u542f\u52a8Nginx\uff1a<\/p>\n<pre>sudo systemctl restart nginx<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u7981\u7528\u6ce8\u518c<\/li>\n<\/ol>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u8bbf\u95eeGitLab\u5e76\u6ce8\u518c\u65b0\u5e10\u6237\u3002\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u7531\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5efa\u8bae\u505c\u7528\u8be5\u529f\u80fd\u3002\u8981\u7981\u7528\u6ce8\u518c\uff0c\u8bf7\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre>sudo vi \/etc\/gitlab\/gitlab.rb<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u627e\u5230\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre># gitlab_rails['gitlab_sign_up_enabled'] = true<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06\u5176\u66f4\u6539\u4e3a\uff1a<\/p>\n<pre>gitlab_rails['gitlab_sign_up_enabled'] = false<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7136\u540e\u91cd\u65b0\u542f\u52a8GitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u56db\u3001\u603b\u7ed3<\/p>\n<p>\u672c\u6587\u63d0\u4f9b\u4e86GitLab\u751f\u4ea7\u73af\u5883\u7684\u642d\u5efa\u65b9\u6cd5\u3002\u6211\u4eec\u4e86\u89e3\u4e86\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eGitLab\uff0c\u5e76\u5bf9\u57fa\u672c\u53c2\u6570\u8fdb\u884c\u4e86\u8bbe\u7f6e\uff0c\u4ee5\u786e\u4fdd\u6211\u4eec\u7684\u4ee3\u7801\u4ed3\u5e93\u5b89\u5168\u53ef\u9760\u3002\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u4fdd\u8bc1\u7cfb\u7edf\u7684\u53ef\u9760\u6027\u548c\u5b89\u5168\u6027\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u6b64\u7406\u89e3\u8fd9\u4e9b\u6b65\u9aa4\u5e76\u9488\u5bf9\u60a8\u7684\u7279\u5b9a\u60c5\u51b5\u8fdb\u884c\u8c03\u6574\u975e\u5e38\u91cd\u8981\u3002\u611f\u8c22\u60a8\u7684\u9605\u8bfb\uff0c\u5e0c\u671b\u60a8\u53ef\u4ee5\u6210\u529f\u642d\u5efa\u81ea\u5df1\u7684GitLab\u751f\u4ea7\u73af\u5883\uff0c\u795d\u60a8\u5de5\u4f5c\u987a\u5229\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8be6\u89e3gitlab\u751f\u4ea7\u73af\u5883\u7684\u642d\u5efa\u65b9\u6cd5\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>\u4e00\u3001\u5f15\u8a00 \u5728\u5f53\u4eca\u8f6f\u4ef6\u5f00\u53d1\u884c\u4e1a\u4e2d\uff0cGit\u4f5c\u4e3a\u7248\u672c\u63a7\u5236\u5de5\u5177\u5df2\u7ecf\u6210\u4e3a\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002GitLab\u5219\u662f\u5728Git\u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u670d\u52a1\u3002GitLab\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u3001\u5408\u4f5c\u548c\u90e8\u7f72\u3002 \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u642d\u5efaGitLab\u7684\u751f\u4ea7\u73af\u5883\uff0c\u5e2e\u52a9\u5f00\u53d1\u56e2\u961f\u66f4\u597d\u5730\u5229\u7528GitLab\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u3002\u672c\u6587\u5c06\u57fa\u4e8eUbuntu 18.04 LTS\u7248\u672c\uff0c\u8be6\u7ec6\u8bf4\u660eGitLab\u7684\u5b89\u88c5\u3001\u914d\u7f6e\u548c\u8fd0\u884c\u3002 \u4e8c\u3001\u5b89\u88c5GitLab \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879 GitLab\u5728Ubuntu 18.04 LTS\u7684\u5b89\u88c5\u9700\u8981\u8bb8\u591a\u4f9d\u8d56\u9879\u3002\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86EPEL\u548c\u76f8\u5173\u7684\u4f9d\u8d56\u9879\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a sudo apt-get update sudo apt-get install -y curl openssh-server ca-certificates postfix \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab\u7684\u5305 \u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u6dfb\u52a0GitLab\u5b98\u65b9\u7684\u8f6f\u4ef6\u5305\u3002\u4e3a\u6b64\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.deb.sh | sudo bash \u767b\u5f55\u540e\u590d\u5236 \u8be5\u547d\u4ee4\u5c06\u4e0b\u8f7d\u811a\u672c\u5e76\u5b89\u88c5GitLab\u7684\u8f6f\u4ef6\u5305\u3002 \u5b89\u88c5GitLab \u5b8c\u6210\u4e0b\u8f7d\u548c\u5b89\u88c5\u5305\u4e4b\u540e\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u5b89\u88c5GitLab\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo EXTERNAL_URL=&#8221;http:\/\/gitlab.example.com&#8221; apt-get install gitlab-ee \u767b\u5f55\u540e\u590d\u5236 \u8bf7\u6ce8\u610f\uff0c\u8fd9\u91cc\u5fc5\u987b\u66ff\u6362\u201chttp:\/\/gitlab.example.com\u201d\u4e3a\u60a8\u81ea\u5df1\u7684GitLab\u670d\u52a1\u5668\u7684URL\u3002 \u542f\u52a8GitLab \u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8GitLab\uff1a sudo gitlab-ctl reconfigure \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u8fd0\u884c\u6b64\u547d\u4ee4\u65f6\uff0cGitLab\u5c06\u81ea\u52a8\u542f\u52a8\u5e76\u914d\u7f6e\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5GitLab\u7684\u72b6\u6001\uff1a sudo gitlab-ctl status \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u6240\u6709\u7ec4\u4ef6\u90fd\u5df2\u542f\u52a8\uff0c\u5219\u4f1a\u8f93\u51faOK\u3002 \u4e09\u3001\u914d\u7f6eGitLab \u8fdb\u884c\u57fa\u672c\u8bbe\u7f6e [&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-19203","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19203","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=19203"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19203\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}