{"id":19246,"date":"2024-11-19T12:53:39","date_gmt":"2024-11-19T04:53:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19246\/"},"modified":"2024-11-19T12:53:39","modified_gmt":"2024-11-19T04:53:39","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e8%87%aa%e5%b7%b1%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e6%90%ad%e5%bb%bagitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19246\/","title":{"rendered":"\u5982\u4f55\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\u642d\u5efaGitLab"},"content":{"rendered":"<p>\u968f\u7740\u8f6f\u4ef6\u5f00\u53d1\u7684\u53d1\u5c55\uff0c\u7248\u672c\u63a7\u5236\u5de5\u5177\u6210\u4e3a\u4e86\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u90e8\u5206\u3002git\u662f\u76ee\u524d\u6700\u53d7\u6b22\u8fce\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e4b\u4e00\u3002\u5b83\u662f\u7531linux\u4e4b\u7236linus torvalds\u521b\u5efa\u7684\uff0c\u5df2\u6210\u4e3a\u51e0\u4e4e\u6240\u6709\u5f00\u6e90\u9879\u76ee\u7684\u6807\u51c6\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002<\/p>\n<p>GitLab\u662fGit\u7684\u7ba1\u7406\u5e73\u53f0\uff0c\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u529f\u80fd\u6765\u7b80\u5316\u6e90\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\u642d\u5efaGitLab\u3002<\/p>\n<p>\u6b65\u9aa41\uff1a\u5b89\u88c5\u4f9d\u8d56\u9879<\/p>\n<p>\u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528Ubuntu 18.04\u4f5c\u4e3a\u793a\u8303\uff1a<\/p>\n<pre>sudo apt update\nsudo apt install -y curl openssh-server ca-certificates tzdata perl<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b65\u9aa42\uff1a\u5b89\u88c5PostgreSQL<\/p>\n<p>GitLab\u9ed8\u8ba4\u4f7f\u7528PostgreSQL\u6570\u636e\u5e93\u3002\u4e3a\u6b64\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5PostgreSQL\uff1a<\/p>\n<pre>sudo apt install -y postgresql postgresql-contrib libpq-dev<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b65\u9aa43\uff1a\u5b89\u88c5GitLab<\/p>\n<p>\u6709\u4e24\u79cd\u65b9\u5f0f\u5b89\u88c5GitLab\uff1a<\/p>\n<p>3.1. \u4e0b\u8f7d\u5e76\u5b89\u88c5GitLab\u5305<\/p>\n<p>\u9996\u5148\uff0c\u8bbf\u95eeGitLab\u5b98\u65b9\u7f51\u7ad9 \uff08https:\/\/about.gitlab.com\/install\/\uff09 \uff0c\u4e0b\u8f7d\u9002\u5f53\u7684GitLab\u7248\u672c\u3002<\/p>\n<p>\u5b89\u88c5\u5230\u60a8\u7684\u7cfb\u7edf\u4e0a\uff0c\u89e3\u538b\u7f29\u6587\u4ef6\uff0c\u5e76\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff1a<\/p>\n<pre>sudo mkdir -p \/opt\/gitlab\nsudo chmod 775 \/opt\/gitlab\nsudo curl -LJO https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/packages\/ubuntu\/bionic\/gitlab-ce_&lt;\u7248\u672c\u53f7&gt;_amd64.deb\/download.deb\nsudo dpkg -i gitlab-ce_&lt;\u7248\u672c\u53f7&gt;_amd64.deb\nsudo gitlab-ctl reconfigure<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>3.2. \u4f7f\u7528\u5b98\u65b9\u7684Docker\u955c\u50cf<\/p>\n<p>\u901a\u8fc7docker\u6765\u8fd0\u884cGitLab\uff0c\u9700\u8981\u5148\u5b89\u88c5docker\uff1a<\/p>\n<pre>sudo apt install docker.io -y\nsudo systemctl start docker\nsudo systemctl enable docker<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e0b\u8f7dGitLab\u7684Docker\u955c\u50cf\u5e76\u8fd0\u884c\uff1a<\/p>\n<pre>sudo docker run --detach \n    --hostname &lt;hostname&gt; \n    --publish 443:443 --publish 80:80 --publish 22:22 \n    --name gitlab \n    --restart always \n    --volume \/srv\/gitlab\/config:\/etc\/gitlab \n    --volume \/srv\/gitlab\/logs:\/var\/log\/gitlab \n    --volume \/srv\/gitlab\/data:\/var\/opt\/gitlab \n    gitlab\/gitlab-ce:latest<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c31\u662f\u8fd9\u4e48\u7b80\u5355\uff01<\/p>\n<p>\u6b65\u9aa44\uff1a\u914d\u7f6eGitLab<\/p>\n<p>\u6211\u4eec\u5df2\u7ecf\u542f\u52a8\u4e86GitLab\uff0c\u5e76\u4e14\u5b83\u73b0\u5728\u5e94\u8be5\u6b63\u5728\u8fd0\u884c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cGitLab\u5c06\u5728\u7aef\u53e380\u4e0a\u8fd0\u884c\uff0c\u60a8\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u901a\u8fc7\u8f93\u5165\u670d\u52a1\u5668\u7684IP\u5730\u5740\u6216\u4e3b\u673a\u540d\u6765\u8bbf\u95ee\u5b83\uff1a<\/p>\n<pre>http:\/\/&lt;Server_IP&gt;:80<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e00\u6b21\u8bbf\u95eeGitLab\u65f6\uff0c\u60a8\u5c06\u88ab\u91cd\u5b9a\u5411\u5230\u8bbe\u7f6e\u7ba1\u7406\u5458\u5e10\u6237\u7684\u9875\u9762\u3002\u5728\u6b64\u9875\u9762\u4e0a\uff0c\u60a8\u9700\u8981\u8f93\u5165\u7ba1\u7406\u5458\u8d26\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5e76\u8f93\u5165\u60a8\u5e0c\u671bGitLab\u8fd0\u884c\u7684URL\u3002\u5b8c\u6210\u8bbe\u7f6e\u540e\uff0c\u60a8\u5c06\u88ab\u91cd\u5b9a\u5411\u5230GitLab\u7684\u767b\u5f55\u9875\u9762\u3002<\/p>\n<p>\u6b65\u9aa45\uff1a\u4f7f\u7528GitLab<\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u5df2\u7ecf\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u5e76\u914d\u7f6e\u4e86GitLab\u3002GitLab\u6709\u5f88\u591a\u529f\u80fd\uff0c\u5305\u62ec\u4ee3\u7801\u5e93\u3001\u95ee\u9898\u8ddf\u8e2a\u3001\u6301\u7eed\u96c6\u6210\u7b49\u3002\u8bf7\u7559\u610f\u5b98\u65b9\u6587\u6863\uff0c\u719f\u6089GitLab\u7684\u5404\u4e2a\u7279\u6027\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u642d\u5efaGitLab\u670d\u52a1\u5668\u3002GitLab\u662f\u4e00\u4e2a\u51fa\u8272\u7684\u6e90\u4ee3\u7801\u7ba1\u7406\u5e73\u53f0\uff0c\u5e76\u4e14\u5728\u5f00\u6e90\u793e\u533a\u4e2d\u5e7f\u53d7\u6b22\u8fce\u3002\u73b0\u5728\uff0c\u60a8\u5e94\u8be5\u5177\u5907\u642d\u5efaGitLab\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u5e76\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528\u5b83\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\u642d\u5efaGitLab\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>\u968f\u7740\u8f6f\u4ef6\u5f00\u53d1\u7684\u53d1\u5c55\uff0c\u7248\u672c\u63a7\u5236\u5de5\u5177\u6210\u4e3a\u4e86\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u90e8\u5206\u3002git\u662f\u76ee\u524d\u6700\u53d7\u6b22\u8fce\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u4e4b\u4e00\u3002\u5b83\u662f\u7531linux\u4e4b\u7236linus torvalds\u521b\u5efa\u7684\uff0c\u5df2\u6210\u4e3a\u51e0\u4e4e\u6240\u6709\u5f00\u6e90\u9879\u76ee\u7684\u6807\u51c6\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002 GitLab\u662fGit\u7684\u7ba1\u7406\u5e73\u53f0\uff0c\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u529f\u80fd\u6765\u7b80\u5316\u6e90\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\u642d\u5efaGitLab\u3002 \u6b65\u9aa41\uff1a\u5b89\u88c5\u4f9d\u8d56\u9879 \u5728\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528Ubuntu 18.04\u4f5c\u4e3a\u793a\u8303\uff1a sudo apt update sudo apt install -y curl openssh-server ca-certificates tzdata perl \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa42\uff1a\u5b89\u88c5PostgreSQL GitLab\u9ed8\u8ba4\u4f7f\u7528PostgreSQL\u6570\u636e\u5e93\u3002\u4e3a\u6b64\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5PostgreSQL\uff1a sudo apt install -y postgresql postgresql-contrib libpq-dev \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa43\uff1a\u5b89\u88c5GitLab \u6709\u4e24\u79cd\u65b9\u5f0f\u5b89\u88c5GitLab\uff1a 3.1. \u4e0b\u8f7d\u5e76\u5b89\u88c5GitLab\u5305 \u9996\u5148\uff0c\u8bbf\u95eeGitLab\u5b98\u65b9\u7f51\u7ad9 \uff08https:\/\/about.gitlab.com\/install\/\uff09 \uff0c\u4e0b\u8f7d\u9002\u5f53\u7684GitLab\u7248\u672c\u3002 \u5b89\u88c5\u5230\u60a8\u7684\u7cfb\u7edf\u4e0a\uff0c\u89e3\u538b\u7f29\u6587\u4ef6\uff0c\u5e76\u8fdb\u5165\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff1a sudo mkdir -p \/opt\/gitlab sudo chmod 775 \/opt\/gitlab sudo curl -LJO https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/packages\/ubuntu\/bionic\/gitlab-ce_&lt;\u7248\u672c\u53f7&gt;_amd64.deb\/download.deb sudo dpkg -i gitlab-ce_&lt;\u7248\u672c\u53f7&gt;_amd64.deb sudo gitlab-ctl [&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-19246","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19246","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=19246"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19246\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}