CentOS7 Gitlab ×°ÖÃÖ¸ÄÏ
centos7 gitlab ×°ÖÃÖ¸ÄÏ
¸ÅÊö
GitLab ÊÇÒ»¿î»ùÓÚGitµÄWeb½çÃæµÄGit´úÂëÍйܺʹúÂëÉó²éµÄ¿ªÔ´Èí¼þ¡£Ëü¾ßÓа汾¿ØÖÆ¡¢´úÂëÉó²é¡¢Ð×÷µÈ¹¦Ð§£¬±»ÒÔΪÊÇ GitHub µÄÍêÉÆÌ滻Ʒ¡£±¾ÎĽ«ÏÈÈÝÔÚ CentOS7 ÉÏ×°Öà GitLab µÄÀú³Ì¡£
ϵͳҪÇó
CentOS7 x64 ϵͳ£¬ÄÚ´æ 2GB ÒÔÉÏ£»
×°Öò¢Æô¶¯ Nginx£»
×°Öò¢Æô¶¯ PostgreSQL£»
×°Öò¢Æô¶¯ Redis£»
¿ªÍ¨ TCP ¶Ë¿Ú 22,80,443¡£
×°ÖÃÐëÒªÈí¼þ°ü
ΪÁË×°Öà GitLab£¬ÄúÐèÒªÔÚϵͳÉÏ×°ÖÃһЩÐëÒªÈí¼þ°ü¡£
sudo yum -y update sudo yum -y install curl openssh-server openssh-clients postfix cronie wget
µÇ¼ºó¸´ÖÆ
×°ÖÃ GitLab
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo yum -y install gitlab-ce
µÇ¼ºó¸´ÖÆ
GitLab Æô¶¯
sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÔÚÍê³É GitLab µÄ×°ÖÃÀú³ÌÖ®ºó£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÆô¶¯ GitLab£º
sudo gitlab-ctl start
µÇ¼ºó¸´ÖÆ
»á¼û GitLab
ĬÈÏÇéÐÎÏ£¬GitLab ʹÓà HTTP ÐÒéµÄ 80 ¶Ë¿Ú£¬ÓÉÓÚÔÚ×°Öà GitLab µÄÀú³ÌÖÐÒѾװÖÃÁË Nginx£¬ÒÔÊÇ¿ÉÒÔͨ¹ý»á¼ûЧÀÍÆ÷µÄ IP µØµã»òÓòÃûÀ´»á¼ûÄúµÄ GitLab ʵÀý¡£
http://<your-server-ip></your-server-ip>
µÇ¼ºó¸´ÖÆ
µÚÒ»´Î»á¼û Gitlab
µ±ÄúµÚÒ»´Î»á¼ûÄúµÄ GitLab ʵÀýµÄʱ¼ä£¬ÐèÒªÉèÖÃÒ»¸öÖÎÀíÔ±ÃÜÂ룬ÒÔ±ãÔÚÏÂÒ»´Î»á¼ûʱ¾ÙÐÐÉí·ÝÑéÖ¤¡£
ÔÚä¯ÀÀÆ÷Öлá¼û GitLab ʵÀýʱ£¬»á×Ô¶¯¶¨Ïòµ½ÃÜÂëÉèÖÃÒ³Ãæ¡£ÊäÈëÃÜÂë²¢µã»÷ “ÉèÖÃÃÜÂë” °´Å¥¡£ÃÜÂë±ØÐèÖÁÉÙ°üÀ¨Ò»¸öСд×Öĸ¡¢Ò»¸ö´óд×Öĸ¡¢Ò»¸öÊý×ÖºÍÒ»¸ö·Ç×ÖĸµÄ×Ö·û£¬³¤¶ÈÖÁÉÙΪ 8 ¸ö×Ö·û¡£ÈçÏÂͼËùʾ£º
ÉèÖÃÃÜÂëºó£¬»á×Ô¶¯¶¨Ïòµ½µÇ¼ҳÃ棬ʹÓÃÄú¸Õ¸ÕÉèÖõÄÃÜÂëµÇ¼¼´¿É¡£
Nginx ·´´ú
Nginx ·´´ú¿ÉÒÔ¼ÓËÙ GitLab ÔËÐÐËÙÂÊ¡£
ÐÞ¸Ä GitLab ÉèÖÃÎļþ
sudo vim /etc/gitlab/gitlab.rb
µÇ¼ºó¸´ÖÆ
ÕÒµ½ÏÂÃæÕâÒ»ÐУº
external_url 'http://gitlab.example.com'
µÇ¼ºó¸´ÖÆ
½«ÆäÖÐµÄ http://gitlab.example.com ¸ü¸ÄΪÄúµÄÓòÃû»ò IP µØµã¡£È»ºó½«ÉèÖÃдÈë GitLab¡£
sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÉèÖÃ Nginx
½¨ÉèÒ»¸öÐ嵀 Nginx ÉèÖÃÎļþ£º
sudo touch /etc/nginx/conf.d/gitlab.conf sudo vim /etc/nginx/conf.d/gitlab.conf
µÇ¼ºó¸´ÖÆ
Ìí¼ÓÒÔÏÂÄÚÈÝ£º
upstream gitlab-workhorse { server 127.0.0.1:8181 fail_timeout=0; } server { listen 80; # Replace with your domain name server_name gitlab.example.com; server_tokens off; ## Don't show the nginx version number, a security best practice location / { # Change this to the protocol you prefer/require. proxy_pass http://gitlab-workhorse; # Enable websocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 180; proxy_send_timeout 180; } }
µÇ¼ºó¸´ÖÆ
½«ÄÚÀïµÄ gitlab.example.com ¸ü¸ÄΪÄúµÄ Nginx ÓòÃû»ò IP¡£
ÖØÆô Nginx¡£
sudo systemctl restart nginx.service
µÇ¼ºó¸´ÖÆ
»á¼û GitLab ½çÃæ¡£
http://gitlab.example.com
µÇ¼ºó¸´ÖÆ
×ܽá
ÔÚ CentOS7 Éϴ GitLab ²»ÄÑ£¬×ñÕÕÉÏÊö°ì·¨¿ÉÒÔÔÚ¶Ìʱ¼äÄÚÍê³É»ù±¾×°Öá£ÈôÊÇÄúÐèÒª¸ü¸ß¼¶±ðµÄÉèÖ㬿ÉÒÔƾ֤ GitLab ¹Ù·½ÎĵµÖÐÌṩµÄ·½·¨¾ÙÐвÙ×÷¡£
²Î¿¼ÎÄÏ×
[1] GitLab.com
[2] GitLab Documentation
[3] How to Install Gitlab, Nginx and SSL on CentOS 7
[4] How To Install and Configure GitLab on CentOS 7
ÒÔÉϾÍÊÇCentOS7 Gitlab ×°ÖÃÖ¸ÄϵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡