{"id":44260,"date":"2024-10-06T14:14:12","date_gmt":"2024-10-06T06:14:12","guid":{"rendered":"https:\/\/server.hk\/cnblog\/44260\/"},"modified":"2024-10-06T14:14:12","modified_gmt":"2024-10-06T06:14:12","slug":"centos-%e6%ba%90%e7%a2%bc%e5%ae%89%e8%a3%9d-gitlab-%e6%bc%a2%e5%8c%96%e7%89%88","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/44260\/","title":{"rendered":"CentOS \u6e90\u78bc\u5b89\u88dd GitLab \u6f22\u5316\u7248"},"content":{"rendered":"<h1 id=\"centos-%e6%ba%90%e7%a2%bc%e5%ae%89%e8%a3%9d-gitlab-%e6%bc%a2%e5%8c%96%e7%89%88-wanLPFHeEX\">CentOS \u6e90\u78bc\u5b89\u88dd GitLab \u6f22\u5316\u7248<\/h1>\n<p>GitLab \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u8edf\u9ad4\u958b\u767c\u548c\u9805\u76ee\u7ba1\u7406\u3002\u5c0d\u65bc\u5e0c\u671b\u5728\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u4e0a\u904b\u884c GitLab \u7684\u7528\u6236\u4f86\u8aaa\uff0c\u6e90\u78bc\u5b89\u88dd\u63d0\u4f9b\u4e86\u66f4\u5927\u7684\u9748\u6d3b\u6027\u548c\u53ef\u5b9a\u5236\u6027\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS \u7cfb\u7d71\u4e0a\u5b89\u88dd GitLab \u6f22\u5316\u7248\uff0c\u4e26\u63d0\u4f9b\u8a73\u7d30\u7684\u6b65\u9a5f\u548c\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-wanLPFHeEX\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u4e4b\u524d\uff0c\u8acb\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\u9019\u4e9b\u5305\u5c07\u5e6b\u52a9\u60a8\u9806\u5229\u5b89\u88dd GitLab\uff1a<\/p>\n<pre><code>sudo yum install -y curl policycoreutils openssh-server openssh-clients<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 SSH \u670d\u52d9\u4e26\u8a2d\u7f6e\u5176\u958b\u6a5f\u81ea\u555f\uff1a<\/p>\n<pre><code>sudo systemctl start sshd\nsudo systemctl enable sshd<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-gitlab-wanLPFHeEX\">\u5b89\u88dd GitLab<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u4e0b\u8f09 GitLab \u7684\u6e90\u78bc\u3002\u53ef\u4ee5\u5f9e GitLab \u7684\u5b98\u65b9\u7db2\u7ad9\u7372\u53d6\u6700\u65b0\u7684\u6e90\u78bc\u5305\u3002\u4ee5\u4e0b\u662f\u4e0b\u8f09\u548c\u89e3\u58d3\u7684\u547d\u4ee4\uff1a<\/p>\n<pre><code>wget https:\/\/gitlab.com\/gitlab-org\/gitlab\/-\/archive\/vX.X.X\/gitlab-vX.X.X.tar.gz\ntar -xvzf gitlab-vX.X.X.tar.gz\ncd gitlab-vX.X.X<\/code><\/pre>\n<p>\u8acb\u5c07\u4e0a\u8ff0\u547d\u4ee4\u4e2d\u7684 &#8220;X.X.X&#8221; \u66ff\u63db\u70ba\u60a8\u5e0c\u671b\u5b89\u88dd\u7684 GitLab \u7248\u672c\u865f\u3002<\/p>\n<h2 id=\"%e9%85%8d%e7%bd%ae-gitlab-wanLPFHeEX\">\u914d\u7f6e GitLab<\/h2>\n<p>\u5728\u89e3\u58d3\u5f8c\u7684\u76ee\u9304\u4e2d\uff0c\u60a8\u9700\u8981\u9032\u884c\u4e00\u4e9b\u57fa\u672c\u914d\u7f6e\u3002\u9996\u5148\uff0c\u8907\u88fd GitLab \u7684\u914d\u7f6e\u7bc4\u672c\uff1a<\/p>\n<pre><code>cp config\/gitlab.yml.example config\/gitlab.yml<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6\u4ee5\u8a2d\u7f6e\u60a8\u7684 GitLab URL \u548c\u5176\u4ed6\u53c3\u6578\uff1a<\/p>\n<pre><code>nano config\/gitlab.yml<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\uff0c\u627e\u5230\u4ee5\u4e0b\u884c\u4e26\u6839\u64da\u60a8\u7684\u9700\u6c42\u9032\u884c\u4fee\u6539\uff1a<\/p>\n<pre><code>host: 'gitlab.example.com'\nport: 80\n<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e4%be%9d%e8%b3%b4-wanLPFHeEX\">\u5b89\u88dd\u4f9d\u8cf4<\/h2>\n<p>GitLab \u9700\u8981\u4e00\u4e9b Ruby \u548c Node.js \u7684\u4f9d\u8cf4\u5305\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd\u9019\u4e9b\u4f9d\u8cf4\uff1a<\/p>\n<pre><code>sudo yum install -y gcc gcc-c++ make\nsudo yum install -y ruby ruby-devel\nsudo yum install -y nodejs<\/code><\/pre>\n<h2 id=\"%e7%b7%a8%e8%ad%af%e5%92%8c%e5%95%9f%e5%8b%95-gitlab-wanLPFHeEX\">\u7de8\u8b6f\u548c\u555f\u52d5 GitLab<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6240\u6709\u4f9d\u8cf4\u5f8c\uff0c\u60a8\u53ef\u4ee5\u958b\u59cb\u7de8\u8b6f GitLab\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u7de8\u8b6f\uff1a<\/p>\n<pre><code>bundle install --deployment --without development test<\/code><\/pre>\n<p>\u7de8\u8b6f\u5b8c\u6210\u5f8c\uff0c\u60a8\u53ef\u4ee5\u555f\u52d5 GitLab \u670d\u52d9\uff1a<\/p>\n<pre><code>sudo gitlab-ctl reconfigure<\/code><\/pre>\n<p>\u9019\u5c07\u6839\u64da\u60a8\u7684\u914d\u7f6e\u6587\u4ef6\u81ea\u52d5\u8a2d\u7f6e GitLab \u7684\u6240\u6709\u670d\u52d9\u3002<\/p>\n<h2 id=\"%e6%bc%a2%e5%8c%96-gitlab-wanLPFHeEX\">\u6f22\u5316 GitLab<\/h2>\n<p>\u8981\u5c07 GitLab \u6f22\u5316\uff0c\u60a8\u53ef\u4ee5\u5b89\u88dd\u6f22\u5316\u63d2\u4ef6\u6216\u76f4\u63a5\u4fee\u6539\u8a9e\u8a00\u6587\u4ef6\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u4e0b\u8f09\u6f22\u5316\u5305\uff0c\u7136\u5f8c\u5c07\u5176\u653e\u7f6e\u5728 GitLab \u7684\u8a9e\u8a00\u6587\u4ef6\u593e\u4e2d\u3002\u5177\u9ad4\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<pre><code>wget https:\/\/example.com\/gitlab-zh_CN.zip\nunzip gitlab-zh_CN.zip -d config\/locales\/<\/code><\/pre>\n<p>\u5b8c\u6210\u5f8c\uff0c\u91cd\u555f GitLab \u670d\u52d9\u4ee5\u61c9\u7528\u66f4\u6539\uff1a<\/p>\n<pre><code>sudo gitlab-ctl restart<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-wanLPFHeEX\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u5728 CentOS \u7cfb\u7d71\u4e0a\u6210\u529f\u5b89\u88dd GitLab \u6f22\u5316\u7248\u3002\u9019\u4e0d\u50c5\u80fd\u5920\u63d0\u5347\u60a8\u7684\u958b\u767c\u6548\u7387\uff0c\u9084\u80fd\u8b93\u5718\u968a\u6210\u54e1\u66f4\u65b9\u4fbf\u5730\u4f7f\u7528 GitLab \u9032\u884c\u5354\u4f5c\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u4f3a\u670d\u5668\u74b0\u5883\u4f86\u904b\u884c GitLab\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u4ee5\u7372\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u5728 CentOS \u4e0a\u6e90\u78bc\u5b89\u88dd GitLab \u6f22\u5316\u7248\uff0c\u6b65\u9a5f\u8a73\u76e1\uff0c\u52a9\u60a8\u8f15\u9b06\u642d\u5efa\u672c\u5730\u5316\u7684 GitLab \u74b0\u5883\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-44260","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44260","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=44260"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44260\/revisions"}],"predecessor-version":[{"id":44261,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44260\/revisions\/44261"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=44260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=44260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=44260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}