°¢ÀïÔÆÉÏÔõôװÖÃgitlab
gitÊǵ±ÏÂ×îÊ¢ÐеÄÂþÑÜʽ°æ±¾¿ØÖÆϵͳ֮һ£¬Ò²ÊÇ¿ªÔ´ÉçÇø×î³£ÓõŤ¾ßÖ®Ò»¡£¶øgitlabÊÇÒ»¸ö¿ªÔ´µÄ´úÂë¿ÍÕ»ÖÎÀíϵͳ£¬ËüÊÇ»ùÓÚgitµÄ´úÂë¿ÍÕ»ÖÎÀíϵͳ¡£gitlabÖ§³Ö´úÂë¿ÍÕ»ÖÎÀí¡¢´úÂëÉó²é¡¢´úÂë×·×ÙºÍÐ×÷£¬¿ÉÒÔ×ÊÖúÍŶӸüºÃµØÖÎÀí´úÂë¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ°¢ÀïÔÆ×°ÖÃgitlab¡£
½¨Éè°¢ÀïÔÆECSʵÀý
µÚÒ»²½Êǽ¨Éè°¢ÀïÔÆECS£¨Elastic Compute Service£©ÊµÀý¡£ÔÚ°¢ÀïÔÆÖÎÀí¿ØÖÆ̨ÖУ¬Ñ¡ÔñECSʵÀý£¬È»ºóƾ֤ÐèҪѡÔñʵÀýÉèÖúͲÙ×÷ϵͳ¾µÏñ¡£¹ØÓÚÎÒÃÇÀ´Ëµ£¬Ñ¡ÔñÒ»¸öÊʺϵÄʵÀýÉèÖúÍUbuntu²Ù×÷ϵͳ¾µÏñ¾Í¿ÉÒÔÁË¡£
¸üÐÂϵͳ
µÇ¼µ½Ubuntuϵͳºó£¬ÎÒÃÇÐèÒª¸üÐÂϵͳ£º
sudo apt-get update sudo apt-get upgrade
µÇ¼ºó¸´ÖÆ
×°ÖÃÐëÒªµÄÈí¼þ
ÔÚ°¢ÀïÔÆECSÉÏ×°ÖÃGitLabÐèҪһЩ°üºÍÈí¼þ¡£ÇëʹÓÃÒÔÏÂÏÂÁîÀ´×°ÖÃËüÃÇ£º
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
µÇ¼ºó¸´ÖÆ
×°ÖÃPostgreSQL
GitLabÐèÒªÒ»¸öÊý¾Ý¿âÀ´´æ´¢Êý¾Ý¡£Òò´Ë£¬ÎÒÃÇÐèҪװÖÃÒ»¸ö¹ØϵÐÍÊý¾Ý¿â¡£PostgreSQLÊÇGitLab¹Ù·½ÍƼöµÄÊý¾Ý¿âÖ®Ò»£¬ÎÒÃǽ«ÔÚÕâÀïʹÓÃËü¡£ÇëʹÓÃÒÔÏÂÏÂÁî×°ÖÃPostgreSQL£º
sudo apt-get install -y postgresql postgresql-contrib libpq-dev
µÇ¼ºó¸´ÖÆ
×°ÖÃÀú³ÌÖУ¬ÎÒÃÇÐèÒªÉ趨һ¸öPostgreSQLµÄÃÜÂë¡£
×°ÖÃRuby
GitLabÊÇÓÃRuby±àдµÄ£¬Òò´ËÎÒÃÇÐèҪװÖÃRuby¡£´Ó¹Ù·½ÍøÕ¾ÉÏÏÂÔز¢×°ÖÃRuby¿ÉÄܺÜÖش󣬿ÉÊÇRVMÊÇÒ»ÖÖRuby°æ±¾ÖÎÀíÆ÷£¬¿ÉÒÔʹװÖÃÀú³Ì±äµÃ¼òÆÓ¡£
ÇëʹÓÃÒÔÏÂÏÂÁî×°ÖÃRVM£º
sudo apt-get install -y gnupg2 dirmngr sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 \ 409B6B1796C275462A1703113804BB82D39DC0E3 \ 7D2BAF1CF37B13E2069D6956105BD0E739499BDB echo "deb http://mirrors.tuna.tsinghua.edu.cn/rubygems/ all main" > /etc/apt/sources.list.d/rubygems.list sudo apt-get update sudo apt-get install -y rvm
µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬ÔËÐÐÒÔÏÂÏÂÁÒÔÓ¦ÓÃÎÒÃǵĸü¸Ä£º
source /etc/profile.d/rvm.sh
µÇ¼ºó¸´ÖÆ
È»ºó£¬Ê¹ÓÃRVM×°ÖÃRuby£º
rvm install 2.6.5
µÇ¼ºó¸´ÖÆ
×°ÖÃGitLab
ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔ×°ÖÃGitLabÁË¡£ÇëʹÓÃÒÔÏÂÏÂÁîÀ´×°ÖÃGitLab£º
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒªÉèÖÃһЩѡÏî¡£·¿ªGitLabÉèÖÃÎļþ£º
sudo nano /etc/gitlab/gitlab.rb
µÇ¼ºó¸´ÖÆ
Ð޸ġ°external_url¡±µÄֵΪÏÖʵ»á¼ûGitLabÒ³ÃæµÄµØµã£¬ÀýÈçhttp://gitlab.example.com¡£
ÎÒÃÇ»¹ÐèÒª¸øGitLabÉèÖÃPostgreSQL¡£ÔÚGitLabµÄÉèÖÃÎļþÖУ¬ÕÒµ½¡°# external postgresql¡±×ֶΣ¬²¢×÷·Ï×¢ÊÍ¡£È»ºó£¬½«ÒÔÏÂÖµÌí¼Óµ½ÉèÖÃÎļþÖУº
gitlab_rails['db_adapter'] = 'postgresql' gitlab_rails['db_encoding'] = 'utf8' gitlab_rails['db_host'] = '/var/run/postgresql' gitlab_rails['db_port'] = '5432' gitlab_rails['db_database'] = 'gitlabhq_production' gitlab_rails['db_username'] = 'gitlab'
µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÆô¶¯GitLab²¢Ê¹ÆäËæϵͳÆô¶¯×Ô¶¯ÔËÐС£ÔËÐÐÒÔÏÂÏÂÁ
sudo gitlab-ctl reconfigure sudo gitlab-ctl start sudo systemctl enable gitlab-runsvdir.service
µÇ¼ºó¸´ÖÆ
ÕâЩÏÂÁÆô¶¯GitLab²¢×Ô¶¯ÉèÖÃËü£¬²¢ÇÒʹGitLabÔÚËæºóµÄϵͳÆô¶¯Ê±×Ô¶¯Æô¶¯¡£
怬GitLab
ÏÖÔÚGitLabÒѾװÖÃÍê³É£¬ÎÒÃÇ¿ÉÒÔͨ¹ýä¯ÀÀÆ÷»á¼ûËü¡£ÔÚä¯ÀÀÆ÷ÖÐÊäÈë°¢ÀïÔÆECSµÄ¹«¹²IPµØµã£¬È»ºóÊäÈëÔÚGitLabÉèÖÃÎļþÖÐÉèÖõÄÖÎÀíÔ±Óû§ÃûºÍÃÜÂë¡£
ÏÖÔÚ£¬Äú¿ÉÒÔä¯ÀÀGitLabµÄËùÓй¦Ð§£¬²¢Ê¹ÓÃËüÀ´ÖÎÀí´úÂë¿ÍÕ»ºÍÐ×÷¡£ÈôÊÇÐèÒª£¬Äú»¹¿ÉÒÔÌí¼ÓÆäËûGitLabÓû§ºÍÏîÄ¿¡£
×ܽá
ÔÚ°¢ÀïÔÆECSÉÏ×°ÖÃGitLab¿ÉÄÜÐèҪһЩÊÂÇ飬¿ÉÊÇÕâ¸öÀú³Ì²¢²»ÊǺÜÖØ´ó¡£±¾ÎÄÌṩÁËһЩ¼òÆӵİ취£¬Ï£ÍûÆäÖеÄÖ¸ÄÏ¿ÉÒÔ×ÊÖúÄúÔÚ°¢ÀïÔÆÉÏÀÖ³É×°ÖÃGitLab¡£
ÒÔÉϾÍÊÇ°¢ÀïÔÆÉÏÔõôװÖÃgitlabµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡