这篇文章是转载过来的,安装过程中我遇到了一些别的问题,或者是与原文有区别的地方,就直接在原文的基础上修改了—————————————————————————————————————————————————————————————GitLab5发布快一个月了,决定试用下,5.0最大的特性就是用GitLab-Shell取代了Gitolite,这大大降低了安装难度,不过本人在安装过程中还是遇到了一些问题,所以记录下来供要安装GitLab5的朋友参考!
主要参考文档:https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md
安装步骤总览安装依赖库yum install libicu-devel mysql-devel pcre-devel
安装python,官方要求版本必须在2.5以上,而且不支持3.0,而CentOS5.5默认的Python版本是2.4的,此时就需要手动升级Python
下载python版本
wget-c
解压缩、编译和安装
tarzxfPython-3.3.0.tgz
cdPython-3.3.0
./configure
makeall
makeinstall
makeclean
makedistclean
升级Python在执行到make all时报错了:
是由于该虚拟机上没有安装GCC组件,所以还需要安装一下GCC
#yum install gcc
查看安装的新版本信息
#/usr/local/bin/python3-V
Python3.3.0
由此看出编译安装的新版本python生效了
做个软连接到当前系统python命令的bin目录
ln-s/usr/local/bin/python3.3/usr/bin/python
升级安装好新版本python以后,yum服务无法使用,这是因为yum命令使用是的python2.4版本,所以要修改yum的配置文件,以便能完全使用yum命令。
vi/usr/bin/yum
将文件头部的#!/usr/bin/python修改为#!/usr/bin/python2.4即可。
安装完查看下版本
python –version
还要确保python2命令有效
python2 –version
如果提示bash: python2: 未找到命令,那你需要link一下
sudo ln -s /usr/bin/python /usr/bin/python2安装Ruby源码方式安装mkdir /tmp/ruby && cd /tmp/ruby curl –progress | tar xz cd ruby-1.9.3-p392 ./configure make sudo make installRVM方式curl -#L https://get.rvm.io | bash -s stable –ruby
默然安装ruby2.0, GitLab推荐用1.9.3
rvm install ruby-1.9.3-p392
还要安装Bundler
sudo gem install bundler添加系统Git用户
创建一个git用户供GitLab使用
adduser –comment ‘GitLab’ git
让git用户无密码登陆
sudo chmod 644 /etc/shadow | vim /etc/shadow
去掉用户的叹号
git:!!:15814:0:99999:7::: 修改为 git::15814:0:99999:7:::
加入sudo组
chmod u+w /etc/sudoers vim /etc/sudoers ## Allow root to run any commands anywhere root ALL=(ALL) ALL git ALL=(ALL) NOPASSWD:ALL #加入这行# # %wheel ALL=(ALL) NOPASSWD:ALL 改为 %wheel ALL=(ALL) NOPASSWD:ALL安装GitLab Shell
切换到git用户
su – gitcd ~
要使用git命令,就需要安装git
首先安装Git依赖的一些包.
yum install gcc
接下来,如果你已经安装过Curl了,那么跳过这一步,没有的话,就装一下.(可以yum安装)
确定一下ld.so.conf文件里有/usr/local/lib,这个是为git-http-push准备的.
vi/etc/ld.so.conf
#插入下面的代码
/usr/local/lib
保存文件,接着运行:
/sbin/ldconfig
最后,我们下载Git并安装它
%E5%B9%B4%E8%B5%84%E6%96%99/1%E6%9C%88/12%E6%97%A5/CentOS%205.6%E4%B8%8BGit%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%AE%89%E8%A3%85%E6%89%8B%E8%AE%B0/
克隆GitLab Shell
git clone git://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell
切换到最新的分支
git checkout v1.2.0
生产配置文件
cp config.yml.example config.yml
更改配置信息,一般就改下你部署的域名地址gitlab_url
vim config.yml # Url to gitlab instance. Used for api calls. Should be ends with slash.gitlab_url: "" #改成你的域名或者IP
安装
./bin/install安装数据库
gitlab支持mysql和postgresql,,这里以mysql为例,postgresql会比较麻烦!
切换回root用户
su – root
安装mysql及开发包
yum install -y mysql-server mysql mysql-devel
启动数据库
service mysqld start
初始化GitLab数据库
mysql -u root -p Enter password: (直接按回车键)Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.30 MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement. mysql> CREATE USER ‘gitlab’@’localhost’ IDENTIFIED BY ‘gitlab’; Query OK, 0 rows affected (0.01 sec) mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;Query OK, 1 row affected (0.00 sec) mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO ‘gitlab’@’localhost’;Query OK, 0 rows affected (0.00 sec) mysql> \q Bye
测试gitlab用户连接mysql
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production安装GitLab
终于到GitLab的安装了,进入git用户
su – git cd ~/
克隆GitLab
sudo -u git -H git clone git://github.com/gitlabhq/gitlabhq.git gitlab cd gitlab一切都在发展变化,不断地向昨天告别,满怀信心地投入每一个崭新的今天。