参考文章:
http://www.centoscn.com/image-text/install/2015/0320/4929.html
http://www.centoscn.com/CentosServer/test/2015/0211/4692.html
http://blog.csdn.net/hcbbt/article/details/11651229/ (github 使用方法)
CentOS | 6.6 |
Python | 2.6 |
Ruby | 2.1.5 |
Git | 1.7.10+ |
Redis | 3.0.0 |
MySQL | 5.6.22 |
GitLab | 7-8-stable |
GitLab Shell | v2.6.0 |
yum源
为了提高软件安装速度,将yum源设置为阿里云开源镜像
$ cd /etc/yum.repos.d
$ wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
必要软件包
$ 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
安装Git
// 查看当前git版本
$ git --version
// 如果小于1.7.10则先卸载
$ yum remove git
// 下载最新的git并安装
$ wget -O git-src.zip https://github.com/git/git/archive/master.zip
$ unzip git-src.zip
$ cd git-src
$ make prefix=/usr/local all
$ make prefix=/usr/local install
$ ln -fs /usr/local/bin/git* /usr/bin/
安装Ruby环境
$ mkdir /tmp/ruby && cd /tmp/ruby
#下载ruby并且解压
$ curl --progress ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.1.5.tar.gz | tar xz
$ cd ruby-2.1.5
$ ./configure --disable-install-rdoc
$ make && make install
$ ln -s /usr/local/bin/ruby /usr/bin/ruby
$ ln -s /usr/local/bin/gem /usr/bin/gem
$ ln -s /usr/local/bin/bundle /usr/bin/bundle
// 设置ruby gem源为淘宝
$ gem source -r https://rubygems.org/
// 必须设置为 https 的他们源
$ gem source -a https://ruby.taobao.org/
#在此处我下边命令没执行成功
$ gem install bundler --no-ri --no-rdoc
安装MySQL及初始化GitLab库
方式一:yum方式安装:
$ yum install mysql mysql-devel mysql-server -y
$ /etc/init.d/mysqld start
$ chkconfig mysqld on
方式二:http://yjph83.iteye.com/blogs/2167094 编译安装
方式三:http://yjph83.iteye.com/blog/2098171 下载rpm包安装
// 登录mysql创建gitab的帐号和数据库
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
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 ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
//测试是否可以用git帐号登录数据库
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production
安装Redis
方式一:yum方式安装
$ yum -y install redis
$ /etc/init.d/redis start
$ chkconfig redis on
方式二:http://yjph83.iteye.com/blog/2098006
2进制的安装方式
添加git帐号并允许sudo
$ useradd --comment 'GitLab' git
$ echo "git ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
Defaults secure_path =
/sbin
:
/bin
:
/usr/sbin
:
/usr/bin
:
/usr/local/bin
安装GitLab
$ /home/git
$ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-8-stable gitlab #此命令执行后必须不能报错
$ cd /home/git/gitlab
$ sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
// 编辑git路径, gitlab的host:port
$ vim config/gitlab.yml
// bin_path: /usr/local/bin/git
// host: localhost
// port: 80
// 给文件夹添加相应的权限
$ chown -R git log/
$ chown -R git tmp/
$ chmod -R u+rwX log/
$ 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 -u git -H mkdir tmp/pids/
$ sudo -u git -H mkdir tmp/sockets/
$ sudo -u git -H mkdir public/uploads
$ 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 cp config/database.yml.mysql config/database.yml
$ sudo -u git -H vim config/database.yml
$ vim config/database.yml
// production:
// username: gitlab
// password: "gitlab"
安装GitLab-Shell
$ cd /home/git
$ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v2.6.0
$ cd gitlab-shell/
$ sudo -u git -H cp config.yml.example config.yml
// 编辑配置文件, 设置gitlab_url, redis-cli, log-level...
$ vim config.yml
// gitlab_url: "http://localhost/"
// /usr/bin/redis-cli #指定redis的redis-cli 目录
// 安装git-shell
$ sudo -u git -H ./bin/install
安装需要ruby的gems
$ cd /home/git/gitlab
# 先修改当前目录下的 Gemfile 文件
$ vim Gemfile source
'https://ruby.taobao.org/'
#将源指向到淘宝的源
# 不修改源是不能执行成功的。
$ sudo -u git -H bundle install --deployment --without development test postgres aws
如果上边命令出现如下错误:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rugged-0.21.2 for inspection.
Results logged to /home/git/gitlab/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/rugged-0.21.2/gem_make.out
An error occurred while installing rugged (0.21.2), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.
有以上错误时:执行命令:
$ yum install -y cmake
初始化数据库(创建GitLab相关表)
$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
安装启动文件以及日志切割文件
cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
设置git帐号信息--全局用户和邮件
$ sudo
-u git -H git config --global user.name
"GitLab"
$ sudo
-u git -H git config --global user.email
"example@example.com"
$ sudo
-u git -H git config --global core.autocrlf input
安装Nginx
方式一:yum安装方式
$ yum -y install nginx
方式二:二进制安装
http://yjph83.iteye.com/admin/blogs/2083150
$ vim /etc/nginx/nginx.conf
user root git;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
# GITLAB# Maintainer: @randx# App Version: 5.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml
client_max_body_size 5m;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log; #必须有/var/log/nginx/
error_log /var/log/nginx/gitlab_error.log; #必须有/var/log/nginx/
location / {
# serve static files from defined root folder;.# @gitlab is a named location for the upstream fallback, see below
try_files $uri$uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitlab;
}
}
}
更改权限,启动nginx
$ nginx -t #检查配置文件是否正常
$ chown -R git:git /var/log/nginx/ #文件文件目录权限
$ /usr/local/nginx/sbin/nginx
下载服务脚本
$ wget -O /etc/init.d/gitlab https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/sysvinit/centos/gitlab-unicorn
$ chmod +x /etc/init.d/gitlab
$ chkconfig --add gitlab
$ chkconfig gitlab on
检测当前环境
再次进入/home/git/gitlab 目录中
$ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
拉取gitlab静态资源文件
$ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
启动gitlab
$ /etc/init.d/gitlab start
启动报错
检测各个组件是否正常工作
$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Check GitLab API access: FAILED: Failed to connect to internal API
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
此时检查:gitlab目录下的config目录中的gitlab.yml文件中:host 和端口;
[root@localhost gitlab]# vim config/gitlab.yml
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 172.17.123.137 #localhost
port: 8081 #
与unicorn.rb文件中的ip和端口要一致;
[root@localhost gitlab]# vim config/unicorn.rb
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "172.17.123.137:8081", :tcp_nopush => true
且,gitlab-shell目录下的config.yml文件中的 gitlab_url 值中的ip和端口一致
[root@localhost gitlab]# vim ../gitlab-shell/config.yml
gitlab_url: "http://172.17.123.137:8081/"
保证以上OK后,再次执行命令检查;
$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
提示如下:
Test redis-cli executable: redis-cli 3.0.0 Send ping to redis server: Could not connect to Redis at /var/run/redis/redis.sock: No such file or directory gitlab-shell self-check failed
我将:gitlab-shell目录下的config.yml文件socket: "/var/run/redis/redis.sock" 注释掉
[root@localhost gitlab]# vim ../gitlab-shell/config.yml
redis:
bin: /usr/bin/redis-cli
#/usr/local/redis-3.0.0/src/redis-cli #/usr/bin/redis-cli
host: 127.0.0.1
port: 6379
# pass: redispass # Allows you to specify the password for Redis
database: 0
#socket: "/var/run/redis/redis.sock" # Comment out this line if you want to use TCP
namespace: resque:gitlab
再次检查:
Init script up-to-date? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
这个提示也还是存在,网络上说不用管了,
Redis version >= 2.0.0? ... no
Try fixing it:
Update your redis server to a version >= 2.0.0
For more information see:
gitlab-public-wiki/wiki/Trouble-Shooting-Guide in section sidekiq
这个提示还是存在,但是我已经装了 redis 3.0 的版本了,我试试登录OK的, 所以就没用管了
地址栏输入:访问OK! 登录后需要修改当前密码。OK!
#访问登录
#用户名:root
#密码:5iveL!fe
相关推荐
### CentOS 6.7 安装 JDK 1.8 的详细步骤 在 CentOS 6.7 上安装 JDK 1.8 是一项常见的任务,对于运行 Java 应用程序至关重要。以下是从连接到服务器到验证安装的整个过程: #### 1. 连接到 CentOS 服务器 首先,...
Centos6.7系统安装MySQL5.7总结 本资源总结了在Centos6.7系统中安装MySQL5.7的步骤,包括下载和安装MySQL软件包,创建数据库仓库目录,新建MySQL用户和组,修改目录属有者,配置参数,修改系统配置文件,启动MySQL...
centOS6.7下gcc-4.4.7的安装部件。满足各种需求 centOS6.7下gcc-4.4.7的安装部件。满足各种需求 centOS6.7下gcc-4.4.7的安装部件。满足各种需求 centOS6.7下gcc-4.4.7的安装部件。满足各种需求
6. **安装过程**: 使用"Centos6.7 ISO"和"VMware-workstation-full-16.0.0-16894299.exe",用户可以先安装VMware Workstation,然后在软件中导入CentOS 6.7的ISO文件,创建一个新的虚拟机并进行安装。 7. **虚拟化...
centos6.7镜像文件
CentOS-6.7.iso
### CentOS 6.7 安装及基本配置详解 #### 一、CentOS 6.7 的安装步骤 ##### 1. 准备工作 - **下载CentOS 6.7 镜像**:根据需求选择32位或64位版本。下载链接为:...
64 位CentOS 6.7 安装gcc V4.4.7的操作步骤 以及配套所需的rpm格式安装包 安装步骤: 1、rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm 2、rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm 3、rpm -ivh cloog-ppl-0.15.7-1.2.el6....
### CentOS 6.7 图文安装教程 #### 一、系统介绍 CentOS 6.7 是基于 Red Hat Enterprise Linux (RHEL) 6.7 版本构建的一个开源操作系统,它广泛应用于服务器环境中。与商业版 RHEL 相比,CentOS 提供了一个免费且...
详细记录在centos6.7上安装mysql5.5,使用过多次的安装手册,文档最下面有相应的rpm包下载链接
### CentOS 6.7 安装详细步骤与配置要点 #### 一、概述 CentOS 6.7 是一款基于 Linux 的稳定操作系统,广泛应用于服务器领域。本文将详细介绍 CentOS 6.7 的安装过程,包括从设置光盘启动到完成最小化安装的各个...
centos6.7安装mysql详细全过程,若有疑问,欢迎联系交流!
### CentOS 6.7 Minimal 安装与配置详解 #### 一、CentOS 6.7 虚拟机安装步骤 ##### 1.1 准备阶段 - **新建虚拟机**: 在虚拟化平台上(如VirtualBox)新建一个虚拟机,并指定其名称、类型(选择Linux),以及版本...
centos6.7官方镜像,使用方法: docker load -i centos6.7-image.tgz
该文档详细介绍,怎么样安装centos6.7,以及在cent0s环境下面安装tomcat,jdk
### CentOS 6.7 安装指南详尽解析 #### 一、安装前准备与启动选项 **标题**: "CentOS 6.7 详细安装指南" **描述**: "CentOS 6.7 详细安装指南" 从标题和描述中我们可以了解到这份文档是关于CentOS 6.7 的详细...
在这些压缩包中,"Centos6.8"、"Centos6.7"和"Centos6.9"表示的是各个版本的ISO镜像文件,可用于安装CentOS 6系统。 4. **安装与部署** 安装CentOS 6通常涉及以下步骤: - 制作安装介质:使用ISO镜像文件创建DVD...
在这个压缩包中,你应该找到了"gcc安装(centos6.7)"这个文件,它可能包含了所有必要的GCC组件和依赖。解压这个文件到一个方便的位置,例如 `/tmp` 目录。 安装步骤如下: 1. **创建工作目录**: 首先,创建一个...
centos6.7编译hadoop2.6 里面详细的写了过程 。ide为idea,这里注意一下
根据给定的信息,本文将详细解释如何在CentOS 7上安装和配置GitLab服务器,具体包括以下几个步骤:安装依赖软件、设置Postfix为GitLab提供邮件服务、下载并安装GitLab安装包以及最终的GitLab配置。 ### 一、安装...