{"id":19026,"date":"2024-11-19T11:55:13","date_gmt":"2024-11-19T03:55:13","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19026\/"},"modified":"2024-11-19T11:55:13","modified_gmt":"2024-11-19T03:55:13","slug":"%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%aegitlab%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19026\/","title":{"rendered":"\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eGitLab\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u4e00\u3001\u7b80\u4ecb<\/p>\n<p>GitLab\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u63d0\u4f9b\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001CI\/CD\u7b49\u529f\u80fd\uff0c\u88ab\u5e7f\u6cdb\u7528\u4e8e\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u4e3a\u4e86\u66f4\u597d\u5730\u7ba1\u7406\u4ee3\u7801\uff0c\u5f88\u591a\u516c\u53f8\u9009\u62e9\u81ea\u5efaGitLab\u670d\u52a1\u5668\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eGitLab\u670d\u52a1\u5668\u3002<\/p>\n<p>\u4e8c\u3001\u73af\u5883\u51c6\u5907<\/p>\n<p>\u5728\u5f00\u59cb\u5b89\u88c5\u4e4b\u524d\uff0c\u9700\u8981\u51c6\u5907\u4ee5\u4e0b\u73af\u5883\uff1a<\/p>\n<ol>\n<li>Linux\u670d\u52a1\u5668<\/li>\n<li>\u914d\u59074GB\u4ee5\u4e0a\u5185\u5b58\u548c100GB\u4ee5\u4e0a\u78c1\u76d8\u7a7a\u95f4\u7684\u670d\u52a1\u5668<\/li>\n<li>\u5177\u5907sudo\u6743\u9650\u7684\u7528\u6237\u8d26\u53f7<\/li>\n<li>\u5e26\u6709\u56fa\u5b9aIP\u5730\u5740\u6216\u8005\u7ed1\u5b9a\u4e86\u57df\u540d\u7684\u670d\u52a1\u5668<\/li>\n<li>\u5f00\u653e\u4e8680\u548c443\u7aef\u53e3\u7684\u670d\u52a1\u5668<\/li>\n<\/ol>\n<p>\u4e09\u3001\u5b89\u88c5<\/p>\n<ol>\n<li>\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u5305<\/li>\n<\/ol>\n<p>\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u5305\uff1a<\/p>\n<pre>sudo apt-get install curl openssh-server ca-certificates postfix<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u8ba9\u4f60\u914d\u7f6ePostfix\uff0c\u9009\u62e9Internet Site\u5373\u53ef\u3002<\/p>\n<ol>\n<li>\u6dfb\u52a0GitLab\u4ed3\u5e93\u5e76\u5b89\u88c5<\/li>\n<\/ol>\n<p>\u6dfb\u52a0GitLab\u5b98\u65b9\u4ed3\u5e93\u5230Ubuntu\u7684\u5b58\u50a8\u5e93\u4e2d\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5GitLab\uff1a<\/p>\n<pre>sudo apt-get install gitlab-ce<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/li>\n<\/ol>\n<p>\u4fee\u6539\/etc\/gitlab\/gitlab.rb\u6587\u4ef6\uff0c\u5c06external_url\u8bbe\u7f6e\u4e3a\u4f60\u7684IP\u5730\u5740\u6216\u8005\u57df\u540d\uff1a<\/p>\n<pre>external_url 'http:\/\/gitlab.example.com'<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u542f\u52a8GitLab<\/li>\n<\/ol>\n<p>\u542f\u52a8GitLab\u5e76\u4f7f\u5176\u5f00\u673a\u81ea\u542f\u52a8\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure\nsudo gitlab-ctl start<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u73b0\u5728\uff0cGitLab\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u548c\u542f\u52a8\u4e86\u3002<\/p>\n<p>\u56db\u3001\u914d\u7f6e<\/p>\n<p>\u73b0\u5728\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u548c\u542f\u52a8GitLab\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002<\/p>\n<ol>\n<li>\u4fee\u6539\u7ba1\u7406\u5458\u5bc6\u7801<\/li>\n<\/ol>\n<p>\u521d\u59cb\u7ba1\u7406\u5458\u8d26\u53f7\u4e3aroot\uff0c\u9700\u8981\u4fee\u6539\u5bc6\u7801\uff1a<\/p>\n<p>\u8fdb\u5165GitLab\u7f51\u7ad9\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u5934\u50cf\uff0c\u9009\u62e9\u201cSettings\u201d\u3002<\/p>\n<p>\u70b9\u51fb\u5de6\u4fa7\u680f\u7684\u201cAccount\u201d\uff0c\u7136\u540e\u5728\u4e0b\u65b9\u4fee\u6539\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u521b\u5efa\u65b0\u7528\u6237<\/li>\n<\/ol>\n<p>\u5728\u201cSettings\u201d\u9875\u9762\u7684\u201cMembers\u201d\u9009\u9879\u5361\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u65b0\u7528\u6237\u5e76\u4e3a\u5176\u6388\u6743\u3002<\/p>\n<p>\u70b9\u51fb\u201cInvite\u201d\u6309\u94ae\uff0c\u8f93\u5165\u65b0\u7528\u6237\u7684\u90ae\u4ef6\u5730\u5740\uff0c\u8fd9\u4e2a\u7528\u6237\u4f1a\u6536\u5230\u4e00\u5c01\u90ae\u4ef6\uff0c\u70b9\u51fb\u94fe\u63a5\u540e\u5c31\u53ef\u4ee5\u52a0\u5165\u4f60\u7684GitLab\u9879\u76ee\u4e86\u3002<\/p>\n<ol>\n<li>\u521b\u5efa\u9879\u76ee<\/li>\n<\/ol>\n<p>\u5728GitLab\u7684\u4e3b\u9875\u4e0a\uff0c\u53ef\u4ee5\u521b\u5efa\u65b0\u9879\u76ee\u3002<\/p>\n<p>\u70b9\u51fb\u4e3b\u9875\u4e0a\u7684\u201cNew Project\u201d\u6309\u94ae\uff0c\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u8f93\u5165\u9879\u76ee\u540d\u79f0\u3001\u63cf\u8ff0\u7b49\u4fe1\u606f\uff0c\u7136\u540e\u70b9\u51fb\u201cCreate Project\u201d\u6309\u94ae\u5373\u53ef\u3002<\/p>\n<p>\u56db\u3001\u603b\u7ed3<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3001\u914d\u7f6e\u548c\u4f7f\u7528\u4e86GitLab\u3002\u9664\u6b64\u4e4b\u5916\uff0cGitLab\u8fd8\u63d0\u4f9b\u8bf8\u5982CI\/CD\u3001\u95ee\u9898\u8ddf\u8e2a\u7b49\u529f\u80fd\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u914d\u7f6e\u3002\u4e0d\u8fc7\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cGitLab\u8fd0\u884c\u7684\u786c\u4ef6\u914d\u7f6e\u8981\u8db3\u591f\u5f3a\u5927\uff0c\u5426\u5219\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eGitLab\u670d\u52a1\u5668\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\u7b80\u4ecb GitLab\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u63d0\u4f9b\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001CI\/CD\u7b49\u529f\u80fd\uff0c\u88ab\u5e7f\u6cdb\u7528\u4e8e\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u4e3a\u4e86\u66f4\u597d\u5730\u7ba1\u7406\u4ee3\u7801\uff0c\u5f88\u591a\u516c\u53f8\u9009\u62e9\u81ea\u5efaGitLab\u670d\u52a1\u5668\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6eGitLab\u670d\u52a1\u5668\u3002 \u4e8c\u3001\u73af\u5883\u51c6\u5907 \u5728\u5f00\u59cb\u5b89\u88c5\u4e4b\u524d\uff0c\u9700\u8981\u51c6\u5907\u4ee5\u4e0b\u73af\u5883\uff1a Linux\u670d\u52a1\u5668 \u914d\u59074GB\u4ee5\u4e0a\u5185\u5b58\u548c100GB\u4ee5\u4e0a\u78c1\u76d8\u7a7a\u95f4\u7684\u670d\u52a1\u5668 \u5177\u5907sudo\u6743\u9650\u7684\u7528\u6237\u8d26\u53f7 \u5e26\u6709\u56fa\u5b9aIP\u5730\u5740\u6216\u8005\u7ed1\u5b9a\u4e86\u57df\u540d\u7684\u670d\u52a1\u5668 \u5f00\u653e\u4e8680\u548c443\u7aef\u53e3\u7684\u670d\u52a1\u5668 \u4e09\u3001\u5b89\u88c5 \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u5305 \u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u5305\uff1a sudo apt-get install curl openssh-server ca-certificates postfix \u767b\u5f55\u540e\u590d\u5236 \u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u8ba9\u4f60\u914d\u7f6ePostfix\uff0c\u9009\u62e9Internet Site\u5373\u53ef\u3002 \u6dfb\u52a0GitLab\u4ed3\u5e93\u5e76\u5b89\u88c5 \u6dfb\u52a0GitLab\u5b98\u65b9\u4ed3\u5e93\u5230Ubuntu\u7684\u5b58\u50a8\u5e93\u4e2d\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab\uff1a sudo apt-get install gitlab-ce \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u914d\u7f6e\u6587\u4ef6 \u4fee\u6539\/etc\/gitlab\/gitlab.rb\u6587\u4ef6\uff0c\u5c06external_url\u8bbe\u7f6e\u4e3a\u4f60\u7684IP\u5730\u5740\u6216\u8005\u57df\u540d\uff1a external_url &#8216;http:\/\/gitlab.example.com&#8217; \u767b\u5f55\u540e\u590d\u5236 \u542f\u52a8GitLab \u542f\u52a8GitLab\u5e76\u4f7f\u5176\u5f00\u673a\u81ea\u542f\u52a8\uff1a sudo gitlab-ctl reconfigure sudo gitlab-ctl start \u767b\u5f55\u540e\u590d\u5236 \u73b0\u5728\uff0cGitLab\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u548c\u542f\u52a8\u4e86\u3002 \u56db\u3001\u914d\u7f6e \u73b0\u5728\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u548c\u542f\u52a8GitLab\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\u3002 \u4fee\u6539\u7ba1\u7406\u5458\u5bc6\u7801 \u521d\u59cb\u7ba1\u7406\u5458\u8d26\u53f7\u4e3aroot\uff0c\u9700\u8981\u4fee\u6539\u5bc6\u7801\uff1a [&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-19026","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19026","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=19026"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19026\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}