歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> ubuntu 13.04安裝gitlab 5.3版

ubuntu 13.04安裝gitlab 5.3版

日期:2017/3/1 15:53:56   编辑:關於Linux
ubuntu 13.04安裝gitlab 5.3版 ubuntu 與 Debian 還是有點區別的,因為 ubuntu 默認安裝了 sudo/python,並且 gedit 編輯器用著比 vim 容易上手...所以就沒有安裝 sudo/python 和 vim 的的代碼了... 現在開始... 一. 軟件源安裝所需的軟件包 1 sudo apt-get update 1 <span></span>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 二. 編譯安裝 ruby 1.9.3 1 mkdir /tmp/ruby && cd /tmp/ruby 2 curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz 3 cd ruby-1.9.3-p392 4 ./configure 5 make 6 sudo make install sudo gem install bundler 三. 為 gitlab 創建用戶 sudo adduser --disabled-login --gecos 'GitLab' git 四. 安裝 gitlab-shell # 登錄第三步創建的 git 用戶 sudo su git # 切換到 git 用戶的 home 目錄 cd /home/git # 克隆 gitlab-shell git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell # 切換到 gitlab-shell 的 v1.4.0 分支 git checkout v1.4.0 cp config.yml.example config.yml # 編輯配置文件 config.ym 並且替換 gitlab_url # 為主機域名.例如 'http://domain.com/',本地局域網安裝的話默認localhost就行. gedit config.yml # 開始安裝. ./bin/install 五. 安裝數據庫 # 軟件源安裝 mysql 數據庫,過程中會讓你輸入兩次 mysql root 用戶的密碼,牢記! sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev # 用 root 用戶登錄 mysql mysql -u root -p # 創建 gitlab 用戶,替換 密碼 為你的數據庫 gitlab 用戶的密碼. 牢記.(注:前面的 mysql> 不用復制) mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '密碼'; # 創建 gitlabhq_production 數據庫 mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; # 將 gitlabhq_production 數據庫的增刪改查 等權限賦予 gitlab 用戶 mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; # 退出 mysql 數據庫 mysql> \q # 嘗試用 gitlab 用戶連接 gitlabhq_production 數據庫,登錄成功(注:出現 mysql>)說明數據庫配置完成. sudo -u git -H mysql -u gitlab -p -D gitlabhq_production 六. 安裝 gitlab # gitlab 要安裝到 git 用戶的 home 目錄下. cd /home/git # 克隆 gitlab 項目 sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab # 進入 gitlab 目錄 cd /home/git/gitlab # 切換到 gitlab 的 5.3 分支. sudo -u git -H git checkout 5-3-stable cd /home/git/gitlab # 復制 gitlab 的示例配置文件到指定目錄 sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml # 如果用的不是本地服務器,更改 localhost 為 gitlab 的服務器域名 sudo -u git -H gedit config/gitlab.yml # 確保當前用戶對 gitlab 的 log 和 tmp 文件有讀寫權限. sudo chown -R git log/ sudo chown -R git tmp/ sudo chmod -R u+rwX log/ sudo chmod -R u+rwX tmp/ # 創建一個我不認識的目錄...汗! sudo -u git -H mkdir /home/git/gitlab-satellites # 再創建兩個我不認識的目錄...並且確保 當前用戶對他有讀寫權限. 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/ # 創建公共的上傳備份目錄,並確保當前用戶對其有讀寫權限.否則備份會失敗. sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads # 復制示例配置文件到制定目錄 sudo -u git -H cp config/puma.rb.example config/puma.rb # 找到其中有一行 # workers 2,去掉前面的 # 並將 2 改為 3. sudo -u git -H gedit config/puma.rb # 配置 gitlab 的全局設置. sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@localhost" # 復制示例Mysql配置文件到指定目錄 sudo -u git cp config/database.yml.mysql config/database.yml # 修改裡面的 root 為 gitlab, 密碼為創建的 gitlab mysql 用戶密碼 sudo gedit config/database.yml # 安裝一個我不認識的東西...我沒臉翻譯了...大哥你還是看原版教程吧 cd /home/git/gitlab sudo gem install charlock_holmes --version '0.6.9.4' sudo -u git -H bundle install --deployment --without development test postgres sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # 下載 gitlab 的 開始/停止 腳本,並且加入當前用戶的可執行權限. sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # 添加 gitlab 的開機啟動 sudo update-rc.d gitlab defaults 21 # 檢查 gitlab 的狀態和環境配置是否正確. sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production # 啟動 gitlab sudo service gitlab start # 或者 sudo /etc/init.d/gitlab restart # 再次檢查 gitlab 的狀態,如果全部綠色,說明 gitlab 配置成功.不知道為什麼,我要運行這個命令兩次才會全綠 sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production 七. 配置 Nginx # 軟件源安裝Nginx sudo apt-get install nginx # 復制 gitlab 的示例配置到指定目錄 sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab # 修改配置文件.更改其中的 YOUR_SERVER_FQDN 為你的 gitlab 服務器全稱域名或者本機IP地址,修改 listen 為 *:80 sudo gedit /etc/nginx/sites-available/gitlab # 重啟 nginx 服務器 sudo service nginx restart # 打開浏覽器輸入本機 IP,用下面的用戶密碼登錄既可. [email protected] 5iveL!fe
Copyright © Linux教程網 All Rights Reserved