linuxÔõô´î½¨gitlabÇéÐÎ
gitlabÊÇÒ»¸ö¿ªÔ´µÄ´úÂëÍйÜϵͳ£¬¿ÉÒÔ×ÊÖúÍŶӽ¨Éè˽ÓеÄgit´æ´¢¿â¡¢´úÂëÉó²é¡¢ÎÊÌâ¸ú×Ù¡¢Ò»Á¬¼¯³ÉºÍÐû²¼¡£ÔÚlinuxÇéÐÎÏ´gitlab¿ÉÒÔÌṩһ¸öÀû±ãµÄ´úÂëÖÎÀíƽ̨¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«ÏÈÈÝÔõÑùÔÚlinuxÇéÐÎÖдgitlab¡£
×°ÖÃÐëÒªÈí¼þ
ÔÚ×°ÖÃGitLab֮ǰ£¬ÎÒÃÇÐèҪȷ±£ÒÔÏÂÈí¼þÒѾװÖãº
Git
curl
openssh-server
ca-certificates
postfix
ÕâЩÈí¼þ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî¾ÙÐÐ×°Öãº
$ sudo apt-get update $ sudo apt-get install -y curl openssh-server ca-certificates postfix
µÇ¼ºó¸´ÖÆ
×°ÖÃGitLab
¿ÉÒÔͨ¹ýGitLab¹Ù·½¿ÍÕ»À´×°ÖÃGitLab£º
$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
µÇ¼ºó¸´ÖÆ
È»ºó£¬Í¨¹ýÒÔÏÂÏÂÁî×°ÖÃGitLab£º
$ sudo apt-get install gitlab-ce
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÆô¶¯GitLab£º
$ sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÉèÖÃGitLab
»á¼ûGitLab£¬Ê״εǼÐèÒªÉèÖÃÖÎÀíÔ±ÕË»§ºÍÃÜÂë¡£½ÓÏÂÀ´£¬¿ÉÒÔͨ¹ýÖÎÀíÒ³ÃæÀ´ÉèÖÃGitLab¡£
3.1 ÉèÖÃSMTPЧÀÍÆ÷
GitLabÉϵÄÓʼþ֪ͨÐèÒªÒ»¸öSMTPЧÀÍÆ÷£¬ÕâÀïÎÒÃǽ«Ê¹ÓÃPostfixÀ´ÉèÖá£
ÔÚ/etc/gitlab/gitlab.rbÎļþÖУ¬Ìí¼ÓÒÔÏÂÄÚÈÝ£º
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.gmail.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "your_email@example.com" gitlab_rails['smtp_password'] = "your_password" gitlab_rails['smtp_domain'] = "example.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = false
µÇ¼ºó¸´ÖÆ
Ìæ»»smtp_address¡¢smtp_user_nameºÍsmtp_passwordΪÄú×Ô¼ºµÄÐÅÏ¢¡£
È»ºóÖØÐÂÉèÖÃGitLab£º
$ sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
3.2 ÉèÖÃHTTPS
ÆôÓÃHTTPS¿ÉÒÔÌá¸ßGitLabµÄÇå¾²ÐÔ¡£ÕâÀïÎÒÃǽ«Ê¹ÓÃLet’s EncryptÀ´ÌìÉúÃâ·ÑµÄSSLÖ¤Êé¡£
Ê×ÏÈ£¬×°ÖÃCertbot£º
$ sudo apt-get install certbot python-certbot-nginx
µÇ¼ºó¸´ÖÆ
È»ºó£¬ÔËÐÐÒÔÏÂÏÂÁîÀ´ÌìÉúÖ¤Ê飺
$ sudo certbot certonly --standalone -d example.com -d www.example.com
µÇ¼ºó¸´ÖÆ
Ìæ»»example.comºÍwww.example.comΪÄú×Ô¼ºµÄÐÅÏ¢¡£
ÌìÉúµÄÖ¤ÊéºÍÃÜԿλÓÚ/etc/letsencrypt/live/example.com/Ŀ¼Ï¡£
ÔÚ/etc/gitlab/gitlab.rbÎļþÖУ¬Ìí¼ÓÒÔÏÂÄÚÈÝ£º
nginx['redirect_http_to_https'] = true nginx['ssl_certificate'] = "/etc/letsencrypt/live/example.com/fullchain.pem" # Ì滻ΪÄúµÄÖ¤Êé·¾¶ nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/example.com/privkey.pem" # Ì滻ΪÄúµÄÃÜԿ·¾¶
µÇ¼ºó¸´ÖÆ
È»ºóÖØÐÂÉèÖÃGitLab£º
$ sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÔÚÓòÃûÉèÖÃÖÐÖ¸¶¨Ö¤ÊéÎļþ£¬¼´¿ÉÆôÓÃHTTPS¡£
ʹÓÃGitLab
ÏÖÔÚ£¬¿ÉÒÔͨ¹ýä¯ÀÀÆ÷»á¼ûGitLabÁË¡£Ä¬ÈÏURLΪhttp://your_server_ip»òhttps://your_domain¡£
ÔÚGitLabÉϽ¨ÉèÏîÄ¿£¬ÉÏ´«´úÂ룬Ìí¼Ó³ÉÔ±£¬¾ÙÐдúÂëÉó²éµÈ¡£
×ܽá
±¾ÎÄÏÈÈÝÁËÔÚLinuxÇéÐÎÏ´GitLabµÄ°ì·¨¡£Ê×ÏÈ×°ÖÃÐëÒªÈí¼þ£¬È»ºó×°ÖÃGitLab£¬ÉèÖÃSMTPЧÀÍÆ÷ºÍHTTPS£¬×îºóʹÓÃGitLab¾ÙÐдúÂëÖÎÀí¡£Í¨¹ý´î½¨GitLab£¬¿ÉÒÔÌṩÍŶӹ²Ïí´úÂëµÄÖÎÀíƽ̨£¬Ìá¸ß´úÂëÐ×÷ЧÂÊ£¬±ãÓÚ´úÂ뿪·¢ºÍά»¤¡£
ÒÔÉϾÍÊÇlinuxÔõô´î½¨gitlabÇéÐεÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡