ubuntu下安装gitlab(原创)

centso系统安装gitlab 参考文档

http://www.open-open.com/lib/view/open1399684894447.html


ubuntu14.04下安装gitlab安装包 安装后nginx之类的都会有的

http://wlx.westgis.ac.cn/1373/ 或 官方文档 https://about.gitlab.com/downloads/


重要参考文档(没尝试安装过)

http://sfzhang88.blog.51cto.com/4995876/1323201

https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md



#安装所有的依赖包
sudo apt-get install -y build-essential git-core
sudo apt-get install -y 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 python-docutils postfix mysql-server mysql-client libmysqlclient-dev nginx libtool

#安装ruby1.9
mkdir /tmp/ruby && cd /tmp/ruby 
curl --progress http://ruby.taobao.org/mirrors/ruby/ruby-1.9.3-p392.tar.gz | tar xz 
cd ruby-1.9.3-p392 
./configure 
make 
sudo make install 

#安装ruby2.1
apt-get remove ruby1.8
mkdir /tmp/ruby && cd /tmp/ruby
curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz
cd ruby-2.1.5
./configure --disable-install-rdoc
make
sudo make install

<span style="color:#FF0000;">也可以下载</span>ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz 
cd ruby-2.0.0-p353
./configure --disable-install-rdoc

#创建用户 
sudo adduser --disabled-login --gecos 'GitLab' git  或 sudo adduser --system --create-home --comment 'GitLab' git 

一定要创建git的目录  这个目录后边要用到呢 /home/git

#获取git-shell的代码 
cd /home/git 
sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git 
cd gitlab-shell 

sudo -u git -H git checkout v1.7.0 
sudo -u git -H cp config.yml.example config.yml <span style="color:#FF0000;"> 修改host: git.5i5j.com(自己的域名)</span>
sudo -u git -H vim config.yml 
sudo -u git -H ./bin/install #获取gitlab代码 cd /home/git 
sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab  

#配置gitlab 
cd /home/git/gitlab 
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml  <span style="color:#FF0000;">修改host: git.5i5j.com(自己的域名)</span>
#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/unicorn.rb.example config/unicorn.rb #
sudo -u git -H vim config/unicorn.rb 
sudo -u git -H git config --global user.name "GitLab" 
sudo -u git -H git config --global user.email "gitlab@localhost" 
sudo -u git -H git config --global core.autocrlf input 
sudo -u git cp config/database.yml.mysql config/database.yml 
sudo -u git -H vim config/database.yml   <span style="color:#FF0000;">修改数据库用户名和密码</span>
sudo -u git -H chmod o-rwx config/database.yml 
sudo -u git cp config/puma.rb.example config/puma.rb 

<pre class="code" style="line-height: 13px; overflow: hidden; width: 620px; border-width: 0px 0px 0px 0.4em; border-style: solid; border-color: rgb(201, 209, 215); padding: 10px; font-family: Inconsolata, sans-serif; white-space: pre-wrap; word-wrap: break-word; color: rgb(51, 51, 51); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(241, 245, 249);"># 配置 Unicorn
$ cd /home/gitlab/gitlab
$ sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb
$ sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D
#安装gam cd /home/git/gitlab gem sources --remove http://rubygems.org/ gem sources -a http://ruby.taobao.org/ <span style="color:#FF0000;">一定要修改成taobao的 这样下载速度比较的快</span>gem sources -l sudo gem install charlock_holmes --version '0.6.9.4' sudo gem install bundler --no-ri --no-rdoc sudo -u git -H vim Gemfile # source 'http://ruby.taobao.org/' <span style="color:#FF0000;">一定要把源修改成taobao 要不用官方的会下载不了的</span>sudo -u git -H bundle install --deployment --without development test postgres unicorn aws --verbose #创建数据库 mysql -u root -p mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production --verbose #安装启动脚本 sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlabsudo update-rc.d gitlab defaults 21 sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production sudo /etc/init.d/gitlab restart sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production #nginx sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab sudo vim /etc/nginx/sites-available/gitlab sudo /etc/init.d/nginx restart
 



安装Mysql数据库(此步可以跳转过 只做参考
# 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 '$password';
# 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 permissopns on the table.
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
# Quit the database session
mysql> \q

安装中会遇到的问题

出现以下错误时
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime.

解决方案是:
方法1:
在gemfile中添加
gem 'execjs'
gem 'therubyracer'

bundle install后即可

方法2:
1. 安装nodejs
sudo apt-get install nodejs

参考文章 https://ruby-china.org/topics/692



虽然安装好了 也可以访问 但是打开git.5i5j.com时 样式文件找不到  不知道是什么原因

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值