{"id":2264,"date":"2025-08-06T14:33:32","date_gmt":"2025-08-06T06:33:32","guid":{"rendered":"https:\/\/www.madbull.site\/?p=2264"},"modified":"2025-08-07T11:43:18","modified_gmt":"2025-08-07T03:43:18","slug":"%e5%9f%ba%e4%ba%8eubuntu%e6%90%ad%e5%bb%bagitlab","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=2264","title":{"rendered":"\u57fa\u4e8eubuntu\u642d\u5efagitlab"},"content":{"rendered":"\n<p>\u4e4b\u524d\u4ecb\u7ecd\u4e86\u4e00\u4e2a\u4f7f\u7528 git + openssh-server \u642d\u5efa\u4e00\u4e2a\u6781\u7b80 git \u5e93\u7684\u65b9\u6cd5\uff0c\u611f\u5174\u8da3\u53ef\u4ee5\u67e5\u770b\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=1904\">https:\/\/www.madbull.site\/?p=1904<\/a> \u3002git\u5b9e\u73b0\u4e86\u4ee3\u7801\u7ba1\u7406\u7684\u6838\u5fc3\uff0cgitlab \u66f4\u6709\u4e30\u5bcc\u7684\u6743\u9650\u7ba1\u7406\u3001\u81ea\u52a8\u6d4b\u8bd5\u3001\u7cfb\u7edf\u96c6\u6210\u7b49\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u800c\u4e14\u53ef\u89c6\u5316\u64cd\u4f5c\u4e5f\u66f4\u53cb\u597d\uff0c\u66f4\u52a0\u65b9\u4fbf\u4ee3\u7801\u7ba1\u7406\u3002\u672c\u7247\u6587\u7ae0\u4ecb\u7ecd\u4e00\u4e0b gitlab \u670d\u52a1\u7684\u642d\u5efa\u65b9\u6cd5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1\u3001\u6dfb\u52a0GitLab\u8f6f\u4ef6\u4ed3\u5e93\u6e90<\/h2>\n\n\n\n<p>\u5728\u7cfb\u7edf\u6e90\u589e\u52a0 gitlab \u7684\u8f6f\u4ef6\u4ed3\u5e93\u6e90\uff0c\u76f4\u63a5\u6267\u884c\u4ee5\u4e0b\u4ee3\u7801\u3002\uff08\u524d\u63d0\uff1a\u9700\u8981\u6709 curl \u5de5\u5177\uff0c\u6ca1\u6709\u5219\u9700\u8981\u5b89\u88c5\uff1a apt install curl\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u6210\u529f\u4f1a\u6dfb\u52a0  \/etc\/apt\/sources.list.d\/gitlab_gitlab-ce.list \u548c \/usr\/share\/keyrings\/gitlab_gitlab-ce-archive-keyring.gpg \u6587\u4ef6<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2\u3001\u5b89\u88c5gitlab\u53ca\u76f8\u5173\u8f6f\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y gitlab-ce ca-certificates postfix<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3\u3001\u4fee\u6539\u76f8\u5173\u914d\u7f6e<\/h2>\n\n\n\n<p>\u6253\u5f00 \/etc\/gitlab\/gitlab.rb \u6587\u4ef6\uff0c\u4fee\u6539\u4ee5\u4e0b\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>external_url 'https:\/\/YourIpOrDomain'\ngitlab_rails&#91;'time_zone'] = 'Asia\/Shanghai'\nnginx&#91;'enable'] = true\nnginx&#91;'redirect_http_to_https'] = true\nnginx&#91;'ssl_certificate'] = \"\/etc\/gitlab\/cert\/server.crt\"\nnginx&#91;'ssl_certificate_key'] = \"\/etc\/gitlab\/cert\/server.key\"\nnginx&#91;'ssl_ciphers'] = \"ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384\"\nnginx&#91;'ssl_prefer_server_ciphers'] = \"off\"\nnginx&#91;'listen_port'] = 443<\/code><\/pre>\n\n\n\n<p>external_url \u8bbe\u7f6e\u6210\u5bf9\u7cfb\u7edf\u7684 IP \u5730\u5740 \u6216\u8005 \u6307\u5b9a\u7684\u57df\u540d\uff08\u53ea\u8981\u57df\u540d\u6307\u5411gitlab\u4e3b\u673a\u5373\u53ef\uff09<\/p>\n\n\n\n<p>nginx\u6253\u5f00\u4e86 https \u8bbf\u95ee\uff0c\u6240\u4ee5\u9700\u8981\u9881\u5e03\u8bc1\u4e66\u3002\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=601\">https:\/\/www.madbull.site\/?p=601<\/a> \uff0c\u81ea\u7b7e\u540d\u8bc1\u4e66 \u548c <strong>Let\u2019s Encrypt<\/strong> \u9881\u53d1\u8bc1\u4e66\u90fd\u6709\u4ecb\u7ecd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4\u3001\u90e8\u7f72\u751f\u6548\u5e76\u542f\u52a8\u670d\u52a1<\/h2>\n\n\n\n<p>\u90e8\u7f72\u751f\u6548\uff1agitlab-ctl reconfigure <\/p>\n\n\n\n<p>\u542f\u52a8\u7cfb\u7edf\uff1agitlab-ctl start<\/p>\n\n\n\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee\uff0c\u9996\u6b21\u767b\u5f55\u4f7f\u7528root\u8d26\u53f7\u767b\u5f55\u5373\u53ef\uff0croot \u521d\u59cb\u5bc6\u7801\u4f1a\u4fdd\u5b58\u5728 \/etc\/gitlab\/initial_root_password \u6587\u4ef6\u3002\u4e5f\u53ef\u4ee5\u6ce8\u518c\u65b0\u8d26\u53f7\uff0c\u4e0d\u8fc7\u65b0\u8d26\u53f7\u9700\u8981root\u901a\u8fc7\u624d\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"623\" height=\"471\" src=\"https:\/\/www.madbull.site\/wp-content\/uploads\/2025\/08\/111-10.png\" alt=\"\" class=\"wp-image-2265\"\/><\/figure>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u53e6\u5916\u3001docker\u65b9\u5f0f\u5b89\u88c5<\/h2>\n\n\n\n<p>1\u3001\u627e\u4e00\u76ee\u5f55\uff0c\u5728\u6b64\u521b\u5efa gitlab \u7684\u5de5\u4f5c\u76ee\u5f55\uff0c\u5e76\u8fdb\u5165\u521a\u521b\u5efa\u7684 gitlab \u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p gitlab\/{config,logs,data}\ncd gitlab<\/code><\/pre>\n\n\n\n<p>2\u3001\u5728\u6b64\u76ee\u5f55\u521b\u5efa compose.yml \u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\u3002xx.xx.xx.xx \u9700\u8981\u6539\u6210\u81ea\u5df1\u7684 IP \u5730\u5740\u6216\u8005 \u57df\u540d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.8'\nservices:\n  gitlab:\n    image: gitlab\/gitlab-ce:latest\n    container_name: gitlab\n    restart: always\n    hostname: 'xx.xx.xx.xx'  # \u6539\u4e3a\u4f60\u7684\u57df\u540d\u6216IP\n    environment:\n      GITLAB_OMNIBUS_CONFIG: |\n        external_url 'https:\/\/xx.xx.xx.xx'\n        gitlab_rails&#91;'gitlab_shell_ssh_port'] = 2222\n    ports:\n      - \"880:80\"\n      - \"443:443\"\n      - \"2222:22\"\n    volumes:\n      - .\/config:\/etc\/gitlab\n      - .\/logs:\/var\/log\/gitlab\n      - .\/data:\/var\/opt\/gitlab\n    shm_size: '256m'<\/code><\/pre>\n\n\n\n<p>3\u3001\u542f\u52a8\uff1a <code>docker-compose up -d<\/code>  \u3002root \u7684\u521d\u59cb\u5bc6\u7801\u5c31\u5728 config\/initial_root_password<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u4ecb\u7ecd\u4e86\u4e00\u4e2a\u4f7f\u7528 git + openssh-server \u642d\u5efa\u4e00\u4e2a\u6781\u7b80 git \u5e93\u7684\u65b9\u6cd5\uff0c\u611f\u5174\u8da3\u53ef\u4ee5\u67e5\u770b\u5f80 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":552,"comment_status":"open","ping_status":"open","sticky":false,"template":"wp-custom-template-my","format":"standard","meta":{"footnotes":""},"categories":[135,166,131],"tags":[263,265,237],"class_list":["post-2264","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-tools","category-131","tag-git","tag-gitlab","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2264"}],"version-history":[{"count":6,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2264\/revisions"}],"predecessor-version":[{"id":2294,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2264\/revisions\/2294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/media\/552"}],"wp:attachment":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}