国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Debian下GitLab 安裝步驟詳解

2024-08-27 23:58:35
字體:
來源:轉載
供稿:網友

博客又是好久不更新了,趁著中秋假期在家學習安裝了GitLab,這個折騰啊,然后寫個筆記,下次可以參考.

基本上參考官方文檔:https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md然后有些需要注意的地方做下記錄.

一、安裝要求

Debian**,MySQL,git,gitlab-shell,redis

二、安裝教程

1. 首先需要確定賬戶可以使用sudo,并更新系統package

# run as root!,apt-get update,apt-get upgrade

apt-get install sudo #正常情況系統都帶sudo命令,如果沒有的話,手動安裝下.

2. 安裝一些必要包

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake

檢查Python版本,2.5+ (3.0+還沒支持)python --version,如果版本不對,請安裝.

sudo apt-get install python2.7

python2 --version

sudo ln -s /usr/bin/python /usr/bin/python2

安裝郵件發送支持默認即可.sudo apt-get install -y postfix

3. 安裝Ruby這里我們使用taobao的鏡像進行安裝 可以大大的縮短下載包的時間.

  1. mkdir /tmp/ruby && cd /tmp/ruby 
  2. curl --progress http://ruby.taobao.org/mirrors/ruby/2.1/ruby-2.1.2.tar.gz | tar xz 
  3. cd ruby-2.1.2 
  4. ./configure --disable-install-rdoc 
  5. make 
  6. sudo make install 

Note:請不要使用rvm來安裝ruby 可能會因為環境變量導致這樣那樣的錯誤,當然如果你能解決這些問題可以使用rvm來安裝ruby.

安裝bundler 這里我們也使用taobao鏡像來縮短下載時間,注意請使用sudo!!

sudo gem sources --remove http://rubygems.org/

sudo gem sources -a http://ruby.taobao.org/

sudo gem install bundler

4.添加Git用戶

sudo adduser –disabled-login –gecos ‘GitLab’git

5.安裝 GitLab-shell 新版本使用GitLab-shell來代替gitolite.

  1. # Login as git 
  2. sudo su git 
  3. # Go to home directory 
  4. cd /home/git 
  5. # Clone gitlab shell 
  6. git clone https://github.com/gitlabhq/gitlab-shell.git 
  7. cd gitlab-shell 
  8. # switch to right version 
  9. git checkout v1.4.0 
  10. cp config.yml.example config.yml 
  11. # Edit config and replace gitlab_url 
  12. with something like 'http://domain.com/' 
  13. # 這里修改成自己的內部域名 如: http://git.test.com/ 
  14. vim config.yml 
  15. # Do setup 
  16. ./bin/install 

6.安裝數據庫m推薦MySQL,以下所有操作需要使用可以sudo的賬戶,代碼如下:

  1. # Install the database packages 
  2. sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev 
  3. # Login to MySQL 
  4. mysql -u root -p 
  5. Create a user for GitLab. (change $password to a real password
  6. mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '123456'
  7. Create the GitLab production database 
  8. mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; 
  9. Grant the GitLab user necessary permissions on the table
  10. mysql> GRANT SELECT, LOCK TABLES, INSERTUPDATEDELETECREATEDROPINDEXALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'

7.開始安裝GitLab主程序.

  1. ## We'll install GitLab into home directory of the user "git" 
  2. cd /home/git 
  3. # Clone GitLab repository 
  4. sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab 
  5. # Go to gitlab dir 
  6. cd /home/git/gitlab 
  7. # Checkout to stable release 
  8. sudo -u git -H git checkout 7-2-stable 

8.配置GitLab.

  1. # Go to GitLab installation folder 
  2. cd /home/git/gitlab 
  3. # Copy the example GitLab config 
  4. sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml 
  5. # Make sure to change "localhost" to the fully-qualified domain name of your 
  6. # host serving GitLab where necessary 
  7. # 這里僅需要修改host即可, 
  8. sudo -u git -H vim config/gitlab.yml 
  9. # Make sure GitLab can write to the log/ and tmp/ directories 
  10. # 修改賬戶權限 
  11. sudo chown -R git log/ 
  12. sudo chown -R git tmp/ 
  13. sudo chmod -R u+rwX  log/ 
  14. sudo chmod -R u+rwX  tmp/ 
  15. Create directory for satellites 
  16. sudo -u git -H mkdir /home/git/gitlab-satellites 
  17. sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites 
  18. Create directories for sockets/pids and make sure GitLab can write to them 
  19. sudo -u git -H mkdir tmp/pids/ 
  20. sudo -u git -H mkdir tmp/sockets/ 
  21. sudo chmod -R u+rwX  tmp/pids/ 
  22. sudo chmod -R u+rwX  tmp/sockets/ 
  23. Create public/uploads directory otherwise backup will fail 
  24. sudo -u git -H mkdir public/uploads 
  25. sudo chmod -R u+rwX  public/uploads 
  26. # Copy the example Puma config 
  27. sudo -u git -H cp config/puma.rb.example config/puma.rb 
  28. # Copy the example Puma config 
  29. # 該配置文件默認即可 
  30. sudo -u git -H vim config/puma.rb 
  31. #如果沒有puma.rb可以用下面的,二選一 
  32. sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb 
  33. sudo -u git -H editor config/unicorn.rb 
  34. # listen "142.23.21.76:8080", :tcp_nopush => true 
  35. # Copy the example Rack attack config 
  36. sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb 
  37. # Configure Git global settings for git user, useful when editing via web 
  38. # Edit user.email according to what is set in gitlab.yml 
  39. sudo -u git -H git config --global user.name "GitLab" 
  40. sudo -u git -H git config --global user.email "gitlab@localhost" 
  41. sudo -u git -H git config --global core.autocrlf input 
  42. sudo -u git cp config/database.yml.mysql config/database.yml 
  43. # 修改數據庫賬號密碼, 剛才添加過gitlab這個數據庫用戶 直接修改成該賬號即可 
  44. sudo -u git vim config/database.yml 
  45. #數據庫密碼  只需修改production即可 
  46. #  username: gitlab 
  47. #  password"123456"        
  48. #  host: localhost 

9.安裝 Gems.

  1. cd /home/git/gitlab 
  2. sudo gem install charlock_holmes --version '0.6.9.4' 
  3. # 修改Bundle源地址為taobao, 首行改成 source 'http://ruby.taobao.org/' 
  4. sudo -u git vim Gemfile 
  5. # 這個是使用mysql數據庫, 這個命令意思是排除postgres 請別搞錯 
  6. sudo -u git -H bundle install --deployment --without development test postgres aws 

10.初始化數據庫并啟用高級功能.

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

11.安裝init腳本

  1. cd /home/git/gitlab 
  2. sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/7-2-stable/lib/support/init.d/gitlab 
  3. cp lib/support/init.d/gitlab /etc/init.d/  
  4. sudo chmod +x /etc/init.d/gitlab 
  5. #設置開機啟動GitLab 
  6. sudo update-rc.d gitlab defaults 21 
  7. cd /home/git/gitlab 
  8. cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab 

12.最后檢測一下程序狀態

cd gitlab

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

Note:這里可能會告訴你init腳本有問題或者git版本過低, 可以無視

13.啟動GitLab

sudo service gitlab start

三、Nginx配置

你可以安裝nginx來代理訪問GitLab 配置過程如下

1. 安裝nginx:

sudo apt-get install nginx

cd /home/git/gitlab

1.增加GitLab配置文件

  1. sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlabhq/7-2-stable/lib/support/nginx/gitlab 
  2. sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/ 
  3. sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab 
  4. # 修改配置文件 Listen 直接監聽80端口即可 e.g. listen 80; 
  5. # 修改server_name為你的內部域名 e.g. server_name git.test.com; 
  6. sudo vim /etc/nginx/sites-available/gitlab //Vevb.com

2.重啟nginx

sudo service nginx restart

保存服務器名字的hash表是由指令 server_names_hash_max_size 和 server_names_hash_bucket_size所控制的,參數hash bucket size總是等于hash表的大小,并且是一路處理器緩存大小的倍數,如果Nginx給出需要增大 hash max size 或 hash bucket size的提示,那么首要的是增大前一個參數的大小.

vim /etc/nginx/sites-enabled/gitlab

server_names_hash_bucket_size 64;

sudo service nginx restart

這樣你就可以通過nginx來訪問gitlab了,默認的賬戶如下

用戶名:admin@local.host

密碼: 5iveL!fe

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 和林格尔县| 白银市| 自治县| 法库县| 江口县| 汝阳县| 黔南| 千阳县| 洛扎县| 延长县| 吉首市| 当阳市| 南和县| 昌图县| 曲麻莱县| 玛曲县| 永济市| 建德市| 广元市| 农安县| 安陆市| 谢通门县| 舒城县| 普宁市| 松潘县| 皮山县| 巴马| 民权县| 诸城市| 清远市| 彭水| 南岸区| 阿瓦提县| 洛南县| 积石山| 宝坻区| 将乐县| 沅江市| 沭阳县| 佛教| 隆安县|