{"id":18832,"date":"2024-11-19T17:58:01","date_gmt":"2024-11-19T09:58:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18832\/"},"modified":"2024-11-19T17:58:01","modified_gmt":"2024-11-19T09:58:01","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8redhat%e7%8e%af%e5%a2%83%e4%b8%8b%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18832\/","title":{"rendered":"\u5982\u4f55\u5728RedHat\u73af\u5883\u4e0b\u5b89\u88c5GitLab"},"content":{"rendered":"<p>\u8fd1\u5e74\u6765\uff0cgitlab\u4f5c\u4e3a\u4e00\u4e2a\u5f00\u6e90\u7684git\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u53d7\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u5173\u6ce8\u548c\u4f7f\u7528\u3002\u4e0e github \u76f8\u6bd4\uff0cgitlab \u62e5\u6709\u66f4\u591a\u7684\u81ea\u7531\uff0c\u80fd\u591f\u6ee1\u8db3\u4e13\u4e1a\u5f00\u53d1\u4eba\u5458\u7684\u9700\u6c42\u3002\u800credhat\u4f5c\u4e3a\u4e00\u6b3elinux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e5f\u5728\u4f17\u591a\u5f00\u53d1\u8005\u7684\u5fc3\u76ee\u4e2d\u62e5\u6709\u4e0d\u53ef\u66ff\u4ee3\u7684\u5730\u4f4d\u3002\u4eca\u5929\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728redhat\u73af\u5883\u4e0b\u5b89\u88c5gitlab\u3002<\/p>\n<ol>\n<li>\u5b89\u88c5\u4f9d\u8d56<\/li>\n<\/ol>\n<p>\u9996\u5148\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u5de5\u5177\u548c\u5e93\uff0c\u5982curl\u3001policycoreutils-python\u7b49\uff1a<\/p>\n<pre>sudo yum install curl policycoreutils-python openssh-server\nsudo systemctl enable sshd\nsudo systemctl start sshd\nsudo firewall-cmd --permanent --add-service=http\nsudo systemctl restart firewalld<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5\u90ae\u4ef6\u670d\u52a1\u5668<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u80fd\u53d1\u9001\u90ae\u4ef6\u7ed9\u7528\u6237\uff0c\u9700\u8981\u5b89\u88c5\u90ae\u4ef6\u670d\u52a1\u5668\uff1a<\/p>\n<pre>sudo yum install postfix\nsudo systemctl enable postfix\nsudo systemctl start postfix<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5b89\u88c5GitLab<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4e0b\u5217\u547d\u4ee4\u6dfb\u52a0GitLab\u4ed3\u5e93\u5e76\u66f4\u65b0\uff1a<\/p>\n<pre>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.rpm.sh | sudo bash\nsudo yum install gitlab-ee<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u914d\u7f6eGitLab<\/li>\n<\/ol>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u57fa\u672c\u7684\u914d\u7f6e\u3002\u9996\u5148\u9700\u8981\u4fee\u6539 \/etc\/gitlab\/gitlab.rb\u3002\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91\u5668\u6216\u8005\u547d\u4ee4\u884c\u4fee\u6539\uff0c\u6839\u636e\u73af\u5883\u9009\u62e9\u76f8\u5e94\u7684\u65b9\u5f0f\uff1a<\/p>\n<pre>sudo nano \/etc\/gitlab\/gitlab.rb\n\u6216\u8005\nsudo sed -i 's\/external_url 'http:\/\/gitlab.example.com'\/external_url 'http:\/\/yourdomain.com'\/g' \/etc\/gitlab\/gitlab.rb<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06 external_url \u6539\u6210\u4f60\u81ea\u5df1\u7684GitLab\u5730\u5740\u3002<\/p>\n<p>\u63a5\u7740\uff0c\u9700\u8981\u91cd\u65b0\u914d\u7f6e\u5e76\u542f\u52a8 GitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl reconfigure\nsudo gitlab-ctl start<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u91cd\u65b0\u914d\u7f6e\u671f\u95f4\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85\u3002<\/p>\n<ol>\n<li>\u767b\u5f55GitLab<\/li>\n<\/ol>\n<p>\u5b89\u88c5\u5e76\u542f\u52a8GitLab\u4e4b\u540e\uff0c\u9700\u8981\u5728\u6d4f\u89c8\u5668\u4e0a\u767b\u5f55\u3002\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u4f60\u914d\u7f6e\u7684\u5916\u90e8\u5730\u5740 http:\/\/yourdomain.com\uff0c\u5373\u53ef\u770b\u5230GitLab\u7684\u767b\u5f55\u754c\u9762\u3002\u7b2c\u4e00\u6b21\u8fdb\u5165\u65f6\u9700\u8981\u8bbe\u7f6e\u7ba1\u7406\u5458\u8d26\u53f7\u548c\u5bc6\u7801\uff0c\u8bbe\u7f6e\u597d\u540e\u5373\u53ef\u767b\u5f55\u5e76\u5f00\u59cb\u4f7f\u7528GitLab\u3002<\/p>\n<ol>\n<li>\u9047\u5230\u7684\u95ee\u9898<\/li>\n<\/ol>\n<p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u6709\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u9700\u8981\u6ce8\u610f\uff1a<\/p>\n<p>Q1\uff1a\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u5361\u5728\u2018Running handlers\u2019<\/p>\n<p>\u8fd9\u662f\u7531\u4e8e\u670d\u52a1\u5668\u7a7a\u95f4\u592a\u5c0f\u7684\u539f\u56e0\u5bfc\u81f4\u7684\uff0c\u53ef\u4ee5\u5728\u5b89\u88c5\u524d\u5148\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<p>Q2\uff1a\u65e0\u6cd5\u8bbf\u95eeGitLab\u670d\u52a1\u5668<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528curl\u547d\u4ee4\u68c0\u67e5GitLab\u670d\u52a1\u662f\u5426\u8fd0\u884c\uff0c\u4e5f\u53ef\u4ee5\u68c0\u67e5Linux\u9632\u706b\u5899\uff0c\u662f\u5426\u963b\u6b62\u4e86\u8bbf\u95eeGitLab\u670d\u52a1\u3002\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u89e3\u51b3\uff1a<\/p>\n<pre>sudo firewall-cmd --zone=public --permanent --add-port=80\/tcp\nsudo firewall-cmd --zone=public --permanent --add-port=22\/tcp\nsudo firewall-cmd --reload<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>Q3\uff1aGitLab\u8fdb\u7a0b\u5d29\u6e83<\/p>\n<p>\u7531\u4e8eGitLab\u8fdb\u7a0b\u8fd0\u884c\u7684\u65f6\u95f4\u8fc7\u957f\uff0c\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fc7\u591a\u7684\u8fdb\u7a0b\u5bfc\u81f4\u5d29\u6e83\u3002\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u91cd\u542fGitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl restart<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u4ecb\u7ecd\u4e86\u5728\u7ea2\u5e3d(RedHat)\u73af\u5883\u4e0b\u5b89\u88c5GitLab\u7684\u8fc7\u7a0b\uff0c\u5e76\u5217\u51fa\u4e86\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6cd5\u3002\u4f7f\u7528GitLab\u53ef\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u4ee3\u7801\uff0c\u56e2\u961f\u6210\u5458\u53ef\u4ee5\u66f4\u597d\u5730\u5408\u4f5c\uff0c\u63d0\u9ad8\u8f6f\u4ef6\u5f00\u53d1\u6548\u7387\u3002\u901a\u8fc7\u672c\u7bc7\u6587\u7ae0\u7684\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5927\u5bb6\u53ef\u4ee5\u66f4\u597d\u5730\u5229\u7528GitLab\u6765\u5f00\u5c55\u5de5\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728RedHat\u73af\u5883\u4e0b\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>\u8fd1\u5e74\u6765\uff0cgitlab\u4f5c\u4e3a\u4e00\u4e2a\u5f00\u6e90\u7684git\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u53d7\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u5173\u6ce8\u548c\u4f7f\u7528\u3002\u4e0e github \u76f8\u6bd4\uff0cgitlab \u62e5\u6709\u66f4\u591a\u7684\u81ea\u7531\uff0c\u80fd\u591f\u6ee1\u8db3\u4e13\u4e1a\u5f00\u53d1\u4eba\u5458\u7684\u9700\u6c42\u3002\u800credhat\u4f5c\u4e3a\u4e00\u6b3elinux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e5f\u5728\u4f17\u591a\u5f00\u53d1\u8005\u7684\u5fc3\u76ee\u4e2d\u62e5\u6709\u4e0d\u53ef\u66ff\u4ee3\u7684\u5730\u4f4d\u3002\u4eca\u5929\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728redhat\u73af\u5883\u4e0b\u5b89\u88c5gitlab\u3002 \u5b89\u88c5\u4f9d\u8d56 \u9996\u5148\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u5de5\u5177\u548c\u5e93\uff0c\u5982curl\u3001policycoreutils-python\u7b49\uff1a sudo yum install curl policycoreutils-python openssh-server sudo systemctl enable sshd sudo systemctl start sshd sudo firewall-cmd &#8211;permanent &#8211;add-service=http sudo systemctl restart firewalld \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u90ae\u4ef6\u670d\u52a1\u5668 \u4e3a\u4e86\u80fd\u53d1\u9001\u90ae\u4ef6\u7ed9\u7528\u6237\uff0c\u9700\u8981\u5b89\u88c5\u90ae\u4ef6\u670d\u52a1\u5668\uff1a sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab \u901a\u8fc7\u4e0b\u5217\u547d\u4ee4\u6dfb\u52a0GitLab\u4ed3\u5e93\u5e76\u66f4\u65b0\uff1a curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ee\/script.rpm.sh | sudo bash sudo yum install gitlab-ee [&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-18832","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18832","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=18832"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18832\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}