ubuntu 13.04安装gitlab 5.3版


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,用下面的用户密码登录既可.
admin@local.host
5iveL!fe
 

相关内容

    暂无相关文章