{"id":2622,"date":"2026-04-10T15:10:18","date_gmt":"2026-04-10T07:10:18","guid":{"rendered":"https:\/\/www.madbull.site\/?p=2622"},"modified":"2026-04-10T15:40:06","modified_gmt":"2026-04-10T07:40:06","slug":"gitlab-ce-%e6%95%b0%e6%8d%ae%e8%bf%81%e7%a7%bb","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=2622","title":{"rendered":"gitlab-ce \u6570\u636e\u8fc1\u79fb"},"content":{"rendered":"\n<p>\u672c\u6587\u8bb0\u5f55\u4e86\u600e\u4e48\u5bf9 gitlab \u7684\u6570\u636e\u505a\u8fc1\u79fb\u3002\u4ee5 ubuntu 24.04.4 \u7cfb\u7edf\u4e3a\u4f8b\u3002<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-x-large-font-size\">\u7b2c\u4e00\u6b65\uff1a\u642d\u5efa\u65b0 gitlab \u670d\u52a1<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p>gitlab \u5b8c\u6574\u8fc1\u79fb\u9700\u8981\u4f7f\u7528\u5b8c\u5168\u4e00\u81f4\u7684 gitlab-ce \u7248\u672c\uff0c\u5426\u5219\u4f1a\u5931\u8d25\u3002<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\">1.1\u3001\u67e5\u770b\u65e7 gitlab-ce \u7248\u672c\u53f7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -l | grep gitlab-ce<\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\">1.2\u3001\u5b89\u88c5 \u5bf9\u5e94\u7248\u672c\u7684 gitlab-ce <\/p>\n\n\n\n<p>\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=2264\">https:\/\/www.madbull.site\/?p=2264<\/a> \u5b89\u88c5 gitlab-ce \u3002<\/p>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>apt \u5b89\u88c5\u65b9\u5f0f\u76f4\u63a5\u4ece\u6e90\u91cc\u5b89\u88c5\u9ed8\u8ba4 gitlab-ce \u5f88\u53ef\u80fd\u4e0d\u662f\u5bf9\u5e94\u7684\u7248\u672c\u3002\u9700\u8981\u6307\u5b9a\u7248\u672c\u5b89\u88c5\u3002\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u67e5\u770b\u6e90\u91cc\u53ef\u4ee5\u5b89\u88c5\u7684\u7248\u672c\u53f7\u3002\napt-cache madison gitlab-ce\n\n# \u5b89\u88c5\u5bf9\u5e94\u7684\u7248\u672c\uff0c\u4ee5 18.5.4-ce.0 \u4e3a\u4f8b\napt install gitlab-ce=18.5.4-ce.0 <\/code><\/pre>\n\n\n\n<p>\u9700\u8981 \u6309\u7167\u6587\u7ae0\u628a 4 \u4e2a\u6b65\u9aa4 <strong>\u5168\u90e8\u6267\u884c\u5b8c<\/strong>\uff0c\u786e\u4fdd\u65b0\u5b89\u88c5\u7684 gitlab-ce \u80fd\u591f\u6210\u529f\u542f\u52a8\u3002<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-x-large-font-size\">\u7b2c\u4e8c\u6b65\uff1a\u5907\u4efd\u5e76\u8fc1\u79fb\u65e7\u6570\u636e<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p>\u9700\u8981\u5bf9 \u65e7gitlab\u4e0a\u7684\u6570\u636e\u521b\u5efa\u5907\u4efd\uff0c\u5e76\u548c\u914d\u7f6e\u6587\u4ef6\u4e00\u8d77\uff0c\u79fb\u52a8\u5230 <strong>\u65b0gitlab\u670d\u52a1\u5668<\/strong> \u5bf9\u5e94\u7684\u8def\u5f84\u4e0b\u3002<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\">2.1\u3001\u5907\u4efd\u6570\u636e<\/p>\n\n\n\n<p>\u767b\u5f55\u65e7 gitlab \u670d\u52a1\u5668\uff0c\u6267\u884c\u5907\u4efd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gitlab-backup create<\/code><\/pre>\n\n\n\n<p>\u6570\u636e\u4f1a\u5907\u4efd\u5728\uff1a<code>\/var\/opt\/gitlab\/backups\/<\/code> \u76ee\u5f55\uff0c\u6587\u4ef6\u540d\u683c\u5f0f\u4e3a \u65f6\u95f4\u6233_\u5e74_\u6708_\u65e5_gitlab\u7248\u672c\u53f7_gitlab_backup.tar\u3002<\/p>\n\n\n\n<p>\u628a \u5907\u4efd \u6253\u5305\u7684 tar \u6587\u4ef6\uff0c\u62ff\u5230 <strong>\u65b0gitlab\u670d\u52a1\u5668<\/strong> \u5bf9\u5e94\u7684\u76ee\u5f55\uff0c\u5373 <code>\/var\/opt\/gitlab\/backups\/<\/code> \u76ee\u5f55\u3002<\/p>\n\n\n\n<p>\u4fee\u6539\u6587\u4ef6\u5c5e\u4e3b\u4e3a git:git<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown git:git \/var\/opt\/gitlab\/backups\/xxxxxxx_gitlab_backup.tar<\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\">2.2\u3001\u5907\u4efd\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p>\u628a <code>\/etc\/gitlab\/gitlab.rb<\/code> \u548c <code>\/etc\/gitlab\/gitlab-secrets.json<\/code> \u6587\u4ef6\u590d\u5236\u5230 <strong>\u65b0gitlab\u670d\u52a1\u5668<\/strong>\uff0c\u653e\u5728 <code>\/etc\/gitlab\/<\/code> \u76ee\u5f55\u4e0b<\/p>\n\n\n\n<p>\u5982\u679c \u6253\u5f00\u4e86 https \u670d\u52a1\uff0c\u9700\u8981\u628a \u8bc1\u4e66 \u548c \u79c1\u94a5 \u4e5f\u8981\u590d\u5236\u5230 <strong>\u65b0gitlab\u670d\u52a1\u5668<\/strong> \u3002<\/p>\n\n\n\n<p>\u5982\u679c \u66f4\u6362\u4e86 <code>external_url<\/code> \u9700\u8981\u91cd\u65b0\u7533\u8bf7\u8bc1\u4e66\u3002\u81ea\u7b7e\u540d\u8bc1\u4e66\u8bf7\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=601\">https:\/\/www.madbull.site\/?p=601<\/a> <\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-x-large-font-size\">\u7b2c\u4e09\u6b65\uff1a\u6062\u590d\u6570\u636e<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p>\u5728 <strong>\u65b0gitlab\u670d\u52a1\u5668<\/strong> \u4e0a\u6062\u590d\u6570\u636e\u3002<\/p>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\">3.1\u3001\u505c\u6b62\u90e8\u5206\u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo gitlab-ctl stop puma\nsudo gitlab-ctl stop sidekiq\nsudo gitlab-ctl stop nginx<\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\">3.2\u3001\u6062\u590d\u914d\u7f6e<\/p>\n\n\n\n<p>\u8fd9\u4e00\u6b65\u5c06\u5e94\u7528\u4f60\u4ece\u65e7\u670d\u52a1\u5668\u5e26\u6765\u7684\u914d\u7f6e\u548c\u5bc6\u94a5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gitlab-ctl reconfigure<\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\">3.3\u3001\u6062\u590d\u6570\u636e<\/p>\n\n\n\n<p>\u6267\u884c\u5982\u4e0b\u6267\u884c\uff0c\u5176\u4e2d <code>xxxxxxx<\/code> \u6307\u7684\u662f \u5907\u4efd\u6587\u4ef6\u540d\u4e2d <code>_gitlab_backup.tar<\/code> \u4e4b\u524d\u7684\u65f6\u95f4\u6233\u548c\u7248\u672c\u53f7\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gitlab-backup restore BACKUP=xxxxxxx<\/code><\/pre>\n\n\n\n<p>\u6062\u590d\u8fc7\u7a0b\u4e2d\uff0c\u7cfb\u7edf\u4f1a\u53d1\u51fa\u8b66\u544a\u63d0\u793a\u6570\u636e\u5e93\u5c06\u88ab\u6e05\u7a7a\u5e76\u8986\u76d6\uff0c\u8f93\u5165 <code>yes<\/code> \u7ee7\u7eed\u3002<\/p>\n\n\n\n<p class=\"has-large-font-size\">3.4\u3001\u91cd\u542f\u5e76\u68c0\u67e5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo gitlab-ctl restart\nsudo gitlab-rake gitlab:check SANITIZE=true<\/code><\/pre>\n\n\n\n<div style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-x-large-font-size\">\u6ce8\u610f\uff1a<\/p>\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--30);margin-bottom:var(--wp--preset--spacing--30);height:0px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>\u65b0\u65e7\u7248\u672c\u5fc5\u987b\u4e00\u81f4<\/strong>\uff1a\u8fd9\u662f\u6700\u5bb9\u6613\u51fa\u9519\u7684\u5730\u65b9\u3002\u5982\u679c\u7248\u672c\u4e0d\u4e00\u81f4\uff0c\u6062\u590d\u547d\u4ee4\u4f1a\u76f4\u63a5\u62a5\u9519\u5e76\u7ec8\u6b62<a href=\"https:\/\/gitlab.cn\/docs\/jh\/administration\/backup_restore\/restore_gitlab\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>\u3002<\/p>\n\n\n\n<p><strong><code>gitlab-secrets.json<\/code> \u81f3\u5173\u91cd\u8981<\/strong>\uff1a\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u4e86\u52a0\u5bc6\u5bc6\u94a5\u3002\u5982\u679c\u6ca1\u6709\u5b83\uff0c\u6062\u590d\u540e\u4f60\u5c06\u65e0\u6cd5\u767b\u5f55\u7528\u6237\uff08\u7279\u522b\u662f\u5f00\u542f\u4e86\u53cc\u56e0\u7d20\u8ba4\u8bc1\u7684\uff09\u3001CI\/CD \u53d8\u91cf\u4f1a\u5931\u6548\uff0cRunner \u4e5f\u65e0\u6cd5\u8fde\u63a5<a href=\"https:\/\/gitlab.cn\/docs\/jh\/administration\/backup_restore\/restore_gitlab\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><a href=\"https:\/\/m.yisu.com\/ask\/46676831.html\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u8bb0\u5f55\u4e86\u600e\u4e48\u5bf9 gitlab \u7684\u6570\u636e\u505a\u8fc1\u79fb\u3002\u4ee5 ubuntu 24.04.4 \u7cfb\u7edf\u4e3a\u4f8b\u3002 \u7b2c\u4e00\u6b65\uff1a\u642d\u5efa\u65b0 g [&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,154],"tags":[263,265,237,722],"class_list":["post-2622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-tools","category-131","category-154","tag-git","tag-gitlab","tag-linux","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2622","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=2622"}],"version-history":[{"count":4,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2622\/revisions"}],"predecessor-version":[{"id":2629,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2622\/revisions\/2629"}],"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=2622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}