{"id":19685,"date":"2024-11-19T11:10:02","date_gmt":"2024-11-19T03:10:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19685\/"},"modified":"2024-11-19T11:10:02","modified_gmt":"2024-11-19T03:10:02","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f%e4%b8%8a%e5%ae%89%e8%a3%85gitlab%e7%9a%84%e6%9c%80%e6%96%b0%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19685\/","title":{"rendered":"\u5982\u4f55\u5728Ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5GitLab\u7684\u6700\u65b0\u7248\u672c"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u4e2a\u57fa\u4e8egit\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002\u5b83\u5177\u6709\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u66f4\u52a0\u9ad8\u6548\u5730\u7ba1\u7406\u548c\u534f\u4f5c\u5f00\u53d1\u3002\u6700\u65b0\u7248\u672c\u7684gitlab\u662f8.17.2\u7248\u672c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5gitlab\u7684\u6700\u65b0\u7248\u672c\u3002<\/p>\n<p>\u6b65\u9aa4\u4e00\uff1a\u5b89\u88c5\u4f9d\u8d56\u9879<\/p>\n<p>\u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u9879\uff1a<\/p>\n<ol>\n<li>CURL<\/li>\n<\/ol>\n<p>sudo apt-get install curl<\/p>\n<ol>\n<li>\n<p>Openssl<\/p>\n<p>sudo apt-get install openssl<\/p>\n<\/li>\n<li>Postgresql<\/li>\n<\/ol>\n<p>sudo apt-get install postgresql postgresql-contrib<\/p>\n<p>\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u9700\u8981\u4e3aPostgreSQL\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u60a8\u53ef\u4ee5\u6253\u5f00PostgreSQL shell\u5e76\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u7528\u6237\uff1a<\/p>\n<p>sudo -u postgres psql<\/p>\n<p>CREATE USER git CREATEDB;<\/p>\n<p>SET PASSWORD FOR git = &#8216;yourpassword&#8217;;<\/p>\n<p>\u6b65\u9aa4\u4e8c\uff1a\u5b89\u88c5GitLab<\/p>\n<p>\u5b89\u88c5GitLab\u7684\u6700\u65b0\u7248\u672c\u9700\u8981\u4f7f\u7528\u5b98\u65b9\u63d0\u4f9b\u7684\u5b89\u88c5\u811a\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u4e0b\u8f7d\u811a\u672c\uff1a<\/p>\n<p>sudo curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash<\/p>\n<p>\u9700\u8981\u7b49\u5f85\u4e0b\u8f7d\u5b8c\u6210\u540e\u5c31\u53ef\u4ee5\u6267\u884c\u4e0b\u4e00\u4e2a\u547d\u4ee4\u8fdb\u884cGitLab\u5b89\u88c5\uff1a<\/p>\n<p>sudo apt-get install gitlab-ce<\/p>\n<p>\u6b65\u9aa4\u4e09\uff1a\u914d\u7f6eGitLab<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u914d\u7f6eGitLab\u3002\u9996\u5148\uff0c\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982nano\u6216vim\uff09\u6253\u5f00\u201c\/etc\/gitlab\/gitlab.rb\u201d\u6587\u4ef6\uff1a<\/p>\n<p>sudo nano \/etc\/gitlab\/gitlab.rb<\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u641c\u7d22\u201cpostgresql\u201d\u548c\u201cexternal_url \u201d\uff0c\u5e76\u66f4\u6539\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>postgresql[&#8216;enable&#8217;] = true<\/p>\n<p>gitlab_rails[&#8216;db_username&#8217;] = &#8220;git&#8221;<\/p>\n<p>gitlab_rails[&#8216;db_password&#8217;] = &#8220;yourpassword&#8221;<\/p>\n<p>gitlab_rails[&#8216;db_host&#8217;] = &#8216;localhost&#8217;<\/p>\n<p>gitlab_rails[&#8216;db_port&#8217;] = &#8216;5432&#8217;<\/p>\n<p>external_url &#8216;http:\/\/yourdomain.com&#8217;<\/p>\n<p>\u5b8c\u6210\u540e\uff0c\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u6b65\u9aa4\u56db\uff1a\u91cd\u65b0\u914d\u7f6eGitLab\u5e76\u542f\u52a8\u670d\u52a1<\/p>\n<p>\u91cd\u65b0\u914d\u7f6eGitLab\uff1a<\/p>\n<p>sudo gitlab-ctl reconfigure<\/p>\n<p>\u542f\u52a8GitLab\u670d\u52a1\uff1a<\/p>\n<p>sudo gitlab-ctl start<\/p>\n<p>\u5230\u6b64\u4e3a\u6b62\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u5730\u5b89\u88c5\u4e86GitLab\u7684\u6700\u65b0\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/yourdomain.com \u6765\u9a8c\u8bc1\u5b83\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5GitLab\u7684\u6700\u65b0\u7248\u672c\u3002\u867d\u7136\u5b89\u88c5\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u4f46\u6b63\u786e\u7684\u5b89\u88c5\u548c\u914d\u7f6e\u5c06\u4f7fGitLab\u5b9e\u73b0\u6709\u6548\u7684\u7248\u672c\u63a7\u5236\u548c\u534f\u4f5c\u5f00\u53d1\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u60a8\u7684\u5b66\u4e60\u548c\u4f7f\u7528\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5GitLab\u7684\u6700\u65b0\u7248\u672c\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\u57fa\u4e8egit\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002\u5b83\u5177\u6709\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u66f4\u52a0\u9ad8\u6548\u5730\u7ba1\u7406\u548c\u534f\u4f5c\u5f00\u53d1\u3002\u6700\u65b0\u7248\u672c\u7684gitlab\u662f8.17.2\u7248\u672c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5gitlab\u7684\u6700\u65b0\u7248\u672c\u3002 \u6b65\u9aa4\u4e00\uff1a\u5b89\u88c5\u4f9d\u8d56\u9879 \u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u9879\uff1a CURL sudo apt-get install curl Openssl sudo apt-get install openssl Postgresql sudo apt-get install postgresql postgresql-contrib \u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u9700\u8981\u4e3aPostgreSQL\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u60a8\u53ef\u4ee5\u6253\u5f00PostgreSQL shell\u5e76\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u7528\u6237\uff1a sudo -u postgres psql CREATE USER git CREATEDB; SET PASSWORD FOR git = &#8216;yourpassword&#8217;; \u6b65\u9aa4\u4e8c\uff1a\u5b89\u88c5GitLab \u5b89\u88c5GitLab\u7684\u6700\u65b0\u7248\u672c\u9700\u8981\u4f7f\u7528\u5b98\u65b9\u63d0\u4f9b\u7684\u5b89\u88c5\u811a\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u4e0b\u8f7d\u811a\u672c\uff1a sudo curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash \u9700\u8981\u7b49\u5f85\u4e0b\u8f7d\u5b8c\u6210\u540e\u5c31\u53ef\u4ee5\u6267\u884c\u4e0b\u4e00\u4e2a\u547d\u4ee4\u8fdb\u884cGitLab\u5b89\u88c5\uff1a sudo apt-get install gitlab-ce \u6b65\u9aa4\u4e09\uff1a\u914d\u7f6eGitLab \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u914d\u7f6eGitLab\u3002\u9996\u5148\uff0c\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982nano\u6216vim\uff09\u6253\u5f00\u201c\/etc\/gitlab\/gitlab.rb\u201d\u6587\u4ef6\uff1a sudo nano \/etc\/gitlab\/gitlab.rb \u5728\u6587\u4ef6\u4e2d\u641c\u7d22\u201cpostgresql\u201d\u548c\u201cexternal_url [&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-19685","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19685","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=19685"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19685\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}