﻿{"id":858,"date":"2022-12-01T14:48:32","date_gmt":"2022-12-01T06:48:32","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=858"},"modified":"2023-06-27T19:52:48","modified_gmt":"2023-06-27T11:52:48","slug":"centos7%e4%bd%bf%e7%94%a8yum%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=858","title":{"rendered":"Centos7\u4f7f\u7528yum\u5b89\u88c5gitlab-ce\u5e76\u5b89\u88c5git-runner\u3001\u5347\u7ea7gitlab"},"content":{"rendered":"<h1>\u5b89\u88c5gitlab-ce<\/h1>\n<h2>\u4e00\u3001\u8bbe\u7f6e\u56fd\u5185yum\u6e90<\/h2>\n<p>\u65b0\u5efa \/etc\/yum.repos.d\/<a class=\"hl hl-1\" href=\"https:\/\/so.csdn.net\/so\/search?q=gitlab&amp;spm=1001.2101.3001.7020\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=gitlab&amp;spm=1001.2101.3001.7020&quot;,&quot;extra&quot;:&quot;{\\&quot;searchword\\&quot;:\\&quot;gitlab\\&quot;}&quot;}\" data-tit=\"gitlab\" data-pretit=\"gitlab\">gitlab<\/a>-ce.repo\uff0c\u5185\u5bb9\u4e3a\uff1a<\/p>\n<pre class=\"lang:default decode:true\">[gitlab-ce]\nname=Gitlab CE Repository\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/gitlab-ce\/yum\/el$releasever\/\ngpgcheck=0\nenabled=1\n<\/pre>\n<p>\u5176\u5b9e\u8fd9\u6b65\u53ef\u9009\uff0c\u4e0d\u8bbe\u7f6e\u7684\u8bdd\uff0c\u9ed8\u8ba4\u7528\u56fd\u5916\u6e90\u7684\u8bdd\u4f1a\u975e\u5e38\u6162\u3002<\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5gitlab-ce<\/h2>\n<pre class=\"lang:default decode:true\">sudo yum makecache\nsudo yum install gitlab-ce<\/pre>\n<h2>\u4e09\u3001\u542f\u52a8gitlab<\/h2>\n<p>\u5148\u8fd0\u884c\u914d\u7f6e\u547d\u4ee4\uff1a<\/p>\n<p>gitlab-ctl reconfigure<\/p>\n<p>\u7136\u540e\u8fd0\u884c\u76f8\u5173\u7684\u542f\u52a8\u547d\u4ee4\uff1a<\/p>\n<pre class=\"lang:default decode:true\">gitlab-ctl start\ngitlab-ctl restart\ngitlab-ctl stop<\/pre>\n<h2>\u56db\u3001\u6253\u5f00gitlab\u9762\u677f<\/h2>\n<p>\u9ed8\u8ba4\u7aef\u53e3\u662f8088<\/p>\n<h1>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/h1>\n<h1>\u5b89\u88c5gitlan-runner<\/h1>\n<p>runner\u6211\u4eec\u9009\u62e9\u88c5\u76f4\u63a5\u88c5\u5728\u5bbf\u4e3b\u673a\u4e0a\uff0c\u4e0d\u63a8\u8350\u88c5\u5728docker\u91cc<\/p>\n<h2>\u4e00\u3001\u67e5\u770b\u5df2\u5b89\u88c5\u7684gitlab\u7248\u672c<\/h2>\n<p>\u6253\u5f00web\u9762\u677f\u7684help\u9875\u9762\u5373\u53ef\u770b\u5230\u3002<\/p>\n<h2>\u4e8c\u3001\u67e5\u770b\u53ef\u5b89\u88c5\u7684gitlab-runner\u7248\u672c<\/h2>\n<pre class=\"lang:default decode:true\"># \u6dfb\u52a0\u6b63\u5f0f\u7684GitLab\u5b58\u50a8\u5e93\ncurl -L \"https:\/\/packages.gitlab.com\/install\/repositories\/runner\/gitlab-runner\/script.rpm.sh\" | sudo bash\n# \u67e5\u8be2GitLab\u7248\u672c\u53f7\u5217\u8868\nyum list gitlab-runner --showduplicates | sort -r<\/pre>\n<h2>\u4e09\u3001\u5b89\u88c5\u5bf9\u5e94\u7248\u672c\u7684gitlab-runner<\/h2>\n<pre class=\"lang:default decode:true\"># \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684GitLab Runner(\u955c\u50cf\u5728\u56fd\u5916\u9700\u8981\u68af\u5b50\u6216\u8005\u5207\u6362\u963f\u91cc\u7684\u955c\u50cf)\nyum install gitlab-runner-14.5.1-1<\/pre>\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u8ddfgitlab\u7684\u7248\u672c\u5dee\u5f02\u592a\u5927\uff0c\u5219\u53ef\u80fd\u5b58\u5728\u672a\u77e5\u5f02\u5e38\u3002<\/p>\n<h2>\u56db\u3001\u8fd0\u884c\u5e76\u7ba1\u7406runner<\/h2>\n<pre class=\"lang:default decode:true \">gitlab-runner start    \u542f\u52a8gitlab-runner\ngitlab-runner stop     \u5173\u95edgitlab-runner\ngitlab-runner restart  \u91cd\u542fgitlab-runner \ngitlab-runner status   \u67e5\u770bgitlab-runner\u72b6\u6001\uff0c\u5f53\u670d\u52a1\u6b63\u5728\u8fd0\u884c\u65f6\uff0c\u9000\u51fa\u4ee3\u7801\u4e3a\u96f6\uff0c\u800c\u5f53\u670d\u52a1\u672a\u8fd0\u884c\u65f6\uff0c\u9000\u51fa\u4ee3\u7801\u4e3a\u975e\u96f6\u3002<\/pre>\n<h2>\u4e94\u3001\u6ce8\u518crunner<\/h2>\n<pre class=\"lang:default decode:true\">gitlab-runner register<\/pre>\n<p>\u76f8\u5173\u6ce8\u518c\u89e3\u91ca\uff1a<\/p>\n<ul>\n<li>Enter the GitLab instance URL (for example, https:\/\/gitlab.com\/):\u00a0===&gt;\u586bgitlab\u7684\u5730\u5740<\/li>\n<li>Enter the registration token:\u00a0===&gt; \u586bgitlab\u4e0a\u6ce8\u518crunner\u65f6\u63d0\u793a\u7684token<\/li>\n<li>Enter a description for the runner:\u00a0===&gt;\u586b\u5199runner\u7684\u63cf\u8ff0\uff08\u53ef\u4e3a\u7a7a\uff09<\/li>\n<li>Enter tags for the runner (comma-separated):\u00a0===&gt; \u586b\u5199runner\u7684\u6807\u7b7e\uff08\u540e\u9762\u9700\u8981\u7528\u5230\uff0c\u4e00\u822c\u8ddf\u9879\u76ee\u7684\u540d\u79f0\u4e00\u76f4\uff09<\/li>\n<li>Enter optional maintenance note for the runner:\u00a0===&gt; \u586b\u5199\u53ef\u7ef4\u62a4\u8bf4\u660e\uff08\u53ef\u4e3a\u7a7a\uff09<\/li>\n<li>Enter an executor: docker, docker-ssh, custom, parallels, shell, ssh, virtualbox, docker+machine, docker-ssh+machine, instance, kubernetes:\u00a0===&gt;\u586b\u5199\u6267\u884c\u5668\uff0c\u4e00\u822c\u4e3ashell<\/li>\n<\/ul>\n<h2>\u516d\u3001\u6ce8\u9500\u76f8\u5173\u547d\u4ee4<\/h2>\n<pre class=\"lang:default decode:true \">gitlab-runner  register     #\u9ed8\u8ba4\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u4f7f\u7528\uff0c\u975e\u4ea4\u4e92\u6a21\u5f0f\u5929\u673a--non-interactice\ngitlab-runner  list         #\u547d\u4ee4\u5217\u51fa\u4fdd\u5b58\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u8fd0\u884c\u7a0b\u5e8f\ngitlab-runner verify   #\u68c0\u67e5\u6ce8\u518crunner\u5341\u5206\u662f\u5426\u53ef\u4ee5\u8fde\u63a5\uff0c\u4f46\u4e0d\u9a8c\u8bc1gitlab\u670d\u52a1\u662f\u5426\u6b63\u5728\u4f7f\u7528runner.--delete\u5220\u9664\ngitlab-runner unregister #\u8be5\u547d\u4ee4\u4f7f\u7528gitlablab\u53d6\u6d88\u4ee5\u53ca\u5df2\u6ce8\u518c\u7684runner\n\n#\u4f7f\u7528\u4ee4\u724c\u6ce8\u9500\ngitlab-runner unregister--url http:\/\/gitlab.example.com\/--tokentok3n\n\n#\u4f7f\u7528\u540d\u79f0\u6ce8\u9500\uff08\u540c\u540d\u5220\u9664\u4e00\u4e2a\uff09\ngtlab-runner  unregister --name test-runner\n\n#\u6ce8\u9500\u6240\u6709\ngitlab-runner   unregister --all-runners<\/pre>\n<h2>\u4e03\u3001\u5176\u4ed6\u7591\u95ee<\/h2>\n<p>\u63d0\u793a\uff1a\u6b64\u4f5c\u4e1a\u5df2\u963b\u585e\uff0c\u56e0\u4e3a\u8be5\u9879\u76ee\u6ca1\u6709\u5206\u914d\u4efb\u4f55\u53ef\u7528Runner\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\u4e00\uff1a\u5728.gitlab-ci.yml\u4e2d\u8865\u5145\u5bf9\u5e94\u7684runner-tag\u7684\u540d\u79f0<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\u4e8c\uff1a\u8bbe\u7f6erunner\u53ef\u6267\u884c\u6ca1\u6709\u6807\u7b7e\u7684\u4f5c\u4e1a\uff1a<\/p>\n<p><a href=\"http:\/\/blog.sway.com.cn\/wp-content\/uploads\/2022\/12\/20221201190512.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-871\" src=\"http:\/\/blog.sway.com.cn\/wp-content\/uploads\/2022\/12\/20221201190512-1024x681.png\" alt=\"20221201190512\" width=\"700\" height=\"466\" srcset=\"http:\/\/blog.sway.com.cn\/wp-content\/uploads\/2022\/12\/20221201190512-1024x681.png 1024w, http:\/\/blog.sway.com.cn\/wp-content\/uploads\/2022\/12\/20221201190512-300x199.png 300w, http:\/\/blog.sway.com.cn\/wp-content\/uploads\/2022\/12\/20221201190512.png 1142w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<h1>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/h1>\n<h1>\u5347\u7ea7gitlab<\/h1>\n<p>\u5230gitlab\u5b98\u7f51\u67e5\u770b\u6700\u4f73\u5347\u7ea7\u8def\u5f84\uff1a<\/p>\n<p>https:\/\/docs.gitlab.com\/ee\/update\/index.html#upgrade-paths<\/p>\n<p>https:\/\/docs.gitlab.com\/ee\/update\/index.html#upgrade-paths<\/p>\n<pre class=\"lang:default decode:true \">yum install gitlab-ce-&lt;version&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5gitlab-ce \u4e00\u3001\u8bbe\u7f6e\u56fd\u5185yum\u6e90 \u65b0\u5efa \/etc\/yum.repos &hellip; <a href=\"http:\/\/blog.sway.com.cn\/?p=858\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-858","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=858"}],"version-history":[{"count":10,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/858\/revisions"}],"predecessor-version":[{"id":1464,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/858\/revisions\/1464"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=858"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}