ÔõÑùÔÚÀëÏßÇéÐÎÏÂ×°ÖÃGitLab
gitlabÊÇÒ»¸öÊ¢ÐеĻùÓÚwebµÄgit´æ´¢¿âÖÎÀí¹¤¾ß£¬ËüÌṩÁËһϵÁеİ汾¿ØÖƺÍÐ×÷¹¦Ð§£¬¿ÉÒÔ×ÊÖúÍŶÓÓÐÓõؾÙÐдúÂëÖÎÀí¡£È»¶ø£¬ÔÚ¾ßÓÐÓÅÒìµÄ»¥ÁªÍøÅþÁ¬µÄÇéÐÎÏ£¬½«gitlab×°ÖÃÔÚÍâµØЧÀÍÆ÷ÉÏͨ³£ÊÇ×î¼ÑÑ¡Ôñ¡£¿ÉÊÇ£¬ÈôÊÇÄãµÄЧÀÍÆ÷ÎÞ·¨ÅþÁ¬µ½»¥ÁªÍø£¬ÄÇôÀëÏß×°ÖÃgitlab¾Í³ÉΪÁ˱ØÐèµÄÑ¡Ôñ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚÀëÏßÇéÐÎÏÂ×°ÖÃgitlab¡£
ÏÂÔØGitLabÔ´Âë
Ê×ÏÈ£¬ÐèÒª´ÓGitLab¹Ù·½ÍøÕ¾ÏÂÔØÔ´Âë¡£¿ÉÒÔÑ¡ÔñÒ»¸öÌض¨µÄ°æ±¾£¬Ò²¿ÉÒÔÏÂÔØ×îеÄÎȹ̰汾¡£ÏÂÔغ󣬽«Ô´Âë°ü¿½±´µ½Ä¿µÄ»úеµÄÍâµØ´æ´¢»òÕßÓлá¼ûȨÏÞµÄÍøÂçλÖá£
×°ÖÃÒÀÀµ
ÔÚ×îÏÈ×°ÖÃGitLab֮ǰ£¬ÐèҪȷÈÏÄ¿µÄ»úеÉÏÊÇ·ñ×°ÖÃÁËÏìÓ¦µÄÒÀÀµÏî¡£GitLabÐèÒªÒÀÀµÒÔϵÄÈí¼þ°üºÍ¿â£º
redis
ruby
postfix or sendmail (optional)
build-essential
libmysqlclient-dev
ÔÚʹÓÃapt-get¾ÙÐÐ×°ÖÃ֮ǰ£¬ÒªÈ·±£Ä¿µÄ»úеÄܹ»ÅþÁ¬µ½ubuntu/Debian¹Ù·½Èí¼þ¿ÍÕ»£¬²»È»¿ÉÒÔÏÈ´ÓÍⲿÉúÑĵ½Ó²ÅÌ£¬È»ºóͨ¹ýÏÂÁîÐÐ×°Öá£
ÀýÈ磺ÔÚUbuntuϵͳÉÏ×°ÖÃÐëÒªµÄÒÀÀµÐÔ£¬¿ÉÒÔʹÓÃÏÂÃæµÄÏÂÁ
sudo apt-get update sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
µÇ¼ºó¸´ÖÆ
ÉèÖÃÇéÐαäÁ¿
ΪÁËÈ·±£GitLab¿ÉÒÔÕý³£ÊÂÇ飬ÐèÒª¶ÔһЩÇéÐαäÁ¿¾ÙÐÐÉèÖá£ÕâЩÇéÐαäÁ¿°üÀ¨£º
GITLAB_HOME – GitLabµÄ¸ùĿ¼£¬ÓÃÓÚ´æ´¢GitLabµÄÊý¾ÝÎļþ¡£
GITLAB_LOG_DIR – GitLabµÄÈÕ־Ŀ¼¡£
GITLAB_BACKUP_DIR – GitLabµÄ±¸·ÝĿ¼¡£
UNICORN_WORKERS – UnicornµÄÊÂÇéÀú³ÌÊýÄ¿¡£
SIDEKIQ_WORKERS – SidekiqµÄÊÂÇéÀú³ÌÊýÄ¿¡£
ÔÚUbuntuϵͳÉÏ£¬¿ÉÒÔ½«ÕâЩÇéÐαäÁ¿Ìí¼Óµ½/etc/profileÎļþÖУº
export GITLAB_HOME=/data/gitlab export GITLAB_LOG_DIR=/var/log/gitlab export GITLAB_BACKUP_DIR=/var/opt/gitlab/backups export SIDEKIQ_WORKERS=4 export UNICORN_WORKERS=4
µÇ¼ºó¸´ÖÆ
×°ÖÃRuby
ÓÉÓÚGitLabÊÇÓÉRuby on Rails±àдµÄ£¬ÒÔÊÇÐèҪװÖÃRuby¡£¿ÉÒÔ´ÓRuby¹Ù·½ÍøÕ¾ÏÂÔØÎȹ̰汾µÄRuby¡£
curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm rvm install 2.6.5 rvm use 2.6.5 --default
µÇ¼ºó¸´ÖÆ
×°ÖÃGitLab
ÏÖÔÚ£¬¿ÉÒÔ×îÏÈ×°ÖÃGitLabÁË¡£Ê×ÏÈ£¬Í¨¹ý½âѹËõGitLabÔ´´úÂë°üÀ´×°ÖÃGitLab¡£¿ÉÒÔʹÓÃÏÂÁÐÏÂÁ
tar zxvf gitlab-x_x_x.tar.gz cd gitlab-x_x_x/
µÇ¼ºó¸´ÖÆ
È»ºó£¬¿ÉÒÔÔËÐÐÏÂÁî¾ÙÐÐGitLabµÄÉèÖúÍ×°Öãº
sudo ./configure --disable-absolute_paths_in_gitlab_yaml --disable-ssh --disable-postgresql --disable-geoip_database --disable-dependency-tracking sudo make install
µÇ¼ºó¸´ÖÆ
ÉèÖÃGitLab
×°Öúó£¬ÐèÒª¶ÔGitLab¾ÙÐÐÉèÖá£ÔÚGitLabµÄÔ´´úÂëÖУ¬ÓÐÒ»¸öÃûΪ¡°gitlab.yml¡±µÄÎļþ£¬Ëü°üÀ¨GitLabµÄËùÓÐÉèÖá£
ÔÚÀëÏßÇéÐÎÏ£¬ÐèÒª×öÒÔϼ¸²½£º
½«»á¼ûIPµØµã¸ü¸ÄΪÄÚ²¿ÍøÂçIPµØµã¡£
ÉèÖÃSMTPµØµã£¬ÒÔ±ãGitLabÄܹ»·¢Ë͵ç×ÓÓʼþ¡£
ÉèÖÃGitLabµÄÖ÷³ÖÃûºÍ´«ÊäÐÒ飨http»òhttps£©¡£
ÉèÖÃGitLabÊý¾ÝÎļþºÍÈÕÖ¾ÎļþµÄ´æ´¢Î»Öá£
ÉèÖÃÍê³Éºó£¬ÖØÆôGitLab¡£
×°ÖÃSSLÖ¤Êé
×îºó£¬¿ÉÒÔΪGitLabÉèÖÃSSLÖ¤Êé¡£ÔÚÕâÀÐèҪʹÓÿª·¢×Ô¼ºµÄÖ¤Ê飬ÓÉÓÚÔÚÀëÏßÇéÐÎÏÂÎÞ·¨Ê¹Óù«¹²Ö¤Êé½ÒÏþ»ú¹¹£¨CA£©½ÒÏþµÄÖ¤Êé¡£
ʹÓñ¾ÏÂÁÉè×ÔÊðÃûÖ¤ÊéºÍÃÜÔ¿£º
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/gitlab/ssl/gitlab.key -out /etc/gitlab/ssl/gitlab.crt
µÇ¼ºó¸´ÖÆ
½«ÒÔÏÂ3ÐÐÌí¼Óµ½GitLabÉèÖÃÎļþÖУº
ssl_certificate /etc/gitlab/ssl/gitlab.crt; ssl_certificate_key /etc/gitlab/ssl/gitlab.key;
µÇ¼ºó¸´ÖÆ
×îºó£¬ÖØÆôGitLab²¢²âÊÔÅþÁ¬¡£
½áÂÛ
GitLabÊÇÒ»¸öºÜÊÇÓÐÓõŤ¾ß£¬ËüÌṩÁË´úÂëÖÎÀí¡¢°æ±¾¿ØÖƺÍÐ×÷µÄһϵÁй¦Ð§¡£ÈôÊÇÄãµÄÇéÐÎûÓÐÍøÂçÅþÁ¬£¬ÄÇôÀëÏß×°ÖÃGitLab¾Í³ÉΪÁ˱ØÐèµÄÑ¡Ôñ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÏÈÈÝÁËÔõÑùÔÚÀëÏßÇéÐÎÏÂ×°ÖúÍÉèÖÃGitLab£¬Õ⽫ʹÄãÄܹ»Ê¼ÖÕÕÆ¿Ø×Ô¼ºµÄ´úÂëÖÎÀí¡£
ÒÔÉϾÍÊÇÔõÑùÔÚÀëÏßÇéÐÎÏÂ×°ÖÃGitLabµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡