{"id":43474,"date":"2024-10-05T18:36:33","date_gmt":"2024-10-05T10:36:33","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43474\/"},"modified":"2024-10-05T18:36:33","modified_gmt":"2024-10-05T10:36:33","slug":"centos-%e5%ae%89%e8%a3%9d-gitlab-%e9%81%87%e5%88%b0%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43474\/","title":{"rendered":"CentOS \u5b89\u88dd GitLab \u9047\u5230\u554f\u984c\u53ca\u89e3\u6c7a"},"content":{"rendered":"<h1 id=\"centos-%e5%ae%89%e8%a3%9d-gitlab-%e9%81%87%e5%88%b0%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba-iiKSwsVxGk\">CentOS \u5b89\u88dd GitLab \u9047\u5230\u554f\u984c\u53ca\u89e3\u6c7a<\/h1>\n<p>GitLab \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u7528\u65bc\u8edf\u4ef6\u958b\u767c\u548c\u9805\u76ee\u7ba1\u7406\u3002\u5c0d\u65bc\u8a31\u591a\u958b\u767c\u8005\u4f86\u8aaa\uff0c\u5c07 GitLab \u5b89\u88dd\u5728 CentOS \u7cfb\u7d71\u4e0a\u662f\u4e00\u500b\u5e38\u898b\u7684\u9700\u6c42\u3002\u7136\u800c\uff0c\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u4f7f\u7528\u8005\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u554f\u984c\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5728 CentOS \u4e0a\u5b89\u88dd GitLab \u6642\u53ef\u80fd\u9047\u5230\u7684\u554f\u984c\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e5%89%8d%e7%9a%84%e6%ba%96%e5%82%99-iiKSwsVxGk\">\u5b89\u88dd\u524d\u7684\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd GitLab \u4e4b\u524d\uff0c\u78ba\u4fdd\u60a8\u7684 CentOS \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff0c\u4f8b\u5982 curl \u548c policycoreutils\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo yum install curl policycoreutils -y<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-gitlab-iiKSwsVxGk\">\u5b89\u88dd GitLab<\/h2>\n<p>\u5b89\u88dd GitLab \u7684\u7b2c\u4e00\u6b65\u662f\u6dfb\u52a0 GitLab \u7684\u5b98\u65b9\u5b58\u5132\u5eab\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6dfb\u52a0\u5b58\u5132\u5eab\uff1a<\/p>\n<pre><code>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.rpm.sh | sudo bash<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd GitLab\uff1a<\/p>\n<pre><code>sudo EXTERNAL_URL=\"http:\/\/gitlab.example.com\" yum install gitlab-ee -y<\/code><\/pre>\n<p>\u8acb\u5c07 &#8220;http:\/\/gitlab.example.com&#8221; \u66ff\u63db\u70ba\u60a8\u7684\u5be6\u969b\u57df\u540d\u6216 IP \u5730\u5740\u3002<\/p>\n<h2 id=\"%e5%b8%b8%e8%a6%8b%e5%95%8f%e9%a1%8c%e5%8f%8a%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-iiKSwsVxGk\">\u5e38\u898b\u554f\u984c\u53ca\u89e3\u6c7a\u65b9\u6848<\/h2>\n<h3 id=\"1-%e5%ae%89%e8%a3%9d%e9%81%8e%e7%a8%8b%e4%b8%ad%e5%87%ba%e7%8f%be%e4%be%9d%e8%b3%b4%e9%8c%af%e8%aa%a4-iiKSwsVxGk\">1. \u5b89\u88dd\u904e\u7a0b\u4e2d\u51fa\u73fe\u4f9d\u8cf4\u932f\u8aa4<\/h3>\n<p>\u5728\u5b89\u88dd GitLab \u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u4f9d\u8cf4\u932f\u8aa4\u3002\u9019\u901a\u5e38\u662f\u56e0\u70ba\u67d0\u4e9b\u5fc5\u8981\u7684\u5305\u672a\u5b89\u88dd\u6216\u7248\u672c\u4e0d\u517c\u5bb9\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7f3a\u5c11\u7684\u4f9d\u8cf4\uff1a<\/p>\n<pre><code>sudo yum check<\/code><\/pre>\n<p>\u6839\u64da\u6aa2\u67e5\u7d50\u679c\uff0c\u624b\u52d5\u5b89\u88dd\u7f3a\u5c11\u7684\u4f9d\u8cf4\u5305\uff0c\u7136\u5f8c\u91cd\u65b0\u904b\u884c\u5b89\u88dd\u547d\u4ee4\u3002<\/p>\n<h3 id=\"2-gitlab-%e6%9c%8d%e5%8b%99%e7%84%a1%e6%b3%95%e5%95%9f%e5%8b%95-iiKSwsVxGk\">2. GitLab \u670d\u52d9\u7121\u6cd5\u555f\u52d5<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u555f\u52d5 GitLab \u670d\u52d9\u3002\u5982\u679c\u670d\u52d9\u7121\u6cd5\u555f\u52d5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u670d\u52d9\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo gitlab-ctl status<\/code><\/pre>\n<p>\u5982\u679c\u670d\u52d9\u672a\u904b\u884c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo gitlab-ctl start<\/code><\/pre>\n<p>\u5982\u679c\u4ecd\u7136\u7121\u6cd5\u555f\u52d5\uff0c\u6aa2\u67e5\u65e5\u8a8c\u6587\u4ef6\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\uff1a<\/p>\n<pre><code>sudo less \/var\/log\/gitlab\/gitlab-rails\/production.log<\/code><\/pre>\n<h3 id=\"3-%e7%b6%b2%e9%a0%81%e7%84%a1%e6%b3%95%e8%a8%aa%e5%95%8f-iiKSwsVxGk\">3. \u7db2\u9801\u7121\u6cd5\u8a2a\u554f<\/h3>\n<p>\u5982\u679c\u60a8\u5728\u5b89\u88dd\u5f8c\u7121\u6cd5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f GitLab\uff0c\u8acb\u6aa2\u67e5\u9632\u706b\u7246\u8a2d\u7f6e\u3002\u78ba\u4fdd HTTP \u548c HTTPS \u7aef\u53e3\uff08\u901a\u5e38\u662f 80 \u548c 443\uff09\u5df2\u7d93\u958b\u653e\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u9632\u706b\u7246\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo firewall-cmd --list-all<\/code><\/pre>\n<p>\u5982\u679c\u9700\u8981\u958b\u653e\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo firewall-cmd --add-service=http --permanent<\/code><\/pre>\n<pre><code>sudo firewall-cmd --add-service=https --permanent<\/code><\/pre>\n<pre><code>sudo firewall-cmd --reload<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-iiKSwsVxGk\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS \u4e0a\u5b89\u88dd GitLab \u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u6311\u6230\uff0c\u4f46\u901a\u904e\u6b63\u78ba\u7684\u6b65\u9a5f\u548c\u89e3\u6c7a\u65b9\u6848\uff0c\u9019\u4e9b\u554f\u984c\u901a\u5e38\u90fd\u80fd\u5f97\u5230\u89e3\u6c7a\u3002\u7121\u8ad6\u662f\u4f9d\u8cf4\u932f\u8aa4\u3001\u670d\u52d9\u555f\u52d5\u554f\u984c\u9084\u662f\u7db2\u9801\u8a2a\u554f\u56f0\u96e3\uff0c\u4e86\u89e3\u5982\u4f55\u6392\u67e5\u548c\u89e3\u6c7a\u9019\u4e9b\u554f\u984c\u5c07\u6709\u52a9\u65bc\u60a8\u9806\u5229\u904b\u884c GitLab\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u90e8\u7f72 GitLab\uff0c\u8acb\u8003\u616e\u9078\u64c7\u5408\u9069\u7684\u670d\u52d9\u63d0\u4f9b\u5546\u4ee5\u7372\u5f97\u6700\u4f73\u6027\u80fd\u548c\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u6c7a\u5728 CentOS \u4e0a\u5b89\u88dd GitLab \u9047\u5230\u7684\u5e38\u898b\u554f\u984c\uff0c\u63d0\u4f9b\u8a73\u7d30\u6b65\u9a5f\u548c\u6709\u6548\u89e3\u6c7a\u65b9\u6848\uff0c\u52a9\u4f60\u9806\u5229\u90e8\u7f72\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43474","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43474"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43474\/revisions"}],"predecessor-version":[{"id":43475,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43474\/revisions\/43475"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}