Ïê½âCentOS GitLab ×°ÖÃÉèÖý̳Ì
centos gitlab ×°ÖÃÉèÖý̳Ì
GitLab ÊÇÒ»¿î¿ªÔ´µÄ Git ¿ÍÕ»ÖÎÀíϵͳ£¬Ö§³Ö¶àÈËÐ×÷¿ª·¢£¬´úÂë¿ÍÕ»µÄÖÎÀíºÍ°æ±¾¿ØÖÆ¡£GitLab ×Ô´ø¶àÖÖ¹¦Ð§£¬ºÃ±È´úÂëÍйܣ¬CI/CD¡¢ÎÊÌâ×·×ٵȵȡ£±¾½Ì³Ì½«ÏÈÈÝÔõÑùÔÚ CentOS ÉÏ×°Öà GitLab ЧÀÍÆ÷²¢¾ÙÐÐÉèÖá£
Ò»¡¢CentOS ϵͳÇéÐÎ×¼±¸
×°ÖÃÒÀÀµ£ºGitLab ÐèÒª PostgreSQL ºÍ Redis Á½¸öÊý¾Ý¿âÖ§³Ö£¬ÎÒÃÇÐèҪװÖÃËûÃÇ£º
# ×°Öà PostgreSQL ºÍ Redis sudo yum install -y postgresql-server postgresql-contrib redis
µÇ¼ºó¸´ÖÆ
Æô¶¯ PostgreSQL ºÍ Redis ЧÀÍ£º
sudo systemctl start postgresql sudo systemctl start redis
µÇ¼ºó¸´ÖÆ
ÉèÖà PostgreSQL Êý¾Ý¿â£ºGitLab ÐèÒªÒ»¸öÊý¾Ý¿âÀ´´æ´¢Êý¾Ý£¬ÎÒÃÇÐèÒªÔÚ PostgreSQL Öн¨ÉèÒ»¸ö GitLab Êý¾Ý¿â£º
sudo -i -u postgres psql
µÇ¼ºó¸´ÖÆ
postgres=# CREATE USER git CREATEDB; postgres=# CREATE DATABASE gitlabhq_production OWNER git; postgres=# ALTER USER git WITH ENCRYPTED password 'password'; postgres=# \q exit
µÇ¼ºó¸´ÖÆ
¶þ¡¢×°ÖÃ GitLab
×°Öà GitLab£º
# Ìí¼Ó GitLab Ô´ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash sudo yum install -y gitlab-ee
µÇ¼ºó¸´ÖÆ
ÐÞ¸Ä GitLab ÉèÖÃÎļþ£º
sudo vim /etc/gitlab/gitlab.rb
µÇ¼ºó¸´ÖÆ
ÈçÏÂÐ޸ģº
## ÉèÖà GitLab µÄÍⲿ URL external_url 'http://{YOUR_SERVER_NAME_OR_IP}' ## ÉèÖÃSMTP gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.qq.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "your-email@qq.com" # ·¢ËÍÈËÓÊÏä gitlab_rails['smtp_password'] = "your-password" # ·¢ËÍÈË QQ ÓÊÏäÊÚȨÂë gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['gitlab_email_from'] = 'your-email@qq.com' # ·¢¼þÈËÓÊÏä # ÉèÖà Nginx nginx['enable'] = false ################# # OAUTH2 CONFIGS # ################# gitlab_rails['omniauth_enabled'] = true gitlab_rails['omniauth_allow_single_sign_on'] = true gitlab_rails['omniauth_block_auto_created_users'] = false gitlab_rails['omniauth_auto_link_ldap_user'] = false gitlab_rails['ldap_enabled'] = false # Ö§³ÖÖÐÎÄ gitlab_workhorse['env'] = { "LANG" => "zh_CN.UTF-8", "LC_ALL" => "zh_CN.UTF-8" }
µÇ¼ºó¸´ÖÆ
ʹ¸ü¸ÄÉúЧ£º
sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ
Èý¡¢»á¼û GitLab
»á¼ûÒÔÏ URL£º
http://{YOUR_SERVER_NAME_OR_IP}
µÇ¼ºó¸´ÖÆ
ʹÓÃĬÈÏÖÎÀíÔ±»á¼û£º
Óû§Ãû: root ÃÜÂë: 5iveL!fe
µÇ¼ºó¸´ÖÆ
ËÄ¡¢³£¼ûÎÊÌâ½â¾ö
ÔõÑùÆô¶¯¡¢×èÖ¹»òÖØÐÂÉèÖà GitLab£¿
# Æô¶¯ sudo gitlab-ctl start # ×èÖ¹ sudo gitlab-ctl stop # ¸ü¸Ä sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ
ÔõÑùÉý¼¶ GitLab ЧÀÍÆ÷£¿
## 1. Éý¼¶Èí¼þÔ´ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash ## 2. ×°ÖÃаæ sudo yum install -y gitlab-ee ## 3. ÔÚ¸üÐÂÉèÖÃÎļþºÍÉý¼¶ºóÖØÐÂÉèÖà sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ
Îå¡¢×ܽá
±¾ÎÄÏÈÈÝÁËÔÚ CentOS ϵͳÖÐ×°ÖúÍÉèÖà GitLab ЧÀÍÆ÷µÄ°ì·¨¡£Ï£Íû±¾ÎÄ¿ÉÒÔ×ÊÖú¿ª·¢ÕßÔÚ×Ô¼ºµÄЧÀÍÆ÷ÉϾÙÐÐ Git ¿ÍÕ»µÄÖÎÀíºÍ°æ±¾¿ØÖÆ¡£
ÒÔÉϾÍÊÇÏê½âCentOS GitLab ×°ÖÃÉèÖý̵̳ÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡