{"id":3092,"date":"2018-01-30T22:01:05","date_gmt":"2018-01-30T14:01:05","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=3092"},"modified":"2018-01-30T22:01:05","modified_gmt":"2018-01-30T14:01:05","slug":"ubuntu-16-04%e6%90%ad%e5%bb%bagitlab%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/ubuntu-16-04%e6%90%ad%e5%bb%bagitlab%e6%9c%8d%e5%8a%a1%e5%99%a8\/","title":{"rendered":"Ubuntu 16.04\u642d\u5efaGitLab\u670d\u52a1\u5668"},"content":{"rendered":"<div id=\"li_all\"><\/div>\n<div id=\"content\">\n<p>\u60f3\u5230Gitlab\u5c31\u5fc5\u5b9a\u4f1a\u60f3\u5230SVN\uff0c\u56e0\u4e3a\u4e24\u8005\u90fd\u662f\u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\uff0c\u4f5c\u4e3a\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u7528\u4e60\u60ef\u4e86SVN\u7684\u56fe\u5f62\u5316\u754c\u9762\u548cSVN\u4ee3\u7801\u66f4\u65b0\u548c\u63d0\u4ea4\u7684\u65b9\u5f0f\uff0c<\/p>\n<p>\u53ef\u80fd\u5c31\u4f1a\u89c9\u5f97\u4f7f\u7528git\u4f1a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u5176\u5b9e\u4e0d\u7136git\u4f7f\u7528\u8d77\u6765\u975e\u5e38\u65b9\u4fbf\uff0c\u5e76\u4e14\u597d\u5904\u4e5f\u4e0d\u5c11\uff0cgit\u540e\u9762\u4f1a\u6210\u4e3a\u4e00\u79cd\u6d41\u884c\u548c\u8d8b\u52bf\u3002\u6240\u4ee5\u5728\u8fd9\u513f\u7b80\u5355\u7684\u4ecb\u7ecdGitlab<\/p>\n<p>\u670d\u52a1\u5668\u7684\u642d\u5efa\u548cgit\u7684\u4e00\u4e9b\u57fa\u672c\u64cd\u4f5c\u4f7f\u7528\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765011.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<h4>Git\u7684\u4f18\u70b9\u548c\u7f3a\u70b9\u4ecb\u7ecd<\/h4>\n<h4>\u4f18\u70b9<\/h4>\n<blockquote><p>1\u3001\u9002\u5408\u5206\u5e03\u5f0f\u5f00\u53d1\uff0c\u5f3a\u8c03\u4e2a\u4f53<\/p>\n<p>2\u3001\u516c\u5171\u670d\u52a1\u5668\u538b\u529b\u548c\u6570\u636e\u91cf\u90fd\u4e0d\u4f1a\u592a\u5927<\/p>\n<p>3\u3001\u901f\u5ea6\u5feb\u3001\u7075\u6d3b<\/p>\n<p>4\u3001\u4efb\u610f\u4e24\u4e2a\u5f00\u53d1\u8005\u4e4b\u95f4\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u89e3\u51b3\u51b2\u7a81<\/p>\n<p>5\u3001\u79bb\u7ebf\u53ef\u4ee5\u6b63\u5e38\u63d0\u4ea4\u4ee3\u7801\u548c\u5de5\u4f5c<\/p><\/blockquote>\n<h4>\u7f3a\u70b9<\/h4>\n<blockquote><p>1\u3001\u5b66\u4e60\u5468\u671f\u76f8\u5bf9\u800c\u8a00\u6bd4\u8f83\u957f<\/p>\n<p>2\u3001\u4e0d\u7b26\u5408\u5e38\u89c4\u601d\u7ef4<\/p>\n<p>3\u3001\u4ee3\u7801\u4fdd\u5bc6\u6027\u5dee\uff0c\u4e00\u65e6\u5f00\u53d1\u8005\u628a\u6574\u4e2a\u5e93\u514b\u9686\u4e0b\u6765\u5c31\u53ef\u4ee5\u5b8c\u5168\u516c\u5f00\u6240\u6709\u4ee3\u7801\u548c\u7248\u672c\u4fe1\u606f<\/p><\/blockquote>\n<h4>\u51c6\u5907\u73af\u5883<\/h4>\n<blockquote><p>Ubuntu16.04 server<\/p><\/blockquote>\n<h4>\u5b89\u88c5\u4ecb\u7ecd<\/h4>\n<blockquote><p>\u4e3b\u8981\u8bb0\u5f55\u5728Ubuntu 16.04\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u642d\u5efaGitLab\u670d\u52a1\u5668\u7684\u64cd\u4f5c\u8bb0\u5f55\uff0c\u4ee5\u4e0b\u662f\u64cd\u4f5c\u6b65\u9aa4\uff08\u4e3b\u8981\u53c2\u8003\u8d44\u6599\uff1ahttps:\/\/about.gitlab.com\/downloads\/#ubuntu1604\uff09<\/p><\/blockquote>\n<h4>Gitlab\u5b89\u88c5<\/h4>\n<h4>1.\u5b89\u88c5\u4f9d\u8d56\u5305<\/h4>\n<blockquote><p>sudo apt-get install curl openssh-server ca-certificates postfix<\/p>\n<p>\u6ce8\uff1a\u6267\u884c\u5b8c\u6210\u540e\uff0c\u51fa\u73b0\u90ae\u4ef6\u914d\u7f6e\uff0c\u9009\u62e9Internet\u90a3\u4e00\u9879\uff08\u4e0d\u5e26Smarthost\u7684\uff09<\/p><\/blockquote>\n<h4>2.\u5229\u7528\u6e05\u534e\u5927\u5b66\u7684\u955c\u50cf\uff08<a href=\"https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/gitlab-ce\/\" target=\"_blank\">https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/gitlab-ce\/<\/a>\uff09\u6765\u8fdb\u884c\u4e3b\u7a0b\u5e8f\u7684\u5b89\u88c5<\/h4>\n<h5>\u9996\u5148\u4fe1\u4efb GitLab \u7684 GPG \u516c\u94a5<\/h5>\n<blockquote><p>curl\u00a0<span class=\"hljs-keyword\">https:\/\/packages.gitlab.com\/gpg.key\u00a0<span class=\"hljs-number\">2&gt; \/dev\/<span class=\"hljs-constant\">null | sudo apt-key\u00a0<span class=\"hljs-built_in\">add &#8211; &amp;&gt;\/dev\/<span class=\"hljs-constant\">null<\/span><\/span><\/span><\/span><\/span><\/p><\/blockquote>\n<h5>\u4f7f\u7528root\u7528\u6237\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/h5>\n<blockquote><p>vi\u00a0\/etc\/apt\/sources.list.d\/gitlab-ce.list<\/p>\n<p>#\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9<\/p>\n<p>deb https:\/\/mirrors<span class=\"hljs-preprocessor\">.tuna<span class=\"hljs-preprocessor\">.tsinghua<span class=\"hljs-preprocessor\">.edu<span class=\"hljs-preprocessor\">.cn\/gitlab-ce\/ubuntu xenial main<\/span><\/span><\/span><\/span><\/p>\n<p>vi \/etc\/gitlab\/gitlab.rb<\/p>\n<p><span class=\"hljs-preprocessor\"><span class=\"hljs-preprocessor\"><span class=\"hljs-preprocessor\"><span class=\"hljs-preprocessor\">external_url &#8216;https:\/\/172.16.81.91\/&#8217;<\/span><\/span><\/span><\/span><\/p><\/blockquote>\n<h5>\u5b89\u88c5 gitlab-ce<\/h5>\n<blockquote><p>sudo apt<span class=\"hljs-attribute\">-get update<\/span><\/p>\n<p><span class=\"hljs-attribute\">sudo apt<span class=\"hljs-attribute\">-get install gitlab<span class=\"hljs-attribute\">-ce<\/span><\/span><\/span><\/p><\/blockquote>\n<h4>3.\u542f\u52a8sshd\u548cpostfix\u670d\u52a1<\/h4>\n<blockquote><p>service sshd\u00a0<span class=\"hljs-operator\"><span class=\"hljs-keyword\">start<\/span><\/span><\/p>\n<p><span class=\"hljs-operator\"><span class=\"hljs-keyword\">service postfix\u00a0<span class=\"hljs-keyword\">start<\/span><\/span><\/span><\/p><\/blockquote>\n<h4>4.\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219<\/h4>\n<blockquote><p>sudo iptables\u00a0<span class=\"hljs-attribute\">-A INPUT\u00a0<span class=\"hljs-attribute\">-p tcp\u00a0<span class=\"hljs-attribute\">-m tcp\u00a0<span class=\"hljs-subst\">&#8211;dport\u00a0<span class=\"hljs-number\">80\u00a0<span class=\"hljs-attribute\">-j ACCEPT<\/span><\/span><\/span><\/span><\/span><\/span><\/p><\/blockquote>\n<h4>5.\u542f\u52a8\u5404\u9879\u670d\u52a1<\/h4>\n<blockquote><p><span class=\"hljs-built_in\">sudo gitlab-ctl reconfigure<\/span><\/p><\/blockquote>\n<h4>6..\u68c0\u67e5GitLab\u662f\u5426\u5b89\u88c5\u597d\u5e76\u4e14\u5df2\u7ecf\u6b63\u786e\u8fd0\u884c<\/h4>\n<blockquote><p><span class=\"hljs-built_in\">sudo gitlab-ctl status<\/span><\/p>\n<p><span class=\"hljs-built_in\">#\u5982\u679c\u5f97\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u7ed3\u679c\uff0c\u5219\u8bf4\u660eGitLab\u8fd0\u884c\u6b63\u5e38<\/span><\/p>\n<p><span class=\"hljs-built_in\"><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765012.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/span><\/p><\/blockquote>\n<h4>7.\u6d4f\u89c8web\u9875\u9762\u5e76\u8bbe\u7f6e\u5bc6\u7801<\/h4>\n<blockquote><p><span class=\"hljs-built_in\">https:\/\/172.16.81.91\/<\/span><\/p>\n<p><span class=\"hljs-built_in\"><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765013.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/span><\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<h4>8.\u521b\u5efa\u7ec4<\/h4>\n<blockquote><p><span class=\"hljs-built_in\"><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765014.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/span><\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<h4>9.\u6dfb\u52a0ssh key<\/h4>\n<blockquote><p>git\u4ed3\u5e93\u4e4b\u95f4\u7684\u4ee3\u7801\u4f20\u8f93\u534f\u8bae\u4e3b\u8981\u4f7f\u7528ssh\u534f\u8bae\u3002\u800c\u4e00\u822c\u642d\u5efagitlab\u7684\u65f6\u5019\u4f7f\u7528\u7684git\u7528\u6237\u662f\u6ca1\u6709\u5bc6\u7801\u7684\uff0c\u56e0\u6b64\u76f4\u63a5ssh\u662f\u4e0d\u80fd\u767b\u5f55\u7684\uff0c\u5c31\u9700\u8981\u4f7f\u7528ssh-keygen\u4e0a\u4f20\u516c\u94a5\uff0c\u4f7f\u7528\u975e\u5bf9\u79f0\u52a0\u5bc6\u4f20\u8f93\u3002\u4e0b\u9762\u8bb2\u8ff0\u5982\u4f55\u4e0a\u4f20\u4f60\u7684ssh\u516c\u94a5\uff1a<\/p>\n<p>\u751f\u6210sshkey<\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\u6572\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u7b2c\u4e00\u6b65\u4f1a\u751f\u6210\u4e00\u5bf9\u79c1\u94a5\u548c\u516c\u94a5\uff0c\u5206\u522b\u5b58\u5728<span class=\"Apple-converted-space\">\u00a0<code>~\/.ssh\/id_rsa<\/code>\u548c<code>~\/.ssh\/id_rsa.pub<\/code>\u4e2d\u3002\u7b2c\u4e8c\u6b65\u67e5\u770b\u516c\u94a5\u5b57\u7b26\u4e32\u3002<\/span><\/p>\n<pre><code>   ssh-keygen -t rsa -C \"\u90ae\u7bb1\u5730\u5740\"\r\n   cat ~\/.ssh\/id_rsa.pub<\/code><\/pre>\n<p>\u5728\u9762\u677f\u4e0a\u4f9d\u6b21\u70b9\u51fbProfile Settings \u2013&gt; SSH Keys \u2013&gt; Add SSH Keys\u3002\u7136\u540e\u628a\u4e0a\u4e00\u6b65\u4e2d\u7684<code>id_rsa.pub<\/code>\u4e2d\u7684\u5185\u5bb9\u62f7\u8d1d\u51fa\u6765\u7c98\u8d34\u5230\u8f93\u5165\u6846\u4e2d\uff0c\u4fdd\u5b58\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765015.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<p>\u5b8c\u6210\u4e0a\u9762\u4e24\u6b65\u4e4b\u540e\u5c31\u6210\u529f\u7684\u6dfb\u52a0\u4e86sshkey\u4e86\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u4e0a\u4f20\u4ee3\u7801\u4e86\u3002<\/p><\/blockquote>\n<h4>10.\u521b\u5efa\u9879\u76ee<\/h4>\n<blockquote><p>\u521b\u5efa\u9879\u76eeTest_Project<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765016.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<p>\u4e0b\u4e00\u6b65\uff0c\u9009\u62e9\u7ec4\uff0c\u8f93\u5165\u9879\u76ee\u540d<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765017.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<p>\u4e0b\u4e00\u6b65\uff0c\u521b\u5efa\u5b8c\u6210<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765018.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<p>\u5728\u9879\u76ee\u4e0b\u9762\u4f1a\u6709git\u7684\u64cd\u4f5c\u6307\u5357\u6559\u4f60\u5982\u4f55\u64cd\u4f5c<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.linuxidc.com\/upload\/2018_01\/180115112765019.png\" alt=\"\" width=\"705\" vspace=\"5\" \/><\/p>\n<p>\u5b8c\u6210\u521b\u5efa\u9879\u76ee\uff01<\/p><\/blockquote>\n<h4>\u81f3\u6b64\uff0c\u57fa\u4e8eUbuntu 16.04 x64\u64cd\u4f5c\u7cfb\u7edf\u7684GitLab\u670d\u52a1\u5668\u642d\u5efa\u5de5\u4f5c\u5c31\u5b8c\u6210\u4e86\uff01<\/h4>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u5230Gitlab\u5c31\u5fc5\u5b9a\u4f1a\u60f3\u5230SVN\uff0c\u56e0\u4e3a\u4e24\u8005\u90fd\u662f\u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\uff0c\u4f5c\u4e3a\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u7528\u4e60\u60ef\u4e86SVN\u7684\u56fe\u5f62\u5316\u754c\u9762\u548cS &#8230; <a title=\"Ubuntu 16.04\u642d\u5efaGitLab\u670d\u52a1\u5668\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/ubuntu-16-04%e6%90%ad%e5%bb%bagitlab%e6%9c%8d%e5%8a%a1%e5%99%a8\/\" aria-label=\"\u9605\u8bfb Ubuntu 16.04\u642d\u5efaGitLab\u670d\u52a1\u5668\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[383],"class_list":["post-3092","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-ubuntu"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=3092"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3092\/revisions"}],"predecessor-version":[{"id":3093,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3092\/revisions\/3093"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=3092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=3092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=3092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}