环境准备
python版本2.6
git版本 1.8.4.1
ruby版本ruby-2.0.0-p353
gitlab-shell版本 v1.8.0
gitlab版本6.4.3
因centos6系列的python版本是2.6的,已经支持,所以不必升级python版本。
在centos5下面需要升级python版本>2.5
安装epel的yum源
1 |
yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm |
安装必要的软件包
1 |
yum -y install libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker |
原文链接:http://www.linuxyan.com/web-server/353.html
安装git
因为git需要1.8版本以上,所以需要重新编译安装
移除当前git
下载1.8.4.1的git并安装
1 |
curl --progress https://git-core.googlecode.com/files/git-1.8.4.1.tar.gz | tar xz |
3 |
make prefix=/usr/local all |
4 |
make prefix=/usr/local install |
5 |
ln -fs /usr/local/bin/git* /usr/bin/ |
安装ruby环境
02 |
mkdir /tmp/ruby && cd /tmp/ruby |
03 |
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz |
05 |
./configure --disable-install-rdoc |
07 |
gem source -r https://rubygems.org/ |
08 |
gem source -a http://ruby.taobao.org/ |
09 |
gem install bundler --no-ri --no-rdoc |
10 |
ln -s /usr/local/bin/ruby /usr/bin/ruby |
11 |
ln -s /usr/local/bin/gem /usr/bin/gem |
12 |
ln -s /usr/local/bin/bundle /usr/bin/bundle |
添加git帐号并允许sudo
1 |
useradd --comment 'GitLab' git |
2 |
echo "git ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers |
安装git-shell
02 |
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0 |
04 |
sudo -u git -H cp config.yml.example config.yml |
06 |
修改gitlab_url为gitlab的域名 |
11 |
sudo -u git -H ./bin/install |
安装mysql以及建立gitlab数据库
01 |
yum install mysql mysql-devel mysql-server -y |
02 |
/etc/init.d/mysqld start |
05 |
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab'; |
06 |
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; |
07 |
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; |
11 |
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production |
安装redis
2 |
/etc/init.d/redis start |
安装gitlab
02 |
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-4-stable gitlab |
04 |
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml |
07 |
修改host为刚才git-shell里面设置的域名 |
10 |
## Web server settings |
11 |
host: git.linuxyan.com |
17 |
bin_path: /usr/local/bin/git |
25 |
sudo -u git -H mkdir /home/git/gitlab-satellites |
26 |
sudo -u git -H mkdir tmp/pids/ |
27 |
sudo -u git -H mkdir tmp/sockets/ |
28 |
sudo chmod -R u+rwX tmp/pids/ |
29 |
sudo chmod -R u+rwX tmp/sockets/ |
30 |
sudo -u git -H mkdir public/uploads |
31 |
sudo chmod -R u+rwX public/uploads |
32 |
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb |
33 |
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb |
设置gitlab的全局帐号
1 |
sudo -u git -H git config --global user.name "GitLab" |
2 |
sudo -u git -H git config --global user.email "gitlab@localhost" |
3 |
sudo -u git -H git config --global core.autocrlf input |
设置数据库链接地址和权限
01 |
sudo -u git cp config/database.yml.mysql config/database.yml |
02 |
sudo -u git -H vim config/database.yml |
08 |
database: gitlabhq_production |
13 |
# socket: /tmp/mysql.sock |
安装需要ruby的gems
6 |
修改remote: https://rubygems.org/ |
7 |
为remote: http://ruby.taobao.org/ |
9 |
sudo -u git -H bundle install --deployment --without development test postgres aws |
如果遇到如下错误:
1 |
Could not find modernizr-2.6.2 in any of the sources |
则修改:
02 |
修改:gem "modernizr", "2.6.2" |
03 |
为gem "modernizr-rails", "2.7.1" |
07 |
为:modernizr-rails (2.7.1) |
09 |
修改:modernizr (= 2.6.2) |
10 |
为:modernizr-rails (= 2.7.1) |
然后再执行安装
1 |
sudo -u git -H bundle install --deployment --without development test postgres aws |
过程如下图:


初始化数据库
1 |
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production |
初始化数据库之后,会告诉你默认的管理员用户和密码:


安装启动文件以及日志切割文件
1 |
cp lib/support/init.d/gitlab /etc/init.d/gitlab |
2 |
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab |
3 |
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab |
检测当前环境
1 |
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production |
如下:

安装nginx
修改配置文件:
vim /etc/nginx/nginx.conf
03 |
pid /var/run/nginx.pid; |
06 |
worker_connections 1024; |
10 |
include /etc/nginx/mime.types; |
11 |
default_type application/octet-stream; |
13 |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
14 |
'$status $body_bytes_sent "$http_referer" ' |
15 |
'"$http_user_agent" "$http_x_forwarded_for"'; |
21 |
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket; |
25 |
listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea |
26 |
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com; |
27 |
server_tokens off; # don't show the version number, a security best practice |
28 |
root /home/git/gitlab/public; |
30 |
# Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml |
31 |
client_max_body_size 5m; |
33 |
# individual nginx logs for this gitlab vhost |
34 |
access_log /var/log/nginx/gitlab_access.log; |
35 |
error_log /var/log/nginx/gitlab_error.log; |
38 |
# serve static files from defined root folder;. |
39 |
# @gitlab is a named location for the upstream fallback, see below |
40 |
try_files $uri $uri/index.html $uri.html @gitlab; |
43 |
# if a file, which is not found in the root folder is requested, |
44 |
# then the proxy pass the request to the upsteam (gitlab unicorn) |
50 |
proxy_set_header X-Forwarded-Proto $scheme; |
51 |
proxy_set_header Host $http_host; |
52 |
proxy_set_header X-Real-IP $remote_addr; |
53 |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
55 |
proxy_pass http://gitlab; |
更改权限,启动nginx
2 |
chown -R git.git /var/lib/nginx/ |
3 |
/etc/init.d/nginx start |
拉取gitlab静态资源文件
1 |
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production |
启动gitlab
1 |
/etc/init.d/gitlab start |
检测各个组件是否正常工作
1 |
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production |
检测没有错误就表示已经安装好了gitlab,如图:

这个时候就可以用浏览器打开http://git.linuxyan.com
初始管理员帐号和密码为:
admin@local.host
5iveL!fe
登录之后如下:

- GIT-Linux(CentOS7)系统部署git服务器
GIT-Linux(CentOS7)系统部署git服务器 root账号登录 一. 安装并配置必要的依赖关系在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget ...
- GIT-windows系统部署git服务器
windows系统部署git服务器 因为需要所以就来利用IIS(Internet Information Service )来进行搭建. 进入正文: 不管你是什么win7.win8.win8.1还是w ...
- [转]Centos 7 安装部署 GitLab 服务器
Centos 7 安装部署 GitLab 服务器 转自:https://www.jianshu.com/p/79bfded68899 文前说明 作为码农中的一员,需要不断的学习,我工作之余将一些分析总 ...
- 部署git服务器 gitServer 软件
部署git服务器 gitServer 软件 搭建git服务器也并不是非常的难,有这么多优秀的软件,选择一个适合自己就行了 1. windows版本 http://gitstack.com/ 免费版本, ...
- [转载]Ubuntu安装配置 git 服务器和客户端
原文地址:Ubuntu安装配置 git 服务器和客户端作者:ding404 1.配置前准备 服务器:安装ssh server另外还装了gitosis做git的权限管理 sudo apt-get ins ...
- 二十二. 安装部署Tomcat服务器、使用Tomcat部署虚拟主机、使用Varnish加速Web
web proxy web1 web2 1.安装部署Tomcat服务器 web1 1.1 使用RPM安装JDK环境 ]# yum -y install java-1.8.0-openjdk ]# ...
- 一、CentOS 7安装部署GitLab服务器
一.CentOS 7安装部署GitLab服务器 1.安装依赖软件 yum -y install policycoreutils policycoreutils-python openssh-serve ...
- Linux安装部署FTP服务器
Linux安装部署FTP服务器 本文章会将安装FTP服务器的步骤以及一些遇到的问题来记录下 因为项目中要与第三方对接数据,需要用到FTP服务器以提供他们每天上传数据,因为之前在本地的VMware虚 ...
- 高级运维(四):Nginx常见问题处理、安装部署Tomcat服务器、使用Tomcat部署虚拟主机
一.Nginx常见问题处理 目标: 本案例要求对Nginx服务器进行适当优化,以提升服务器的处理性能: 1> 不显示Nginx软件版本号 2> 如果客户端访问服务器提示“Too many ...
随机推荐
- Easyui入门视频教程 第04集---Easyui布局
目录 目录 ----------------------- Easyui入门视频教程 第09集---登录完善 图标自定义 Easyui入门视频教程 第08集---登录实现 ajax button的 ...
- webview中事件的用法
封装 MBProgressHud ==================================== #import "MBProgressHUD.h" @interface ...
- iOS 设备的CPU架构以及查看framework支持架构
记录一下,感觉摘录的还是比较全的: 模拟器:4s-5: i3865s-7 Plus: x86_64 真机(iOS设备):armv6: iPhone.iPhone 2.iPhone 3G.iPod To ...
- Mac巧用AirDrop实现大文件传输
最近想更新一下Xcode8.3,无奈资源太大,不想一点点下载了,公司服务器上正好有官网下载好的,就想直接拿过来使用,本来想通过QQ传输的,无奈发现QQ传输提示资源过大. 于是就想到了这货:AirDro ...
- @Transactional注解事务不回滚不起作用无效
写在前面 数据库Mysql8.0 添加@Transactional注解后事务并未起作用. 修改表的引擎后ok了.(详看下面转载内容) ================================ ...
- c++ remove_if
#include <algorithm> 函数remove_if()移除序列[start, end)中所有应用于谓词p返回true的元素. 此函数返回一个指向被修剪的序列的最后一个元素迭代 ...
- mysql--SQL编程(关于mysql中的日期,实例,判断生日是否为闰年) 学习笔记2.1
关于日期处理的实例: 从mysql给出的 example 这个是官方源码下载以及导入,http://dev.mysql.com/doc/employee/en/employees-installati ...
- [转]nf_conntrack: table full, dropping packet 连接跟踪表已满,开始丢包 的解决办法
nf_conntrack: table full, dropping packet 连接跟踪表已满,开始丢包 的解决办法 中午业务说机器不能登录,我通过USM管理界面登录单板的时候发现机器没有僵 ...
- CentOS7下解决ifconfig command not found
原文地址:https://blog.csdn.net/ryu2003/article/details/78492127 注:本办法仅限于可联网的机器,即在安装时设置了IP地址和DNS可正常上网. 解决 ...
- QQMacMgr for Mac(腾讯电脑管家)安装
1.软件简介 腾讯电脑管家是 macOS 系统上一款由腾讯公司带来到的安全管理软件.功能有垃圾清理.软件仓库.小火箭加速和防钓鱼等.而在视觉 UI 上,导入星空概念,操作过场动画全部以星空为题材 ...