{"id":19029,"date":"2024-11-19T12:41:22","date_gmt":"2024-11-19T04:41:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19029\/"},"modified":"2024-11-19T12:41:22","modified_gmt":"2024-11-19T04:41:22","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8centos%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19029\/","title":{"rendered":"\u5982\u4f55\u5728CentOS\u5b89\u88c5GitLab"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u4e2a\u7528\u4e8e\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\u7684\u5f00\u6e90\u5e73\u53f0\u3002\u5b83\u63d0\u4f9b\u4e86\u6e90\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001ci\/cd\u7b49\u4e00\u7cfb\u5217\u529f\u80fd\uff0c\u4f7f\u56e2\u961f\u534f\u4f5c\u66f4\u52a0\u9ad8\u6548\u3002\u5f53\u524d\u6700\u65b0\u7248\u672c\u4e3agitlab 13.x\uff0c\u672c\u7bc7\u6587\u7ae0\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728centos\u5b89\u88c5gitlab\u3002<\/p>\n<p>\u5b89\u88c5GitLab\u7684\u524d\u7f6e\u6761\u4ef6\uff1a<\/p>\n<p>1.\u4f60\u9700\u8981\u4e00\u53f0\u8fd0\u884cCentOS\u7684\u670d\u52a1\u5668\uff08\u5efa\u8bae\u4f7f\u7528CentOS 7\u6216\u66f4\u9ad8\u7248\u672c,64\u4f4d\uff09<\/p>\n<p>2.\u786e\u4fdd\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86curl<\/p>\n<p>3.\u786e\u4fdd\u670d\u52a1\u5668\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86\u53ef\u4ee5\u8fd0\u884cGitLab\u7684\u5fc5\u8981\u8f6f\u4ef6\u5305\u548c\u4f9d\u8d56\u9879<\/p>\n<p>\u4ee5\u4e0b\u662f\u5728CentOS\u4e0a\u5b89\u88c5GitLab\u7684\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u548c\u8f6f\u4ef6\u5305<\/li>\n<\/ol>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5728\u4f60\u7684CentOS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u548c\u8f6f\u4ef6\u5305\uff1a<\/p>\n<pre>sudo yum install -y curl policycoreutils-python openssh-server\nsudo systemctl enable sshd\nsudo systemctl start sshd\nsudo firewall-cmd --permanent --add-service=http\nsudo systemctl reload firewalld<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5gitlab\u7684\u4ed3\u5e93<\/li>\n<\/ol>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u5e76\u5b89\u88c5GitLab \u4ed3\u5e93\uff1a<\/p>\n<pre>curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5GitLab CE<\/li>\n<\/ol>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5GitLab CE\uff1a<\/p>\n<pre>sudo EXTERNAL_URL=\"http:\/\/gitlab.example.com\" yum install -y gitlab-ce<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>*\u8bf4\u660e\uff1a\u8bf7\u6ce8\u610f\u7528\u5b9e\u9645\u7684URL\u66ff\u6362http:\/\/gitlab.example.com<\/p>\n<ol>\n<li>\u542f\u52a8GitLab CE<\/li>\n<\/ol>\n<p>\u5b89\u88c5\u6210\u529f\u540e\uff0c\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<ol>\n<li>\u8bbe\u7f6eroot\u5bc6\u7801<\/li>\n<\/ol>\n<p>GitLab\u9875\u9762\u4e0a\u5c06\u8981\u6c42\u60a8\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u5730\u5740\u8bbf\u95eeGitLab\uff1a<\/p>\n<p>http:\/\/Your_Server_IP_or_Hostname<\/p>\n<ol>\n<li>\u8fdb\u884cDocker\u5b89\u88c5\uff08\u5982\u9700\u8981\uff09<\/li>\n<\/ol>\n<p>\u5982\u679c\u4f60\u7684GitLab\u9700\u8981\u4f7f\u7528Docker\u529f\u80fd\uff0c\u53ef\u4ee5\u4f9d\u6b21\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5docker\uff1a<\/p>\n<pre>sudo yum install -y yum-utils device-mapper-persistent-data lvm2\nsudo yum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo\nsudo yum install docker-ce docker-ce-cli containerd.io\nsudo systemctl start docker\nsudo systemctl enable docker<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>7.\u5b8c\u6210<\/p>\n<p>\u81f3\u6b64\uff0c\u4f60\u5df2\u7ecf\u5728CentOS\u4e0a\u6210\u529f\u5730\u5b89\u88c5\u4e86GitLab\u3002\u73b0\u5728\u53ef\u4ee5\u901a\u8fc7GitLab\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\uff0c\u63d0\u9ad8\u56e2\u961f\u7684\u6548\u7387\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728CentOS\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>gitlab\u662f\u4e00\u4e2a\u7528\u4e8e\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\u7684\u5f00\u6e90\u5e73\u53f0\u3002\u5b83\u63d0\u4f9b\u4e86\u6e90\u4ee3\u7801\u7ba1\u7406\u3001\u95ee\u9898\u8ddf\u8e2a\u3001ci\/cd\u7b49\u4e00\u7cfb\u5217\u529f\u80fd\uff0c\u4f7f\u56e2\u961f\u534f\u4f5c\u66f4\u52a0\u9ad8\u6548\u3002\u5f53\u524d\u6700\u65b0\u7248\u672c\u4e3agitlab 13.x\uff0c\u672c\u7bc7\u6587\u7ae0\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728centos\u5b89\u88c5gitlab\u3002 \u5b89\u88c5GitLab\u7684\u524d\u7f6e\u6761\u4ef6\uff1a 1.\u4f60\u9700\u8981\u4e00\u53f0\u8fd0\u884cCentOS\u7684\u670d\u52a1\u5668\uff08\u5efa\u8bae\u4f7f\u7528CentOS 7\u6216\u66f4\u9ad8\u7248\u672c,64\u4f4d\uff09 2.\u786e\u4fdd\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86curl 3.\u786e\u4fdd\u670d\u52a1\u5668\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86\u53ef\u4ee5\u8fd0\u884cGitLab\u7684\u5fc5\u8981\u8f6f\u4ef6\u5305\u548c\u4f9d\u8d56\u9879 \u4ee5\u4e0b\u662f\u5728CentOS\u4e0a\u5b89\u88c5GitLab\u7684\u6b65\u9aa4\uff1a \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u548c\u8f6f\u4ef6\u5305 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5728\u4f60\u7684CentOS\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u548c\u8f6f\u4ef6\u5305\uff1a sudo yum install -y curl policycoreutils-python openssh-server sudo systemctl enable sshd sudo systemctl start sshd sudo firewall-cmd &#8211;permanent &#8211;add-service=http sudo systemctl reload firewalld \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5gitlab\u7684\u4ed3\u5e93 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u5e76\u5b89\u88c5GitLab \u4ed3\u5e93\uff1a curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab CE \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5GitLab CE\uff1a sudo EXTERNAL_URL=&#8221;http:\/\/gitlab.example.com&#8221; yum install -y gitlab-ce \u767b\u5f55\u540e\u590d\u5236 [&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-19029","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19029","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=19029"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19029\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}