{"id":402,"date":"2022-07-19T16:47:59","date_gmt":"2022-07-19T08:47:59","guid":{"rendered":"https:\/\/www.anger.ltd\/?p=402"},"modified":"2024-08-06T11:25:00","modified_gmt":"2024-08-06T03:25:00","slug":"%e9%83%a8%e7%bd%b2gitlab%ef%bc%88yumdocker%e4%b8%a4%e7%a7%8d%e6%96%b9%e5%bc%8f%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.anger.ltd\/index.php\/2022\/07\/19\/%e9%83%a8%e7%bd%b2gitlab%ef%bc%88yumdocker%e4%b8%a4%e7%a7%8d%e6%96%b9%e5%bc%8f%ef%bc%89\/","title":{"rendered":"yum+Docker\u4e24\u79cd\u65b9\u5f0f\u90e8\u7f72GitLab"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">\u73af\u5883\u8bf4\u660e<\/h4>\n\n\n\n<p>\u7cfb\u7edf\uff1aCentos 7.9<br>Docker\uff1a20.10.17<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">yum\u65b9\u5f0f\u90e8\u7f72<\/h4>\n\n\n\n<p>\u6dfb\u52a0gitlab\u7684yum\u6e90\u4ed3\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -s https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\u4f7f\u7528\u6e05\u534e\u6e90\uff08<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">\u63a8\u8350<\/mark>\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/yum.repos.d\/gitlab-ce.repo\n## \u6dfb\u52a0\u4e0b\u9762\u7684\u5185\u5bb9\n\n&#91;gitlab-ce]\n\nname=Gitlab CE Repository\n\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/gitlab-ce\/yum\/el$releasever\/\n\ngpgcheck=0\n\nenabled=1<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5gitlab<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum  -y  install  gitlab-ce<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\u914d\u7f6egitlab\u9ed8\u8ba4\u7aef\u53e3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/gitlab\/gitlab.rb<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u7aef\u53e3\u548c\u5730\u5740<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>##! Note: During installation\/upgrades, the value of the environment variable\n##! EXTERNAL_URL will be used to populate\/replace this value.\n##! On AWS EC2 instances, we also attempt to fetch the public hostname\/IP\n##! address from AWS. For more details, see:\n##! https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/instancedata-data-retrieval.html\n## <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">external_url 'http:\/\/gitlab.example.com' ##\u5c06\u5730\u5740\u4fee\u6539\u4e3a\u4e3b\u673aIP+\u7aef\u53e3\uff0c\u4e5f\u53ef\u4ee5\u53ea\u6539\u5730\u5740\u9ed8\u8ba480\u7aef\u53e3<\/mark>\nexternal_url 'http:\/\/192.168.0.66:8800'\n\n##\u4fee\u6539ssh\u7aef\u53e3\n### GitLab Shell settings for GitLab\n## \u53bb\u6389\u6ce8\u91ca\u540e\u4fee\u6539\ngitlab_rails&#91;'gitlab_shell_ssh_port'] = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">222<\/mark> \n# gitlab_rails&#91;'gitlab_shell_git_timeout'] = 800<\/code><\/pre>\n\n\n\n<p>\u521d\u59cb\u5316gitlab<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gitlab-ctl reconfigure\n#\u8fd9\u4e00\u6b65\u9700\u8981\u65f6\u95f4\u8f83\u957f<\/code><\/pre>\n\n\n\n<p>\u521d\u59cb\u5316\u5b8c\u6210\u540e\u670d\u52a1\u5c31\u542f\u52a8\u4e86\uff0c\u53ef\u4ee5\u767b\u9646http:\/\/IP+\u7aef\u53e3 \u8bbf\u95eegitlab\uff0c\u9ed8\u8ba4\u8d26\u6237\u4e3aroot\uff0c\u521d\u59cb\u5bc6\u7801\u5b58\u50a8\u5728\/etc\/gitlab\/initial_root_password<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># WARNING: This value is valid only in the following conditions\n#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails&#91;'initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).\n#          2. Password hasn't been changed manually, either via UI or via command line.\n#\n#          If the password shown here doesn't work, you must reset the admin password following https:\/\/docs.gitlab.com\/ee\/security\/reset_user_password.html#reset-your-root-password.\n\nPassword: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">Jen0LBE6l7U3KcMdf1VwwNTjLAUs1jtDsMHgl2raiNU=<\/mark>\n\n# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5fd8\u8bb0root\u5bc6\u7801\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u91cd\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> gitlab-rake \"gitlab:password:reset&#91;root]\"\n## \u8f93\u51652\u6b21\u5bc6\u7801\u540e\u4fee\u6539\u5b8c\u6210<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"500\" src=\"https:\/\/www.anger.ltd\/wp-content\/uploads\/2022\/07\/image-7.png\" alt=\"\" class=\"wp-image-403\" srcset=\"https:\/\/www.anger.ltd\/wp-content\/uploads\/2022\/07\/image-7.png 1007w, https:\/\/www.anger.ltd\/wp-content\/uploads\/2022\/07\/image-7-300x149.png 300w, https:\/\/www.anger.ltd\/wp-content\/uploads\/2022\/07\/image-7-768x381.png 768w, https:\/\/www.anger.ltd\/wp-content\/uploads\/2022\/07\/image-7-705x350.png 705w\" sizes=\"auto, (max-width: 1007px) 100vw, 1007px\" \/><\/figure>\n\n\n\n<p>\u5230\u8fd9\u91ccyum\u65b9\u5f0f\u90e8\u7f72\u7684gitlab\u5c31\u5df2\u7ecf\u57fa\u672c\u5b8c\u6210<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Docker\u65b9\u5f0f\u90e8\u7f72<\/h4>\n\n\n\n<p>\u521b\u5efa\u6301\u4e45\u5316\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/data\/gitlab\/{conf,logs,data}<\/code><\/pre>\n\n\n\n<p>\u62c9\u53d6\u955c\u50cf\uff08\u4e5f\u53ef\u76f4\u63a5\u6267\u884c\u547d\u4ee4\uff0c\u5148\u4e0d\u62c9\u53d6\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u4e0d\u5199\u7248\u672c\u5373\u4e3a\u6700\u65b0\u955c\u50cf\ndocker pull gitlab\/gitlab-ce<\/code><\/pre>\n\n\n\n<p>\u542f\u52a8\u5bb9\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d  -p 8443:443 -p 8800:80 -p 222:22 --name gitlab --restart always -v \/data\/gitlab\/conf:\/etc\/gitlab -v \/data\/gitlab\/logs:\/var\/log\/gitlab -v \/data\/gitlab\/data:\/var\/opt\/gitlab gitlab\/gitlab-ce<\/code><\/pre>\n\n\n\n<p>\u542f\u52a8\u5b8c\u6210\u540e\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/data\/gitlab\/conf\/gitlab.rb\n\n#\u4fee\u6539IP\nexternal_url 'http:\/\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">192.168.0.66<\/mark>'\n\n#\u4fee\u6539ssh\uff0c\u8fd9\u4e2a\u5e76\u4e0d\u662f\u5b9e\u9645ssh\u7aef\u53e3\uff0c\u662fssh\u65b9\u5f0f\u514b\u9686\u4ee3\u7801\u65f6\u5019\u7684\u7aef\u53e3\ngitlab_rails&#91;'gitlab_shell_ssh_port'] = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">222<\/mark><\/code><\/pre>\n\n\n\n<p>\u91cd\u542fgitlab\u5bb9\u5668\u540e\u91cd\u65b0\u521d\u59cb\u5316<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker restart gitlab\n#\u8fdb\u5165\u5bb9\u5668\ndocker exec -it gitlab \/bin\/bash\n#\u6267\u884c\u521d\u59cb\u5316\u5e76\u91cd\u542f\ngitlab-ctl reconfigure\ngitlab-ctl restart<\/code><\/pre>\n\n\n\n<p>\u8bbf\u95ee\u5bbf\u4e3b\u673aIP+8800\uff0c\u9ed8\u8ba4\u8d26\u6237root\uff0c\u56e0\u4e3a\u5df2\u7ecf\u5bf9\u5bb9\u5668\u76ee\u5f55\u505a\u4e86\u6301\u4e45\u5316\uff0c\u6240\u4ee5\u5bc6\u7801\u5728\/data\/gitlab\/conf\/initial_root_password\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/data\/gitlab\/conf\/initial_root_password\u4e2d\n\n&#91;root@server-backend config]# cat  \/docker\/gitlib\/config\/initial_root_password \n# WARNING: This value is valid only in the following conditions\n#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails&#91;'initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).\n#          2. Password hasn't been changed manually, either via UI or via command line.\n#\n#          If the password shown here doesn't work, you must reset the admin password following https:\/\/docs.gitlab.com\/ee\/security\/reset_user_password.html#reset-your-root-password.\n\nPassword: <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-1-color\">\/Cs22USJrdsdlfj235ll3n6nlDwcat60vqk-<\/mark>\n\n# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.<\/code><\/pre>\n\n\n\n<p>\u5230\u6b64Docker\u65b9\u5f0f\u90e8\u7f72GitLab\u4e5f\u5df2\u7ecf\u57fa\u672c\u5b8c\u6210\uff0c\u65e0\u8bba\u54ea\u79cd\u65b9\u5f0f\u90e8\u7f72\uff0c\u5728\u7528\u6237\u6ce8\u518c\u5b8c\u6210\u540e\u5efa\u8bae\u5173\u95ed\u6ce8\u518c\u529f\u80fd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\u8bf4\u660e \u7cfb\u7edf\uff1aCentos 7.9Docker\uff1a20.10.17 yum\u65b9\u5f0f\u90e8\u7f72 \u6dfb\u52a0gitlab\u7684yum\u6e90\u4ed3\u5e93 \u6216\u8005\u4f7f\u7528\u6e05\u534e\u6e90\uff08\u63a8\u8350\uff09 \u5b89\u88c5gitlab \u5b89\u88c5\u5b8c\u6210\u540e\u914d\u7f6egitlab\u9ed8\u8ba4\u7aef\u53e3 \u4fee\u6539\u7aef\u53e3\u548c\u5730\u5740  &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-3"],"_links":{"self":[{"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":8,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":846,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/posts\/402\/revisions\/846"}],"wp:attachment":[{"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anger.ltd\/index.php\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}