{"id":1101,"date":"2016-12-20T18:51:05","date_gmt":"2016-12-20T10:51:05","guid":{"rendered":"https:\/\/yanjingang.com\/blog\/?p=1101"},"modified":"2018-12-17T20:22:57","modified_gmt":"2018-12-17T12:22:57","slug":"centos6%e5%ae%89%e8%a3%85gitlab","status":"publish","type":"post","link":"https:\/\/yanjingang.com\/blog\/?p=1101","title":{"rendered":"CentOS7\u5b89\u88c5GitLab\uff08nginx\u51b2\u7a81\u3001\u7aef\u53e3\u66f4\u6539\uff09"},"content":{"rendered":"<h1 class=\"page-subtitle\">GitLab\u4ecb\u7ecd<\/h1>\n<div>\n<p>gitlab\u662f\u5c06issues, code review, CI and CD \u6574\u5408\u5230\u72ec\u7acb\u7684\u7f51\u7ad9UI\uff0c\u7248\u672c\u63a7\u5236\u4f7f\u7528GIT\u3002gitlab \u5206\u4e3a Gitlab Community Edition(gitlab\u793e\u533a\u7248\u53c8\u79f0gitlab-ce)\u3001Gitlab Enterprise Edition(gitlab\u4f01\u4e1a\u7248\u53c8\u79f0gitlab-ee)\uff1bce\u548cee\u7684\u533a\u522b\u5728\u4e8ece\u7684\u529f\u80fd\u5728ee\u91cc\u9762\u90fd\u6709\uff0c\u800cEE\u91cc\u6709\u7684\u529f\u80fdCE\u4e0d\u4e00\u5b9a\u652f\u6301\u3002\u5982\u679c\u8981\u7528\u9ad8\u7ea7\u529f\u80fd\uff0c\u5c31\u82b1\u94b1\u5411gitlab\u56e2\u961f\u91c7\u8d2d\u5427\uff01\uff01<\/p>\n<h1>GitLab\u67b6\u6784<\/h1>\n<div class=\"image-package\">\n<div class=\"image-container\">\n<div class=\"image-container-fill\"><\/div>\n<div class=\"image-view\" data-width=\"987\" data-height=\"796\"><img class=\"\" src=\"\/\/upload-images.jianshu.io\/upload_images\/3796318-37ae1d70623607d6?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/700\" data-original-src=\"\/\/upload-images.jianshu.io\/upload_images\/3796318-37ae1d70623607d6\" data-original-width=\"987\" data-original-height=\"796\" data-original-format=\"image\/png\" data-original-filesize=\"63201\" \/><\/div>\n<\/div>\n<div class=\"image-caption\">GitLab Application Architecture<\/div>\n<\/div>\n<p>gitlab\u4f7f\u7528ruby on rails\u6846\u67b6\u7f16\u5199\u7684\u4e00\u4e2aweb\u754c\u9762\u7684\u4ee3\u7801\u4ed3\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u5728\u8fd0\u884c\u4e2d\u4f7f\u7528\u4e86\u6570\u636e\u5e93\uff08postgresql[\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u6570\u636e\u5e93\u4ee3\u66ff\u5982mysql]\uff09\u3001redis\u3001nginx\u3001gitlab-shell\u7b49\u7ec4\u4ef6\u6765\u4fdd\u8bc1gitlab\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<h1>\u5b89\u88c5GitLab<\/h1>\n<p>centos\u4e2d\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u914d\u7f6eyum\u6e90\u7136\u540e\u4f7f\u7528yum\u8fdb\u884c\u4e00\u952e\u5b89\u88c5<\/p>\n<h3>\u914d\u7f6eyum\u6e90<\/h3>\n<p>\u56fd\u5185\u53ef\u4ee5\u4f7f\u7528\u7684\u6e05\u534e\u5927\u5b66\u7684\u955c\u50cf\u6e90\u5b89\u88c5GitLab\uff0c\u76f8\u5173\u914d\u7f6e\u53ca\u5b89\u88c5\u53c2\u7167\uff1a<a href=\"https:\/\/link.jianshu.com?t=https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/gitlab-ce\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/gitlab-ce\/<\/a><br \/>\n\u4ee5\u4e0b\u5185\u5bb9\u5199\u5165yum\u6e90\u914d\u7f6e\u6587\u4ef6\uff1a\/etc\/yum.repos.d\/gitlab-ce.repo<\/p>\n<pre class=\"hljs ruby\"><code class=\"ruby\">[gitlab-ce]\nname=Gitlab CE Repository\nbaseurl=<span class=\"hljs-symbol\">https:<\/span>\/<span class=\"hljs-regexp\">\/mirrors.tuna.tsinghua.edu.cn\/gitlab<\/span>-ce\/yum\/el$releasever\/\ngpgcheck=<span class=\"hljs-number\">0<\/span>\nenabled=<span class=\"hljs-number\">1<\/span>\n<\/code><\/pre>\n<h3>\u5b89\u88c5<\/h3>\n<p>gitlab-ce\u4e00\u952e\u5b89\u88c5\u540e\u53ef\u4ee5\u5229\u7528rpm -ql gitlab-ce\u67e5\u8be2\u5176\u6587\u4ef6\u5b89\u88c5\u8def\u5f84\u53ca\u76f8\u5173\u6587\u4ef6\u8def\u5f84\uff0c\u5176\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u4e3a\/opt\/gitlab\/\u3002<\/p>\n<h5>\u76f8\u5173\u9ed8\u8ba4\u4f4d\u7f6e<\/h5>\n<p>\u7a0b\u5e8f\u6570\u636e\u53ca\u914d\u7f6e\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\u4e3a\/var\/opt\/gitlab\u4e0b\uff08\u6b64\u8def\u5f84\u662f\u8fd0\u884cgitlab-ctl reconfigure\u540e\u6839\u636e\/etc\/gitlab\/gitlab.rb\u914d\u7f6e\u81ea\u52a8\u751f\u6210\u7684\uff09<\/p>\n<p>\u4ee3\u7801\u4ed3\u5e93\u4fdd\u5b58\u4f4d\u7f6e\uff1a\/var\/opt\/gitlab\/git-data\/repositories\/<br \/>\n\u4ee3\u7801\u4ed3\u5e93\u5907\u4efd\u4f4d\u7f6e\uff1a\/var\/opt\/gitlab\/backups\/<br \/>\npostgresql\u6570\u636e\u53ca\u914d\u7f6e\u76ee\u5f55\uff1a\/var\/opt\/gitlab\/postgresql\/data\/<br \/>\nredis\u9ed8\u8ba4\u914d\u7f6e\u76ee\u5f55\uff1a\/var\/opt\/gitlab\/redis<br \/>\ngitlab\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6\uff1a\/etc\/gitlab\/gitlab.rb<\/p>\n<pre class=\"hljs undefined\"><code>yum makecache\nyum install -y gitlab-ce\n<\/code><\/pre>\n<h1>gitlab\u5e38\u89c1\u914d\u7f6e<\/h1>\n<pre class=\"hljs bash\"><code class=\"bash\"><span class=\"hljs-comment\">vim \/etc\/gitlab\/gitlab.rb\n#\u4fee\u6539gitlab\u8fd0\u884c\u5916\u90e8URL\u9ed8\u8ba4\u7684\u8bbf\u95ee\u5730\u5740<\/span>\nexternal_url <span class=\"hljs-string\">'http:\/\/47.92.25.83:82'<\/span>  \n\nvi \/etc\/gitlab\/gitlab.rb \n#\u4fee\u6539\u9ed8\u8ba4\u7aef\u53e3\nnginx[<span class=\"hljs-string\">'listen_port'<\/span>] = <span class=\"hljs-number\">82<\/span> #\u9ed8\u8ba4\u503c\u5373<span class=\"hljs-number\">80<\/span>\u7aef\u53e3 nginx[<span class=\"hljs-string\">'listen_port'<\/span>] = <span class=\"hljs-keyword\">nil\nunicorn[<span class=\"hljs-string\">'port'<\/span>] = <span class=\"hljs-number\">8082<\/span><span class=\"hljs-comment\">#\u539f\u503cunicorn['port'] = 8080<\/span><\/span>\n\n#\u6e05\u7406\u4e34\u65f6\u6587\u4ef6\nrm <\/code>\/<span class=\"hljs-keyword\">var<\/span>\/opt\/gitlab -rf #\u91cd\u65b0\u521d\u59cb\u5316gitlab gitlab-ctl reconfigure gitlab-ctl restart<\/pre>\n<h1>\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u95ee\u9898<\/h1>\n<h4>\u5b89\u88c5GitLab\u51fa\u73b0ruby_block[supervise_redis_sleep] action run<\/h4>\n<p>\u5728\u5378\u8f7dgitlab\u7136\u540e\u518d\u6b21\u5b89\u88c5\u6267\u884csudo gitlab-ctl reconfigure\u7684\u65f6\u5019\u5f80\u5f80\u4f1a\u51fa\u73b0\uff1aruby_block[supervise_redis_sleep] action run\uff0c\u4f1a\u4e00\u76f4\u5361\u65e0\u6cd5\u5f80\u4e0b\u8fdb\u884c\uff01<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>1\u3001\u6309\u4f4fCTRL+C\u5f3a\u5236\u7ed3\u675f\uff1b<\/p>\n<p>2\u3001\u8fd0\u884c\uff1asudo systemctl restart gitlab-runsvdir\uff1b<\/p>\n<p>3\u3001\u518d\u6b21\u6267\u884c\uff1asudo gitlab-ctl reconfigure<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u6765\u6e90\uff1ahttps:\/\/gitlab.com\/gitlab-org\/omnibus-gitlab\/issues\/160<\/p>\n<\/div>\n<p class=\"page-subtitle\">\n<p class=\"page-subtitle\"><code class=\"hljs javascript has-numbering\"><\/code><\/p>\n<h1>\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95eeGitLab<\/h1>\n<div class=\"tab-step\"><\/div>\n<p>http:\/\/<span class=\"s1\">47.92.25.83<\/span>:82\/<\/p>\n<p>\u9996\u6b21\u8bbf\u95eeGitLab,\u7cfb\u7edf\u4f1a\u8ba9\u4f60\u91cd\u65b0\u8bbe\u7f6e\u7ba1\u7406\u5458\u7684\u5bc6\u7801,\u8bbe\u7f6e\u6210\u529f\u540e\u4f1a\u8fd4\u56de\u767b\u5f55\u754c\u9762. \uff08r1\uff09<\/p>\n<p>\u9ed8\u8ba4\u7684\u7ba1\u7406\u5458\u8d26\u53f7\u662f<strong>root<\/strong>,\u5982\u679c\u4f60\u60f3\u66f4\u6539\u9ed8\u8ba4\u7ba1\u7406\u5458\u8d26\u53f7,\u8bf7\u8f93\u5165\u4e0a\u9762\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\u767b\u5f55\u7cfb\u7edf\u540e\u4fee\u6539\u5e10\u53f7\u540d.\uff08yanjingang\uff09<\/p>\n<div class=\"tab-step\">\n<p><span style=\"color: #ff0000;\">\u5982\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee\u9047\u5230502\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u89e3\u51b3<\/span>\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">\u53c2\u89c1\uff1ahttps:\/\/gitlab.com\/gitlab-org\/omnibus-gitlab\/blob\/master\/README.md\nsudo gitlab-ctl restart sidekiq\nsudo gitlab-ctl hup unicorn<\/code><\/pre>\n<h1>git\u4f7f\u7528<\/h1>\n<\/div>\n<p>a.\u5728gitlab web\u754c\u9762\u4e0a\u65b0\u5efatest\u9879\u76ee<\/p>\n<p>b.\u5728\u5f00\u53d1\u673a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">git config --global user.name \"yanjingang\"\ngit config --global user.email \"yanjingang@mail.com\"\n\ngit clone http:\/\/115.29.47.99:8090\/yanjingang\/test.git\ncd test\ntouch README.md\ngit add README.md\ngit commit -m \"add README\"\n\nvim .git\/config  #\u5728url\u524d\u7f00\u4e0a\u81ea\u5df1\u7528\u6237\u540d@\uff0c\u5426\u5219push\u65f6\u4f1a\u9047\u5230401\u9519\u8bef\n [remote \"origin\"]\n   fetch = +refs\/heads\/*:refs\/remotes\/origin\/*\n   url = http:\/\/yanjingang@115.29.47.99:8090\/yanjingang\/test.git\n\ngit push -u origin master<\/code><\/pre>\n<p>c.\u5728gitlab\u00a0web\u754c\u9762\u4e0atest\u9879\u76ee\u4e0b\u5373\u53ef\u770b\u5230\u672c\u6b21\u7684\u63d0\u4ea4\u65e5\u5fd7\u548c\u5185\u5bb9\u3002<\/p>\n<p>d.\u56e2\u961f\u5176\u5b83\u6210\u5458\u521b\u5efagitlab\u8d26\u53f7\u5e76\u4f7f\u5373\u7528\u53ef<\/p>\n<p>\u53c2\u8003\uff1a<\/p>\n<p>https:\/\/www.gitlab.com.cn\/installation\/#centos-7<\/p>\n<p>https:\/\/www.jianshu.com\/p\/aec2fcb88f6f<\/p>\n<p>https:\/\/www.jianshu.com\/p\/aec2fcb88f6f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gitlab\u662f\u5c06issues, code review, CI and CD \u6574\u5408\u5230\u72ec\u7acb\u7684\u7f51\u7ad9UI\uff0c\u7248\u672c\u63a7\u5236\u4f7f\u7528GIT\u3002gitlab \u5206\u4e3a Gitlab Community Edition(gitlab\u793e\u533a\u7248\u53c8\u79f0gitlab-ce)\u3001Gitlab Enterprise Edition(gitlab\u4f01\u4e1a\u7248\u53c8\u79f0gitlab-ee)\uff1bce\u548cee\u7684\u533a\u522b\u5728\u4e8ece\u7684\u529f\u80fd\u5728ee\u91cc\u9762\u90fd\u6709\uff0c\u800cEE\u91cc\u6709\u7684\u529f\u80fdCE\u4e0d\u4e00\u5b9a\u652f\u6301\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[452],"tags":[453],"_links":{"self":[{"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1101"}],"collection":[{"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1101"}],"version-history":[{"count":0,"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1101\/revisions"}],"wp:attachment":[{"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yanjingang.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}