{"id":19304,"date":"2024-11-19T17:33:55","date_gmt":"2024-11-19T09:33:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19304\/"},"modified":"2024-11-19T17:33:55","modified_gmt":"2024-11-19T09:33:55","slug":"centos%e4%b8%8a%e6%80%8e%e4%b9%88%e4%b8%80%e9%94%ae%e5%ae%89%e8%a3%85gitlab%ef%bc%9f%e6%96%b9%e6%b3%95%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19304\/","title":{"rendered":"centos\u4e0a\u600e\u4e48\u4e00\u952e\u5b89\u88c5gitlab\uff1f\u65b9\u6cd5\u4ecb\u7ecd"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u4e2aweb\u754c\u9762\u7684git\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5c06git\u4ed3\u5e93\u3001\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001ci\/cd\u3001wiki\u3001\u6784\u5efa\u548c\u6d4b\u8bd5\u7b49\u529f\u80fd\u96c6\u6210\u5728\u4e00\u4e2a\u5e73\u53f0\u4e0a\u3002\u5b83\u652f\u6301\u591a\u4e2a\u9879\u76ee\u7684\u7ba1\u7406\uff0c\u5177\u6709\u5f3a\u5927\u7684\u5206\u652f\u548c\u5408\u5e76\u529f\u80fd\uff0c\u8fd8\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684api\u63a5\u53e3\uff0c\u4ee5\u4f9b\u5176\u4ed6\u5de5\u5177\u6216\u9879\u76ee\u96c6\u6210\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728centos\u4e0a\u4f7f\u7528\u4e00\u952e\u811a\u672c\u8fdb\u884cgitlab\u7684\u5b89\u88c5\u3002<\/p>\n<p>\u4e00\u3001\u5b89\u88c5\u524d\u51c6\u5907<\/p>\n<p>\u5728\u5f00\u59cb\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u4ee5\u53ca\u8bbe\u7f6e\u6b63\u786e\u7684\u65f6\u533a\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>yum -y install curl policycoreutils openssh-server openssh-clients\nsystemctl enable sshd\nsystemctl start sshd\nfirewall-cmd --permanent --add-service=http --add-service=https\nsystemctl reload firewalld\nyum -y install postfix\nsystemctl enable postfix\nsystemctl start postfix\ntimedatectl set-timezone Asia\/Shanghai<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e8c\u3001\u5b89\u88c5GitLab<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u811a\u672c\u6765\u5b89\u88c5GitLab\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.rpm.sh | sudo bash\nsudo EXTERNAL_URL=\"http:\/\/gitlab.example.com\" yum install -y gitlab-ee<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u7684\u547d\u4ee4\u5c06\u4eceGitLab\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u5b89\u88c5\u5305\u5c06\u81ea\u52a8\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u8f6f\u4ef6\u6e90\u4e2d\u3002\u8fd9\u91cc\u7684EXTERNAL_URL\u53d8\u91cf\u6307\u5b9a\u4e86GitLab\u7684\u8bbf\u95eeURL\u5730\u5740\uff0c\u8fd9\u4e2a\u53d8\u91cf\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8bbe\u7f6e\u3002<\/p>\n<p>\u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0cGitLab\u5c06\u4f1a\u81ea\u52a8\u542f\u52a8\uff0c\u5e76\u76d1\u542c\u5728HTTP\u548cHTTPS\u534f\u8bae\u7684\u7aef\u53e3\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bGitLab\u7684\u72b6\u6001\uff1a<\/p>\n<pre>sudo gitlab-ctl status<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u72b6\u6001\u6b63\u5e38\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u6307\u5b9a\u7684URL\u5730\u5740\uff08\u5982http:\/\/gitlab.example.com\uff09\u6765\u8bbf\u95eeGitLab\u3002<\/p>\n<p>\u4e09\u3001\u5e38\u89c1\u95ee\u9898<\/p>\n<ol>\n<li>\u5982\u4f55\u4fee\u6539GitLab\u7684\u76d1\u542c\u7aef\u53e3\uff1f<\/li>\n<\/ol>\n<p>\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cGitLab\u4f1a\u76d1\u542c\u5728HTTP\u548cHTTPS\u534f\u8bae\u7684\u7aef\u53e3\u4e0a\uff0c\u5206\u522b\u4e3a80\u548c443\u3002\u5982\u679c\u6211\u4eec\u9700\u8981\u4fee\u6539\u76d1\u542c\u7aef\u53e3\uff0c\u53ef\u4ee5\u5728\/etc\/gitlab\/gitlab.rb\u6587\u4ef6\u4e2d\u8fdb\u884c\u4fee\u6539\u3002\u4f8b\u5982\uff0c\u5c06HTTP\u7aef\u53e3\u53f7\u4fee\u6539\u4e3a8080\uff1a<\/p>\n<pre>external_url \"http:\/\/gitlab.example.com:8080\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4fee\u6539\u5b8c\u6bd5\u540e\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u914d\u7f6e\u751f\u6548\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5982\u4f55\u4fee\u6539GitLab\u7684\u6570\u636e\u5b58\u50a8\u8def\u5f84\uff1f<\/li>\n<\/ol>\n<p>\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cGitLab\u7684\u6570\u636e\u5b58\u50a8\u8def\u5f84\u4e3a\/var\/opt\/gitlab\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u4fee\u6539\u6570\u636e\u5b58\u50a8\u8def\u5f84\uff0c\u53ef\u4ee5\u5728\/etc\/gitlab\/gitlab.rb\u6587\u4ef6\u4e2d\u8fdb\u884c\u4fee\u6539\u3002\u4f8b\u5982\uff0c\u5c06\u6570\u636e\u5b58\u50a8\u8def\u5f84\u4fee\u6539\u4e3a\/opt\/gitlab\uff1a<\/p>\n<pre>git_data_dir \"\/opt\/gitlab\/git-data\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4fee\u6539\u5b8c\u6bd5\u540e\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u914d\u7f6e\u751f\u6548\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>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230CentOS\u4e0a\u5b89\u88c5GitLab\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u4e00\u884c\u811a\u672c\u548c\u51e0\u4e2a\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u3002GitLab\u5177\u6709\u5f3a\u5927\u7684\u4ee3\u7801\u7ba1\u7406\u548c\u9879\u76ee\u7ba1\u7406\u529f\u80fd\uff0c\u80fd\u591f\u5e2e\u52a9\u5f00\u53d1\u8005\u63d0\u9ad8\u6548\u7387\uff0c\u51cf\u5c11\u9519\u8bef\u3002\u540c\u65f6\uff0cGitLab\u4e5f\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684API\u63a5\u53e3\u548c\u63d2\u4ef6\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4e0e\u5176\u4ed6\u9879\u76ee\u6216\u5de5\u5177\u8fdb\u884c\u96c6\u6210\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u52a0\u9ad8\u6548\u7684\u5f00\u53d1\u6d41\u7a0b\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fcentos\u4e0a\u600e\u4e48\u4e00\u952e\u5b89\u88c5gitlab\uff1f\u65b9\u6cd5\u4ecb\u7ecd\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>gitlab\u662f\u4e00\u4e2aweb\u754c\u9762\u7684git\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5c06git\u4ed3\u5e93\u3001\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001ci\/cd\u3001wiki\u3001\u6784\u5efa\u548c\u6d4b\u8bd5\u7b49\u529f\u80fd\u96c6\u6210\u5728\u4e00\u4e2a\u5e73\u53f0\u4e0a\u3002\u5b83\u652f\u6301\u591a\u4e2a\u9879\u76ee\u7684\u7ba1\u7406\uff0c\u5177\u6709\u5f3a\u5927\u7684\u5206\u652f\u548c\u5408\u5e76\u529f\u80fd\uff0c\u8fd8\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684api\u63a5\u53e3\uff0c\u4ee5\u4f9b\u5176\u4ed6\u5de5\u5177\u6216\u9879\u76ee\u96c6\u6210\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728centos\u4e0a\u4f7f\u7528\u4e00\u952e\u811a\u672c\u8fdb\u884cgitlab\u7684\u5b89\u88c5\u3002 \u4e00\u3001\u5b89\u88c5\u524d\u51c6\u5907 \u5728\u5f00\u59cb\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u4ee5\u53ca\u8bbe\u7f6e\u6b63\u786e\u7684\u65f6\u533a\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a yum -y install curl policycoreutils openssh-server openssh-clients systemctl enable sshd systemctl start sshd firewall-cmd &#8211;permanent &#8211;add-service=http &#8211;add-service=https systemctl reload firewalld yum -y install postfix systemctl enable postfix systemctl start postfix timedatectl set-timezone Asia\/Shanghai \u767b\u5f55\u540e\u590d\u5236 \u4e8c\u3001\u5b89\u88c5GitLab \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u811a\u672c\u6765\u5b89\u88c5GitLab\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.rpm.sh | sudo bash sudo EXTERNAL_URL=&#8221;http:\/\/gitlab.example.com&#8221; yum install -y gitlab-ee \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u7684\u547d\u4ee4\u5c06\u4eceGitLab\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u5b89\u88c5\u5305\u5c06\u81ea\u52a8\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u8f6f\u4ef6\u6e90\u4e2d\u3002\u8fd9\u91cc\u7684EXTERNAL_URL\u53d8\u91cf\u6307\u5b9a\u4e86GitLab\u7684\u8bbf\u95eeURL\u5730\u5740\uff0c\u8fd9\u4e2a\u53d8\u91cf\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8bbe\u7f6e\u3002 \u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0cGitLab\u5c06\u4f1a\u81ea\u52a8\u542f\u52a8\uff0c\u5e76\u76d1\u542c\u5728HTTP\u548cHTTPS\u534f\u8bae\u7684\u7aef\u53e3\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bGitLab\u7684\u72b6\u6001\uff1a sudo gitlab-ctl [&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-19304","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19304","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=19304"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19304\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}