日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

GitLab 安装笔记

發布時間:2024/4/17 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 GitLab 安装笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://www.uloli.com/p/6sh26/

基本上參考官方文檔就可以十分簡單的安裝上去, 其中幾個注意點自己做下記錄

安裝要求

  • Ubuntu/Debian**
  • MySQL or PostgreSQL
  • git
  • gitlab-shell
  • redis

Note: 推薦使用內部域名, 這樣就可以直接用域名訪問, 實現方法可以修改所有使用機的hosts 或 者自建DNS服務器(推薦)

安裝教程

0.9. 在天朝的同學先將apt源更新成中科大或者網易的源! [重要]

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

apt-get update apt-get upgrade

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

2. 安裝一些必要包

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev vim

確定本機python版本是否為2.7?python --version
如果版本不為2.7, 請安裝2.7版本

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的鏡像進行安裝 可以大大的縮短下載包的時間

mkdir /tmp/ruby && cd /tmp/ruby curl --progress http://ruby.taobao.org/mirrors/ruby/1.9/ruby-1.9.3-p429.tar.gz | tar xz cd ruby-1.9.3-p429 ./configure make 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

# Login as git sudo su git# Go to home directory cd /home/git# Clone gitlab shell git clone https://github.com/gitlabhq/gitlab-shell.gitcd gitlab-shell# switch to right version git checkout v1.4.0cp config.yml.example config.yml# Edit config and replace gitlab_url # with something like 'http://domain.com/' # 這里修改成自己的內部域名 如: http://gitlab.uloli/ vim config.yml# Do setup ./bin/install

6. 安裝數據庫 推薦MySQL

以下所有操作需要使用可以sudo的賬戶

# Install the database packages sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev# Login to MySQL mysql -u root -p# Create a user for GitLab. (change $password to a real password) mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';# Create the GitLab production database mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;# Grant the GitLab user necessary permissions on the table. mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';

7. 開始安裝GitLab主程序

cd /home/git# Clone GitLab repository sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab# Go to gitlab dir cd /home/git/gitlab# Checkout to stable release sudo -u git -H git checkout 5-2-stable

8. 配置GitLab

# Copy the example GitLab config sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml# Make sure to change "localhost" to the fully-qualified domain name of your # host serving GitLab where necessary # 這里僅需要修改host即可, 默認可行 sudo -u git -H vim config/gitlab.yml# Make sure GitLab can write to the log/ and tmp/ directories # 修改賬戶權限 sudo chown -R git log/ sudo chown -R git tmp/ sudo chmod -R u+rwX log/ sudo chmod -R u+rwX tmp/# Create directory for satellites sudo -u git -H mkdir /home/git/gitlab-satellites# Create directories for sockets/pids and make sure GitLab can write to them sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ sudo chmod -R u+rwX tmp/pids/ sudo chmod -R u+rwX tmp/sockets/# Create public/uploads directory otherwise backup will fail sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads# Copy the example Puma config sudo -u git -H cp config/puma.rb.example config/puma.rb# Copy the example Puma config # 該配置文件默認即可 sudo -u git -H vim config/puma.rb# Configure Git global settings for git user, useful when editing via web # Edit user.email according to what is set in gitlab.yml sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git cp config/database.yml.mysql config/database.yml# 修改數據庫賬號密碼, 剛才添加過gitlab這個數據庫用戶 直接修改成該賬號即可 sudo -u git vim config/database.yml

9. 安裝 Gems

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

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

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

11. 安裝init腳本

sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-2-stable/lib/support/init.d/gitlab sudo chmod +x /etc/init.d/gitlab#設置開機啟動GitLab sudo update-rc.d gitlab defaults 21

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

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

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

13. 啟動GitLab

sudo service gitlab start

默認的賬戶如下

用戶名:admin@local.host
密碼: 5iveL!fe

Nginx配置

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

1. 安裝nginx

sudo apt-get install nginx

1. 增加GitLab配置文件

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

2. 重啟nginx

sudo service nginx restart

這樣你就可以通過nginx來訪問gitlab了


總結

以上是生活随笔為你收集整理的GitLab 安装笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。