美文网首页
gitlab 环境搭建

gitlab 环境搭建

作者: cmd_du | 来源:发表于2016-02-23 12:55 被阅读0次

系统环境

操作系统:Ubuntu 14.04

安装步骤

  • Packages/Dependencies
  • Ruby
  • System Users
  • Gitlab shell
  • Datebase
  • Gitlab
  • Nginx

开始安装

1.更新apt-get

apt-get update
apt-get upgrade

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

安装python
sudo apt-get install python2.7
sudo ln -s /usr/bin/python /usr/bin/python2

如果是系统自带python2.7 可以忽略。

3.安装ruby

mkdir /tmp/ruby && cd /tmp/ruby
curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
cd ruby-1.9.3-p392
./configure
make
sudo make install

4.安装bundler

sudo gem install bundler

5.创建git账户

sudo adduser --disabled-login --gecos 'GitLab' git

6.安装gitlab-shell

sudo su git
cd /home/git
git clone https://github.com/gitlabhq/gitlab-shell.git
cd gitlab-shell
git checkout v1.4.0
vim config.yml #改不改都是个坑,所以可以不用改了
./bin/install

7.安装数据库

  • mysql和postgres两个数据库可选,mysql更为熟悉一些,

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
mysql -u root -p
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON gitlabhq_production.* TO 'gitlab'@'localhost';
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production

8.Gitlab

  • user git

cd /home/git
sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
cd /home/git/gitlab
sudo -u git -H git checkout 5-2-stable

9.配置GitLab

cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

sudo -u git -H vim config/gitlab.yml
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

相关文章

网友评论

      本文标题:gitlab 环境搭建

      本文链接:https://www.haomeiwen.com/subject/ceibkttx.html