{"id":20187,"date":"2024-11-19T12:33:48","date_gmt":"2024-11-19T04:33:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20187\/"},"modified":"2024-11-19T12:33:48","modified_gmt":"2024-11-19T04:33:48","slug":"centos%e4%b8%8bgitlab%e4%b8%80%e9%94%ae%e5%ae%89%e8%a3%85%e5%8c%85","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20187\/","title":{"rendered":"centos\u4e0bgitlab\u4e00\u952e\u5b89\u88c5\u5305"},"content":{"rendered":"<p>centos\u4e0bgitlab\u4e00\u952e\u5b89\u88c5\u5305<\/p>\n<p>GitLab\u662f\u4e00\u4e2a\u5f00\u6e90\u7684Git\u4ee3\u7801\u6258\u7ba1\u7ba1\u7406\u5e73\u53f0\uff0c\u53ef\u7528\u4e8e\u56e2\u961f\u5408\u4f5c\u3001\u4ee3\u7801\u5171\u4eab\u3001\u7248\u672c\u63a7\u5236\u7b49\u3002\u5b83\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5305\u62ecCentOS\u3002\u672c\u6587\u5c06\u4ecb\u7ecdCentOS\u4e0bGitLab\u7684\u4e00\u952e\u5b89\u88c5\u5305\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\n<p>\u4e00\u3001\u5b89\u88c5\u524d\u7684\u51c6\u5907\u5de5\u4f5c<\/p>\n<ol>\n<li>\u66f4\u65b0\u7cfb\u7edf<\/li>\n<\/ol>\n<p>\u5728\u5b89\u88c5GitLab\u524d\uff0c\u9700\u8981\u5148\u66f4\u65b0\u7cfb\u7edf\uff0c\u4ee5\u786e\u4fdd\u8f6f\u4ef6\u5305\u7248\u672c\u662f\u6700\u65b0\u7684\u3002<\/p>\n<p>sudo yum update<\/p>\n<ol>\n<li>\u5b89\u88c5\u5fc5\u8981\u8f6f\u4ef6\u5305<\/li>\n<\/ol>\n<p>\u5b89\u88c5GitLab\u9700\u8981\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u5982curl, policycoreutils-python, openssh-server\u7b49\uff0c\u53ef\u4ee5\u4f7f\u7528yum\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>sudo yum install curl policycoreutils-python openssh-server openssh-clients postfix<\/p>\n<ol>\n<li>\u542f\u52a8OpenSSH\u670d\u52a1<\/li>\n<\/ol>\n<p>GitLab\u4f7f\u7528SSH\u534f\u8bae\u6765\u8bbf\u95ee\uff0c\u9700\u8981\u542f\u52a8OpenSSH\u670d\u52a1\u3002<\/p>\n<p>sudo systemctl enable sshd<br \/>sudo systemctl start sshd<\/p>\n<ol>\n<li>\u5173\u95ed\u9632\u706b\u5899\u548cSELinux (\u53ef\u9009\uff09<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u8ba9GitLab\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\uff0c\u53ef\u4ee5\u5173\u95ed\u9632\u706b\u5899\u548cSELinux\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u5173\u95ed\u540e\u4f1a\u5bfc\u81f4\u670d\u52a1\u5668\u7684\u5b89\u5168\u6027\u964d\u4f4e\uff0c\u5efa\u8bae\u5728\u5b89\u88c5\u540e\u518d\u8fdb\u884c\u5f00\u542f\u3002<\/p>\n<p>sudo systemctl disable firewalld<br \/>sudo systemctl stop firewalld<br \/>sudo setenforce 0<br \/>sudo sed -i &#8216;s\/SELINUX=enforcing\/SELINUX=disabled\/g&#8217; \/etc\/selinux\/config<\/p>\n<p>\u4e8c\u3001\u4e0b\u8f7dGitLab\u5b89\u88c5\u5305<\/p>\n<p>\u4eceGitLab\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u9009\u62e9\u4e0e\u4f60\u7684CentOS\u7248\u672c\u548c\u67b6\u6784\u5bf9\u5e94\u7684\u5b89\u88c5\u5305\u3002<\/p>\n<p>sudo curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash<br \/>sudo yum install gitlab-ce<\/p>\n<p>\u5b89\u88c5\u8fc7\u7a0b\u53ef\u80fd\u4f1a\u9700\u8981\u51e0\u5206\u949f\u7684\u65f6\u95f4\uff0c\u7cfb\u7edf\u4f1a\u4ece\u7f51\u7edc\u4e2d\u4e0b\u8f7d\u6240\u9700\u8f6f\u4ef6\u5305\u5e76\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>\u4e09\u3001\u914d\u7f6eGitLab<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0cGitLab\u7684\u914d\u7f6e\u6587\u4ef6\u4f4d\u4e8e\/etc\/gitlab\/gitlab.rb\u3002\u5728\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u4e4b\u524d\uff0c\u53ef\u4ee5\u4f7f\u7528\u9ed8\u8ba4\u7684\u914d\u7f6e\u8fdb\u884c\u542f\u52a8\u3002<\/p>\n<p>sudo gitlab-ctl reconfigure<\/p>\n<p>\u5f53GitLab\u5df2\u7ecf\u6210\u529f\u542f\u52a8\u4e4b\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eehttp:\/\/your-ip-address\uff0c\u8fdb\u884c\u521d\u59cb\u5316\u914d\u7f6e\u3002\u5728\u521d\u59cb\u5316\u914d\u7f6e\u4e2d\uff0c\u5c06\u8981\u6c42\u4f60\u8bbe\u7f6e\u7ba1\u7406\u5458\u8d26\u6237\u5bc6\u7801\uff0c\u4ee5\u53caGitLab\u8fd0\u884c\u7684\u7aef\u53e3\u53f7\u7b49\u3002<\/p>\n<p>\u56db\u3001\u542f\u52a8GitLab<\/p>\n<p>\u521d\u59cb\u5316\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u5fc5\u987b\u91cd\u65b0\u542f\u52a8GitLab\u624d\u80fd\u751f\u6548\u3002<\/p>\n<p>sudo gitlab-ctl restart<\/p>\n<p>\u4e94\u3001\u4f7f\u7528GitLab<\/p>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165GitLab\u7684IP\u5730\u5740\u6216\u57df\u540d\u8fdb\u884c\u8bbf\u95ee\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528GitLab\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u548c\u5f00\u53d1\u4e86\u3002<\/p>\n<p>\u5728\u4f7f\u7528GitLab\u65f6\uff0c\u53ef\u4ee5\u521b\u5efa\u9879\u76ee\u3001\u4e0a\u4f20\u4ee3\u7801\u3001\u7ba1\u7406\u56e2\u961f\u6210\u5458\u3001\u4ee5\u53ca\u8bbe\u7f6e\u6743\u9650\u7b49\u3002GitLab\u8fd8\u652f\u6301Issue\u548cMerge Request\uff0c\u53ef\u7528\u4e8e\u95ee\u9898\u8ddf\u8e2a\u548c\u4ee3\u7801\u5ba1\u67e5\u3002<\/p>\n<p>\u603b\u7ed3\uff1a<\/p>\n<p>\u5728CentOS\u4e0b\u5b89\u88c5GitLab\u53ef\u4ee5\u4f7f\u7528\u4e00\u952e\u5b89\u88c5\u5305\u7684\u65b9\u5f0f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u7b80\u4fbf\uff0c\u5373\u4f7f\u6ca1\u6709\u592a\u591a\u7684Linux\u77e5\u8bc6\u4e5f\u53ef\u4ee5\u8f7b\u677e\u5b8c\u6210\u5b89\u88c5\u3002\u5728\u5b89\u88c5\u4e4b\u524d\u9700\u8981\u5347\u7ea7\u7cfb\u7edf\u3001\u5b89\u88c5\u6240\u9700\u8f6f\u4ef6\u5305\u3001\u542f\u52a8\u670d\u52a1\uff0c\u7136\u540e\u518d\u4e0b\u8f7d\u5b89\u88c5\u5305\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\u5fc5\u987b\u8fdb\u884c\u914d\u7f6e\uff0c\u5305\u62ec\u7ba1\u7406\u5458\u8d26\u6237\u3001\u7aef\u53e3\u53f7\u548c\u57df\u540d\u7b49\u3002\u914d\u7f6e\u5b8c\u6210\u540e\u8fd8\u9700\u8981\u91cd\u65b0\u542f\u52a8GitLab\u624d\u80fd\u751f\u6548\u3002\u4f7f\u7528GitLab\u53ef\u4ee5\u8fdb\u884c\u56e2\u961f\u534f\u4f5c\u3001\u4ee3\u7801\u7ba1\u7406\u3001Issue\u548cMR\u7b49\u529f\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fcentos\u4e0bgitlab\u4e00\u952e\u5b89\u88c5\u5305\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>centos\u4e0bgitlab\u4e00\u952e\u5b89\u88c5\u5305 GitLab\u662f\u4e00\u4e2a\u5f00\u6e90\u7684Git\u4ee3\u7801\u6258\u7ba1\u7ba1\u7406\u5e73\u53f0\uff0c\u53ef\u7528\u4e8e\u56e2\u961f\u5408\u4f5c\u3001\u4ee3\u7801\u5171\u4eab\u3001\u7248\u672c\u63a7\u5236\u7b49\u3002\u5b83\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5305\u62ecCentOS\u3002\u672c\u6587\u5c06\u4ecb\u7ecdCentOS\u4e0bGitLab\u7684\u4e00\u952e\u5b89\u88c5\u5305\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\u3002 \u4e00\u3001\u5b89\u88c5\u524d\u7684\u51c6\u5907\u5de5\u4f5c \u66f4\u65b0\u7cfb\u7edf \u5728\u5b89\u88c5GitLab\u524d\uff0c\u9700\u8981\u5148\u66f4\u65b0\u7cfb\u7edf\uff0c\u4ee5\u786e\u4fdd\u8f6f\u4ef6\u5305\u7248\u672c\u662f\u6700\u65b0\u7684\u3002 sudo yum update \u5b89\u88c5\u5fc5\u8981\u8f6f\u4ef6\u5305 \u5b89\u88c5GitLab\u9700\u8981\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\uff0c\u5982curl, policycoreutils-python, openssh-server\u7b49\uff0c\u53ef\u4ee5\u4f7f\u7528yum\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002 sudo yum install curl policycoreutils-python openssh-server openssh-clients postfix \u542f\u52a8OpenSSH\u670d\u52a1 GitLab\u4f7f\u7528SSH\u534f\u8bae\u6765\u8bbf\u95ee\uff0c\u9700\u8981\u542f\u52a8OpenSSH\u670d\u52a1\u3002 sudo systemctl enable sshdsudo systemctl start sshd \u5173\u95ed\u9632\u706b\u5899\u548cSELinux (\u53ef\u9009\uff09 \u4e3a\u4e86\u8ba9GitLab\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\uff0c\u53ef\u4ee5\u5173\u95ed\u9632\u706b\u5899\u548cSELinux\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u5173\u95ed\u540e\u4f1a\u5bfc\u81f4\u670d\u52a1\u5668\u7684\u5b89\u5168\u6027\u964d\u4f4e\uff0c\u5efa\u8bae\u5728\u5b89\u88c5\u540e\u518d\u8fdb\u884c\u5f00\u542f\u3002 sudo systemctl disable firewalldsudo systemctl stop firewalldsudo setenforce 0sudo sed -i &#8216;s\/SELINUX=enforcing\/SELINUX=disabled\/g&#8217; \/etc\/selinux\/config \u4e8c\u3001\u4e0b\u8f7dGitLab\u5b89\u88c5\u5305 \u4eceGitLab\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u9009\u62e9\u4e0e\u4f60\u7684CentOS\u7248\u672c\u548c\u67b6\u6784\u5bf9\u5e94\u7684\u5b89\u88c5\u5305\u3002 sudo curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bashsudo yum [&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-20187","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20187","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=20187"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20187\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}