【yzc518亚洲城】如何在Ubuntu Server 14.04下安装Gitlab中文版

如何在Ubuntu Server 14.04下安装Gitlab中文版

Gitlab是基于Ruby on
Rails的,安装和布局不行劳顿,不过有傻瓜安装包,

正是,照旧有无私的好汉把gitlab给汉化了:

因而本文要做的事情是,不安装傻瓜包,从源码安装gitlab。

gitlab官方有一个注解文书档案:

设置步骤有:

  1. 依赖包
  2. ruby
  3. 客户创制
  4. 数据库起初化
  5. redis
  6. gitlab源码
  7. apache

本文恐怕会用到VPN连接,在指令行下创制VPN连接的点子如下:

sudo apt-get install pptp-linux
sudo pptpsetup –create VPN名称 –server 服务器地址 –username 客户名
–password 密码 [–encrypt] –start

上述命令会成立壹个装置,如果未有别的的拨号设备,这么些设备会是ppp0,用ifconfig可以看看,“–encrypt”选项可选,因为部分服务器不支持,会唤醒MPPE
required but peer negotiation
failed,创建时带上“–start”选项能够阅览连接的情景。
pptpsetup成立的VPN连接重启后会失效,倘诺想在不重启的景色下删除VPN连接:

sudo pptpsetup –delete VPN名称

开创VPN连接后还必要使能,何况增进到路由列表:

sudo pon VPN名称
sudo route add default dev ppp0

剥夺VPN连接的诀借使:

sudo poff VPN名称

上面开始正文:

  1. 依赖包

本人装的是Ubuntu server
14.04,安装的时候可以选是或不是安装LAMP(Linux+Apache+MySQL+PHP),借使没装,能够用下边包车型地铁吩咐装:

sudo tasksel install lamp-server

设置的时候会提示输入MySQL的root密码,下边要用。
接下去是借助关系:

sudo apt-get install flex bison ruby 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 libkrb5-dev nodejs git-core

专心:这里面装了ruby,应该是1.9.1本子的,gitlab须求2.0以上的ruby,但是安装2.0之上的ruby须要低版本的ruby,所以我们先装上,一会儿卸下。其它,ubuntu
14.04的软件Curry有ruby 2.0,不过实地测量不可能用,所以照旧从源码装ruby吧。

  1. ruby

下载,编译,安装(安装前删掉ruby 1.9.1):

【yzc518亚洲城】如何在Ubuntu Server 14.04下安装Gitlab中文版。curl -L –progress
| tar xz
cd ruby-2.1.5
./configure –prefix=/usr –disable-install-rdoc
make
sudo apt-get autoremove ruby
sudo make install

下一场安装bundler:

sudo gem install bundler –no-ri –no-rdoc

  1. 客户创设

为gitlab创立一个git客户:

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

  1. 数据库起首化

官方指南用的是PostgreSQL,可是官方也是有MySQL的证实:

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
mysql -u root -p

输入MySQL的root密码登入,然后:

mysql> CREATE USER ‘git’@’localhost’ IDENTIFIED BY ‘$password’;

回忆把上面那句的”$password”换到实际的密码,然后:

mysql> SET storage_engine=INNODB;
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT
CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, LOCK TABLES ON `gitlabhq_production`.* TO
‘git’@’localhost’;
mysql> \q

  1. Redis

Redis貌似是用来存key的数据库吧,不明白,反正按步骤安装:

sudo apt-get install redis-server
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed ‘s/^port .*/port 0/’ /etc/redis/redis.conf.orig | sudo tee
/etc/redis/redis.conf
echo ‘unixsocket /var/run/redis/redis.sock’ | sudo tee -a
/etc/redis/redis.conf
echo ‘unixsocketperm 770’ | sudo tee -a /etc/redis/redis.conf
sudo service redis-server restart
sudo usermod -aG redis git

  1. gitlab源码

gitlab源码默许是设置在/home/git/gitlab,如若要转移,请参见官方手册。获取汉语版源码的经过如下:

cd /home/git
sudo -u git -H git clone

不知底是因为GFW依旧什么,git
clone这一个版本库可慢可慢了,笔者用了VPN,速度会快点。
git
clone完现在能够checkout你想要的本子,在本文编写的岁月(二〇一五年10月31日),能够:

sudo -u git -H git checkout 7-7-zh

接下来配置源码

cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo -u git -H mkdir /home/git/gitlab-satellites
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo chmod -R u+rwX  public/uploads
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example
config/initializers/rack_attack.rb
sudo -u git -H git config –global user.name “GitLab”
sudo -u git -H git config –global user.email
“[email protected]”
sudo -u git -H git config –global core.autocrlf input
sudo -u git -H cp config/resque.yml.example config/resque.yml

当然,你可以把[email protected]改成你的email;上边的那么些yml文件之中的配备宗旨都实际不是改变;然后,配置数据库顾客名和密码:

sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H editor config/database.yml
sudo -u git -H chmod o-rwx config/database.yml

然后,安装gems:

sudo -u git -H bundle install –deployment –without development test
postgres aws

这一步必需使用VPN,因为万恶的GFW屏蔽了rubygems.org,所以会提醒connection
reset by
peer之类的,那部时间也会非常久,固然你的机器是多核的,也得以加上和make同样-jN参数,N等于核数。

(2015年5月2日追加)
察觉Taobao做了个rubygrems.org的境内镜像,

再接下去安装gitlab shell:

sudo -u git -H bundle exec rake gitlab:shell:install[v2.6.0]
REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
sudo -u git -H editor /home/git/gitlab-shell/config.yml

把gitlab的url改成
在接下去起先化数据库:

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

投入运维项:

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo update-rc.d gitlab defaults 21

早先化日志:

sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

自作者商议采用状态:

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

编写翻译附属类小部件:

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

启动gitlab服务:

sudo service gitlab start

  1. apache

下载apache的布署文件:
将内部的“ProxyPassReverse

用命令来讲:

wget

mv gitlab-apache2.4.conf 001-gitlab.conf
editor 001-gitlab.conf (进行上述修改)
sudo cp 001-gitlab.conf /etc/apache2/sites-available
cd /etc/apache2/sites-enabled
sudo rm 000-default.conf
sudo ln -s ../sites-available/001-gitlab.conf 001-gitlab.conf

除此以外,还亟需使能代理模块以促成反向代理功用,不然会唤醒“ProxyPassReverse”无效之类的。

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy.conf proxy.conf
sudo ln -s ../mods-available/proxy.load proxy.load
sudo ln -s ../mods-available/proxy_connect.load proxy_connect.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load
sudo ln -s ../mods-available/rewrite.load rewrite.load

重启apache:

sudo service apache2 restart

下一场,检查下布置是还是不是科学:

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

只要都是灰湖绿的结果,那就足以访问了。登入客户名:root,起头密码:5iveL!fe

末段安顿一下邮件,修改/home/git/gitlab/config/gitlab.yml,里面包车型大巴“email_from:”为多个得力的email地址;修改/home/git/gitlab/config/environments/production.rb,里面包车型大巴“config.action_mailer.delivery_method=”为“:smtp”;最后:

cd /home/git/gitlab/config/initializers
sudo -u git -H cp smtp_settings.rb.sample smtp_settings.rb

下一场把文件的里的剧情更换加准确了,再重启一下gitlab服务就行了:

sudo service gitlab restart

最后看看自家的布署结果:

yzc518亚洲城 1

yzc518亚洲城 2

CentOS源码安装GitLab汉化版 

在 Ubuntu 12.04 上安装 GitLab

GitLab 5.3 晋级注意事项

在 CentOS 上配备 GitLab (自托管的Git项目仓库)

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2

CentOS 6.5安装GitLab教程及连锁难题解决

GitLab 的详尽介绍:请点这里
GitLab 的下载地址:请点这里

Server 14.04下安装Gitlab汉语版
Gitlab是基于Ruby on
Rails的,安装和布局不行辛勤,不过有傻瓜安装包,…

Git的安装

  1. root权限下安装包
     
    apt-get update && apt-get upgrade && apt-get install sudo
     
    sudo apt-get update
    sudo apt-get upgrade
     
    sudo apt-get install -y wget curl gcc checkinstall libxml2-dev
    libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev
    libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev
    libicu-dev redis-server openssh-server git-core python-dev python-pip
    libyaml-dev postfix
     
    # 假诺使用MySQL实践:
    sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
     
     
  2. 安装 Ruby
    wget
    tar xfvz ruby-1.9.3-p194.tar.gz
    cd ruby-1.9.3-p194
    ./configure
    make
    sudo make install
     
  3. 安装 Gitolite
    创建 git帐号:
     
    sudo adduser \
      –system \
      –shell /bin/sh \
      –gecos ‘git version control’ \
      –group \
      –disabled-password \
      –home /home/git \
      git
     
    创建 GitLab帐号:
     
    # Ubuntu/debian
    sudo adduser –disabled-login –gecos ‘gitlab system’ gitlab
    Add your user to the git group:
     
    sudo usermod -a -G git gitlab
    Generate key:
     
    sudo -H -u gitlab ssh-keygen -q -N ” -t rsa -f
    /home/gitlab/.ssh/id_rsa
    Clone GitLab’s fork of the Gitolite source code:
     
    cd /home/git
    sudo -H -u git git clone -b gl-v304
    /home/git/gitolite
     
    安装:
     
    cd /home/git
    sudo -u git -H mkdir bin
    sudo -u git sh -c ‘echo -e “PATH=\$PATH:/home/git/bin\nexport PATH”
    >> /home/git/.profile’
    sudo -u git sh -c ‘gitolite/install -ln /home/git/bin’
     
    sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
    sudo chmod 0444 /home/git/gitlab.pub
     
    sudo -u git -H sh -c “PATH=/home/git/bin:$PATH; gitolite setup -pk
    /home/git/gitlab.pub”
    sudo -u git -H sed -i ‘s/0077/0007/g’ /home/git/.gitolite.rc
    Permissions:
     
    sudo chmod -R g+rwX /home/git/repositories/
    sudo chown -R git:git /home/git/repositories/
    CHECK: Logout & login again to apply git group to your user
     
    # 克隆 admin repo 添加 localhost 到 hosts
    # 确认保证您能够访问 gitolite
    sudo -u gitlab -H git clone git@localhost:gitolite-admin.git
    /tmp/gitolite-admin
     
    # 就算成功,能够移除/tmp/gitolite-admin
    sudo rm -rf /tmp/gitolite-admin
    IMPORTANT! If you can’t clone gitolite-admin repository – DO NOT PROCEED
    WITH INSTALLATION Check the Trouble Shooting Guide and ensure you have
    followed all of the above steps carefully.
     
  4. 克隆 GitLab 代码
    sudo gem install charlock_holmes –version ‘0.6.8’
    sudo pip install pygments
    sudo gem install bundler
    cd /home/gitlab
     
    # 获得 GitLab 代码
    sudo -H -u gitlab git clone -b stable
    gitlab
     
    #
    # Master branch (recent changes, less stable)
    sudo -H -u gitlab git clone -b master
    gitlab
     
    cd gitlab
     
    # 重命名配置文件
    sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml
    Select the database you want to use
     
    # 使用SQLite
    sudo -u gitlab cp config/database.yml.sqlite config/database.yml
     
    # 恐怕利用MYSQL
    # 使用 MySQL 需此前有安装MYSQL
     
    # Login to MySQL
    $ mysql -u root -p
     
    # 创建 GitLab production 数据库
    mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT
    CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
     
    # 创立MYSQL帐号  $password 改为您的密码
    mysql> CREATE USER ‘gitlab’@’localhost’ IDENTIFIED BY ‘$password’;
     
    # 给那一个帐号权限
    mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
    ALTER ON `gitlabhq_production`.* TO ‘gitlab’@’localhost’;
     
    # 把MYSQL密码更新到那一个文件 config/database.yml
    sudo -u gitlab cp config/database.yml.example config/database.yml
    Install gems
     
    sudo -u gitlab -H bundle install –without development test
    –deployment
    Setup database
     
    sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production
    Setup GitLab hooks
     
    sudo cp ./lib/hooks/post-receive
    /home/git/.gitolite/hooks/common/post-receive
    sudo chown git:git /home/git/.gitolite/hooks/common/post-receive
    Check application status
     
    Checking status:
     
    sudo -u gitlab bundle exec rake gitlab:app:status
    RAILS_ENV=production
     
     
    # 成功会议及展览示
    Starting diagnostic
    config/database.yml…………exists
    config/gitlab.yml…………exists
    /home/git/repositories/…………exists
    /home/git/repositories/ is writable?…………YES
    remote: Counting objects: 603, done.
    remote: Compressing objects: 100% (466/466), done.
    remote: Total 603 (delta 174), reused 0 (delta 0)
    Receiving objects: 100% (603/603), 53.29 KiB, done.
    Resolving deltas: 100% (174/174), done.
    Can clone gitolite-admin?…………YES
    UMASK for .gitolite.rc is 0007? …………YES
    /home/git/share/gitolite/hooks/common/post-receive exists?
    …………YES
    If you got all YES – congratulations! You can go to the next step.
     
  5. 启动WEB服务
    Application can be started with next command:
     
    # 测试
    sudo -u gitlab bundle exec rails s -e production
     
    # 做为守护进度运行
    sudo -u gitlab bundle exec rails s -e production -d
     
     
    接纳管理帐号,从WEB登入:
     
    admin@local.host
    5iveL!fe
  6. 运营Resque 进度 (管理作业队列).
    # Manually
    sudo -u gitlab bundle exec rake environment resque:work QUEUE=*
    RAILS_ENV=production BACKGROUND=yes
     
    # GitLab 运维脚本
    sudo -u gitlab ./resque.sh
     
    若果想行使 Redis ,能够配备那一个文件config/resque.yml  :
     
    production: redis.example.com:6379
    *Ok – we have a working application now. * *But keep going – there
    are some things that should be done *
     
     
    Nginx && Unicorn
  7. 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
     
  8. 安装Nginx
    # Install first
    sudo apt-get install nginx
     
    # 添加 GitLab  nginx 配置
    sudo wget
    -P
    /etc/nginx/sites-available/
    sudo ln -s /etc/nginx/sites-available/gitlab
    /etc/nginx/sites-enabled/gitlab
     
    # 修改 **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**
    # 配置你的IP和域名
    sudo vim /etc/nginx/sites-enabled/gitlab
     
    # 重启 nginx:
    /etc/init.d/nginx restart
  9. Init script
    创立运营脚本 /etc/init.d/gitlab:
     
    sudo wget
    -P
    /etc/init.d/
    sudo chmod +x /etc/init.d/gitlab
    GitLab autostart:
     
    sudo update-rc.d gitlab defaults
    能够运营,重启,结束  GitLab :
    启动  sudo /etc/init.d/gitlab start
    重启  sudo /etc/init.d/gitlab restart
    停止  sudo /etc/init.d/gitlab stop

Ubuntu系统

sudo apt-get install git

GitLab
的事无巨细介绍
:请点这里
GitLab
的下载地址
:请点这里

Windows系统

  1. 下载:https://git-scm.com/download/win
  2. 安装: 点击下一步

yzc518亚洲城 3

1.jpg

  1. 在Windows Explorer integration选项军长“Git Bash here”和“Git GUI
    here”打对勾。

yzc518亚洲城 4

2.jpg

  1. 在“Adjusting your PATH environment”选项中,私下认可就可以。

yzc518亚洲城 5

3.jpg

  1. 在“Configuring the line ending conversions”选项中,
    第贰个挑选:如若是跨平台项目,在windows系统安装,选取;
    第叁个选用:就算是跨平台项目,在Unix系统设置,选拔;
    其八个选项:非跨平台项目,选择。

yzc518亚洲城 6

4.jpg

  1. finish安装完成,点击桌面包车型大巴git bash 就能够运转

yzc518亚洲城 7