{"id":19249,"date":"2024-11-19T10:03:15","date_gmt":"2024-11-19T02:03:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19249\/"},"modified":"2024-11-19T10:03:15","modified_gmt":"2024-11-19T02:03:15","slug":"%e6%b7%b1%e6%9e%90%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19249\/","title":{"rendered":"\u6df1\u6790\u5982\u4f55\u5b89\u88c5GitLab"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u5b83\u63d0\u4f9b\u4e86\u57fa\u4e8eweb\u7684git\u4ed3\u5e93\u7ba1\u7406\u529f\u80fd\uff0c\u4ee5\u53ca\u8bb8\u591a\u534f\u4f5c\u5de5\u5177\u548c\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5b89\u88c5gitlab\u3002<\/p>\n<p>\u51c6\u5907\u5de5\u4f5c\uff1a<\/p>\n<p>\u5728\u5f00\u59cb\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u60a8\u7684\u670d\u52a1\u5668\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a<\/p>\n<ul>\n<li>64\u4f4d\u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>\u81f3\u5c114GB\u5185\u5b58\uff0c\u6700\u597d8GB\u53ca\u4ee5\u4e0a<\/li>\n<li>2\u4e2aCPU\u6838\u5fc3<\/li>\n<li>20 GB\u53ef\u7528\u5b58\u50a8\u7a7a\u95f4<\/li>\n<\/ul>\n<p>\u5b89\u88c5Docker\u548cDocker Compose\uff1a<\/p>\n<p>GitLab\u63d0\u4f9b\u4e86Docker\u955c\u50cf\u6765\u7b80\u5316\u5b89\u88c5\u8fc7\u7a0b\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Docker\u548cDocker Compose\u3002<\/p>\n<p>\u5728Ubuntu\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Docker\uff1a<\/p>\n<pre>sudo apt-get update\nsudo apt-get install docker.io<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Docker Compose\uff1a<\/p>\n<pre>sudo apt-get install docker-compose<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5GitLab\uff1a<\/p>\n<p>\u4e00\u65e6Docker\u548cDocker Compose\u5df2\u5b89\u88c5\u5230\u60a8\u7684\u7cfb\u7edf\u4e0a\uff0c\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5GitLab\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u5b89\u88c5\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u4ee5\u4fdd\u5b58GitLab\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>sudo mkdir -p \/var\/opt\/gitlab<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2adocker-compose.yml\u6587\u4ef6\uff0c\u5e76\u5f55\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ol>\n<pre>version: '3'\nservices:\n  web:\n    image: 'gitlab\/gitlab-ce:latest'\n    restart: always\n    hostname: 'ubuntu.yourdomain.com'\n    environment:\n      GITLAB_OMNIBUS_CONFIG: |\n        external_url 'http:\/\/ubuntu.yourdomain.com'\n        gitlab_rails['gitlab_shell_ssh_port'] = 2224\n    ports:\n      - '80:80'\n      - '443:443'\n      - '2224:22'\n    volumes:\n      - '\/var\/opt\/gitlab:\/var\/opt\/gitlab'\n      - '\/var\/opt\/gitlab\/config:\/etc\/gitlab'\n      - '\/var\/opt\/gitlab\/logs:\/var\/log\/gitlab'<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8bf7\u6ce8\u610f\uff1a\u5728\u5c06\u4e0a\u8ff0\u914d\u7f6e\u6587\u4ef6\u590d\u5236\u5230\u60a8\u7684\u670d\u52a1\u5668\u4e4b\u524d\uff0c\u60a8\u5e94\u8be5\u5c06&#8217;ubuntu.yourdomain.com&#8217;\u6362\u6210\u60a8\u81ea\u5df1\u7684\u57df\u540d\u6216IP\u5730\u5740\u3002<\/p>\n<ol>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u542f\u52a8GitLab\uff1a<\/li>\n<\/ol>\n<pre>sudo docker-compose up -d<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u5c06\u542f\u52a8GitLab\u5bb9\u5668\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u5bb9\u5668\u662f\u5426\u5728\u8fd0\u884c\uff1a<\/p>\n<pre>sudo docker ps<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u8bbf\u95eeGitLab\u7684Web\u754c\u9762\uff1a<\/li>\n<\/ol>\n<p>\u8bbf\u95ee\u60a8\u7684GitLab\u5b89\u88c5\u6240\u5728\u7684\u57df\u540d\u6216IP\u5730\u5740\u3002\u5728\u9996\u6b21\u8bbf\u95ee\u65f6\uff0c\u60a8\u9700\u8981\u8bbe\u7f6e\u7ba1\u7406\u5458\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u914d\u7f6eSMTP\uff1a<\/li>\n<\/ol>\n<p>\u5728GitLab\u7684\u7ba1\u7406\u754c\u9762\u4e2d\uff0c\u5355\u51fb\u201c\u7ba1\u7406\u5458\u533a\u57df\u201d&gt;\u201c\u8bbe\u7f6e\u201d&gt;\u201c\u7f51\u7edc\u201d&gt;\u201c\u51fa\u7ad9SMTP\u670d\u52a1\u5668\u201d\u3002<\/p>\n<p>\u914d\u7f6e\u60a8\u7684SMTP\u670d\u52a1\u5668\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u7136\u540e\u5355\u51fb\u201c\u6d4b\u8bd5SMTP\u8bbe\u7f6e\u201d\u6765\u6d4b\u8bd5\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u4e86GitLab\u5e76\u914d\u7f6e\u597d\u4e86SMTP\u670d\u52a1\u5668\uff0c\u5728\u8be5\u5e73\u53f0\u4e0a\u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u548c\u534f\u4f5c\u3002<\/p>\n<p>\u603b\u7ed3\uff1a<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u5728Ubuntu\u4e0a\u5b89\u88c5GitLab\u7684\u8fc7\u7a0b\u3002\u4f7f\u7528Docker\u5bb9\u5668\u53ef\u4ee5\u4f7f\u5b89\u88c5\u8fc7\u7a0b\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u53ef\u9760\u3002\u901a\u8fc7\u8fd9\u4e2a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u4e00\u4e2a\u5e26\u6709Git\u4ed3\u5e93\u7ba1\u7406\u529f\u80fd\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6df1\u6790\u5982\u4f55\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>gitlab\u662f\u4e00\u6b3e\u5f00\u6e90\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff0c\u5b83\u63d0\u4f9b\u4e86\u57fa\u4e8eweb\u7684git\u4ed3\u5e93\u7ba1\u7406\u529f\u80fd\uff0c\u4ee5\u53ca\u8bb8\u591a\u534f\u4f5c\u5de5\u5177\u548c\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5b89\u88c5gitlab\u3002 \u51c6\u5907\u5de5\u4f5c\uff1a \u5728\u5f00\u59cb\u5b89\u88c5GitLab\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u60a8\u7684\u670d\u52a1\u5668\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a 64\u4f4d\u64cd\u4f5c\u7cfb\u7edf \u81f3\u5c114GB\u5185\u5b58\uff0c\u6700\u597d8GB\u53ca\u4ee5\u4e0a 2\u4e2aCPU\u6838\u5fc3 20 GB\u53ef\u7528\u5b58\u50a8\u7a7a\u95f4 \u5b89\u88c5Docker\u548cDocker Compose\uff1a GitLab\u63d0\u4f9b\u4e86Docker\u955c\u50cf\u6765\u7b80\u5316\u5b89\u88c5\u8fc7\u7a0b\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Docker\u548cDocker Compose\u3002 \u5728Ubuntu\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Docker\uff1a sudo apt-get update sudo apt-get install docker.io \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Docker Compose\uff1a sudo apt-get install docker-compose \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab\uff1a \u4e00\u65e6Docker\u548cDocker Compose\u5df2\u5b89\u88c5\u5230\u60a8\u7684\u7cfb\u7edf\u4e0a\uff0c\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5GitLab\u3002 \u4ee5\u4e0b\u662f\u5b89\u88c5\u6b65\u9aa4\uff1a \u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u4ee5\u4fdd\u5b58GitLab\u7684\u914d\u7f6e\u6587\u4ef6\uff1a sudo mkdir -p \/var\/opt\/gitlab \u767b\u5f55\u540e\u590d\u5236 \u521b\u5efa\u4e00\u4e2adocker-compose.yml\u6587\u4ef6\uff0c\u5e76\u5f55\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a version: &#8216;3&#8217; services: web: image: &#8216;gitlab\/gitlab-ce:latest&#8217; restart: always hostname: &#8216;ubuntu.yourdomain.com&#8217; environment: GITLAB_OMNIBUS_CONFIG: | external_url &#8216;http:\/\/ubuntu.yourdomain.com&#8217; gitlab_rails[&#8216;gitlab_shell_ssh_port&#8217;] [&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-19249","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19249","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=19249"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19249\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}