{"id":19284,"date":"2024-11-19T15:28:41","date_gmt":"2024-11-19T07:28:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19284\/"},"modified":"2024-11-19T15:28:41","modified_gmt":"2024-11-19T07:28:41","slug":"mac%e4%b8%8a%e6%80%8e%e4%b9%88%e6%90%ad%e5%bb%bagitlab%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%9f%e8%af%a6%e7%bb%86%e6%ad%a5%e9%aa%a4%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19284\/","title":{"rendered":"mac\u4e0a\u600e\u4e48\u642d\u5efagitlab\u670d\u52a1\u5668\uff1f\u8be6\u7ec6\u6b65\u9aa4\u5206\u4eab"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u6b3e\u5f3a\u5927\u7684\u6e90\u4ee3\u7801\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u8ba9\u56e2\u961f\u534f\u4f5c\u66f4\u52a0\u9ad8\u6548\u3002\u5728mac\u7535\u8111\u4e0a\u642d\u5efagitlab\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u8ba9\u56e2\u961f\u6210\u5458\u66f4\u52a0\u65b9\u4fbf\u5730\u8fdb\u884c\u4ee3\u7801\u5171\u4eab\u548c\u534f\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5728mac\u7535\u8111\u4e0a\u642d\u5efagitlab\u670d\u52a1\u5668\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<p>\u4e00\u3001\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6<\/p>\n<p>\u5728Mac\u7535\u8111\u4e0a\u642d\u5efaGitLab\u670d\u52a1\u5668\uff0c\u9700\u8981\u5148\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\uff1a<\/p>\n<pre>brew install curl git-core nginx postgresql redis<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u8fd9\u4e9b\u8f6f\u4ef6\u662f\u5426\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\uff1a<\/p>\n<pre>curl -V\ngit --version\nnginx -v\npsql -V\nredis-server --version<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e8c\u3001\u5b89\u88c5GitLab<\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4e0b\u8f7dGitLab\u5b89\u88c5\u5305\uff1a<\/p>\n<pre>curl -LO https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/packages\/el\/7\/gitlab-ce-11.8.1-ce.0.el7.x86_64.rpm\/download.deb<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5GitLab\uff1a<\/p>\n<pre>sudo dpkg -i gitlab-ce-11.8.1-ce.0.el7.x86_64.rpm<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8GitLab\uff1a<\/p>\n<pre>sudo gitlab-ctl start<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e09\u3001\u914d\u7f6eNginx<\/p>\n<p>\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u914d\u7f6eNginx\u3002<\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Nginx\u914d\u7f6e\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>sudo nano \/etc\/nginx\/sites-available\/gitlab<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5728\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/li>\n<\/ol>\n<pre>upstream gitlab-workhorse {\n  server unix:\/var\/opt\/gitlab\/gitlab-workhorse\/socket fail_timeout=0;\n}\n\nserver {\n  listen 80;\n  listen [::]:80;\n\n  server_name your_domain.com;\n  server_tokens off;\n\n  root \/opt\/gitlab\/embedded\/service\/gitlab-rails\/public;\n\n  client_max_body_size 500m;\n\n  error_page 502 \/502.html;\n\n  location \/ {\n    # Needed to preserve gitlab components\n    proxy_read_timeout     300;\n    proxy_connect_timeout  300;\n    proxy_redirect        off;\n\n    # Do not buffer Git HTTP responses\n    proxy_buffering off;\n    proxy_http_version 1.1;\n\n    # Forward all to GitLab\n    proxy_pass http:\/\/gitlab-workhorse;\n\n    # Set headers\n    proxy_set_header Host              $http_host;\n    proxy_set_header X-Real-IP         $remote_addr;\n    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;\n    proxy_set_header X-Forwarded-Proto $scheme;\n    proxy_set_header Upgrade           $http_upgrade;\n    proxy_set_header Connection        $connection_upgrade;\n  }\n\n  error_page 404 \/404.html;\n  error_page 422 \/422.html;\n  error_page 500 \/500.html;\n  error_page 503 \/503.html;\n\n  location ~ ^\/(404|422|500|503).html$ {\n    root \/opt\/gitlab\/embedded\/service\/gitlab-rails\/public;\n    internal;\n  }\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u4fdd\u5b58\u5e76\u9000\u51fa\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u7b26\u53f7\u94fe\u63a5\uff1a<\/li>\n<\/ol>\n<pre>sudo ln -s \/etc\/nginx\/sites-available\/gitlab \/etc\/nginx\/sites-enabled\/gitlab<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u68c0\u67e5Nginx\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6b63\u786e\uff1a<\/li>\n<\/ol>\n<pre>sudo nginx -t<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u663e\u793a\u201csyntax is ok\u201d\u7b49\u5b57\u6837\uff0c\u5219\u8bf4\u660eNginx\u914d\u7f6e\u6587\u4ef6\u6b63\u786e\u3002<\/p>\n<ol>\n<li>\u91cd\u65b0\u542f\u52a8Nginx\uff1a<\/li>\n<\/ol>\n<pre>sudo service nginx restart<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u56db\u3001\u521b\u5efaGitLab\u7ba1\u7406\u5458\u8d26\u6237<\/p>\n<p>\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237\u53ef\u4ee5\u8ba9\u4f60\u66f4\u597d\u5730\u7ba1\u7406GitLab\u670d\u52a1\u5668\u3002<\/p>\n<ol>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u4f60\u7684\u670d\u52a1\u5668\u7684IP\u5730\u5740\u6216\u57df\u540d\uff0c\u5e76\u8bbf\u95eeGitLab\u7684\u7f51\u7ad9\u3002<\/li>\n<li>\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237\uff0c\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5e76\u70b9\u51fb\u63d0\u4ea4\u6309\u94ae\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u521b\u5efa\u9879\u76ee\u201d\u6309\u94ae\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9879\u76ee\u3002<\/li>\n<\/ol>\n<p>\u73b0\u5728\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u5728Mac\u7535\u8111\u4e0a\u642d\u5efa\u4e86GitLab\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u8ba9\u4f60\u7684\u56e2\u961f\u66f4\u52a0\u9ad8\u6548\u5730\u8fdb\u884c\u4ee3\u7801\u5171\u4eab\u548c\u534f\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fmac\u4e0a\u600e\u4e48\u642d\u5efagitlab\u670d\u52a1\u5668\uff1f\u8be6\u7ec6\u6b65\u9aa4\u5206\u4eab\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gitlab\u662f\u4e00\u6b3e\u5f3a\u5927\u7684\u6e90\u4ee3\u7801\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u8ba9\u56e2\u961f\u534f\u4f5c\u66f4\u52a0\u9ad8\u6548\u3002\u5728mac\u7535\u8111\u4e0a\u642d\u5efagitlab\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u8ba9\u56e2\u961f\u6210\u5458\u66f4\u52a0\u65b9\u4fbf\u5730\u8fdb\u884c\u4ee3\u7801\u5171\u4eab\u548c\u534f\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5728mac\u7535\u8111\u4e0a\u642d\u5efagitlab\u670d\u52a1\u5668\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002 \u4e00\u3001\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6 \u5728Mac\u7535\u8111\u4e0a\u642d\u5efaGitLab\u670d\u52a1\u5668\uff0c\u9700\u8981\u5148\u5b89\u88c5\u4e00\u4e9b\u5fc5\u8981\u7684\u8f6f\u4ef6\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\uff1a brew install curl git-core nginx postgresql redis \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u8fd9\u4e9b\u8f6f\u4ef6\u662f\u5426\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\uff1a curl -V git &#8211;version nginx -v psql -V redis-server &#8211;version \u767b\u5f55\u540e\u590d\u5236 \u4e8c\u3001\u5b89\u88c5GitLab \u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4e0b\u8f7dGitLab\u5b89\u88c5\u5305\uff1a curl -LO https:\/\/packages.gitlab.com\/gitlab\/gitlab-ce\/packages\/el\/7\/gitlab-ce-11.8.1-ce.0.el7.x86_64.rpm\/download.deb \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5GitLab\uff1a sudo dpkg -i gitlab-ce-11.8.1-ce.0.el7.x86_64.rpm \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8GitLab\uff1a sudo gitlab-ctl start \u767b\u5f55\u540e\u590d\u5236 \u4e09\u3001\u914d\u7f6eNginx \u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u914d\u7f6eNginx\u3002 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684Nginx\u914d\u7f6e\u6587\u4ef6\uff1a sudo nano \/etc\/nginx\/sites-available\/gitlab \u767b\u5f55\u540e\u590d\u5236 \u5728\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a upstream gitlab-workhorse { server unix:\/var\/opt\/gitlab\/gitlab-workhorse\/socket fail_timeout=0; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19284","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19284"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19284\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}