- 浏览: 224423 次
- 性别:
- 来自: 西安
文章分类
- 全部博客 (143)
- java (13)
- mongodb (15)
- linux (31)
- mysql (2)
- cache (1)
- Android (3)
- lucene (2)
- javascript (9)
- php (13)
- 人生 (2)
- solr (7)
- 跨域iframe (1)
- 统计学 (1)
- redis (0)
- amazon aws (2)
- 国内比较便宜的vps (1)
- nginx (5)
- sns api应用 (1)
- api (1)
- postfix (1)
- nodejs (1)
- gitlab (1)
- myeclipse (1)
- matlab (3)
- ubuntu (2)
- stardict (1)
- cdn (1)
- lajp (1)
- workerman (1)
- tensorflow (1)
- 协同推荐算法 (3)
- html5 (1)
- extensions (3)
- Rome (1)
- 正则 (1)
- EBS (1)
- python (5)
- https (1)
- iptables (1)
- facebook (0)
- ImageMagick (0)
- elasticsearch (1)
- Flask (1)
- wordpress (0)
- kubernetes (0)
最新评论
-
三尺寒冰:
怎么实现排序的?分析一下
php mongodb 实现group 并按照某字段排序
Centos 6.5上构建Git Lab服务及问题总结
注意:必须是6.0以上,不然问题太多了,崩溃
——安装前准备工作
1)添加epel源
[root@Git ~]# mkdir /tmp/soft/
[root@Git ~]# cd /tmp/soft/
[root@Git soft]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@Git soft]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
2)配置epel源
vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#download.fedoraproject.org域名已经失效
#去掉#号将download.fedoraproject.org变更为dl.fedoraproject.org
baseurl=http://dl.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
3)执行yum makecache 更新
[root@Git soft]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.7 kB 00:00
base/group_gz | 220 kB 00:00
base/filelists_db | 5.9 MB 00:03
base/other_db | 2.8 MB 00:01
epel | 4.4 kB 00:00
epel/group_gz | 237 kB 00:05
epel/filelists_db | 8.4 MB 05:56
epel/primary_db | 6.1 MB 03:36
epel/other_db | 3.6 MB 01:22
epel/updateinfo | 780 kB 00:11
extras | 3.4 kB 00:00
extras/filelists_db | 11 kB 00:00
extras/prestodelta | 907 B 00:00
extras/other_db | 5.8 kB 00:00
mariadb | 1.9 kB 00:00
mariadb/filelists_db | 47 kB 00:01
mariadb/primary_db | 15 kB 00:00
mariadb/other_db | 1.2 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 1.7 MB 00:01
updates/prestodelta | 249 kB 00:00
updates/primary_db | 2.6 MB 00:02
updates/other_db | 21 MB 00:15
epel/pkgtags | 1.0 MB 00:36
Metadata Cache Created
4)安装软件所需依赖包
[root@Git soft]# yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis wget crontabs logwatch logrotate perl-Time-HiRes git gettext-devel libel openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel expat-devel gettext-devel tk-devel libxml2-devel libffi-devel libxslt-devel libicu-devel python-pip sqlite-devel patch libyaml* pcre-devel
——安装Git Server
[root@Git soft]# yum -y install git perl-ExtUtils-MakeMaker
[root@Git soft]# git clone git://github.com/git/git
Initialized empty Git repository in /tmp/soft/git/.git/
remote: Counting objects: 171891, done.
remote: Compressing objects: 100% (46560/46560), done.
remote: Total 171891 (delta 123695), reused 171404 (delta 123322)
Receiving objects: 100% (171891/171891), 60.16 MiB | 571 KiB/s, done.
Resolving deltas: 100% (123695/123695), done.
[root@Git soft]# cd git/
[root@Git git]# git checkout v1.9.2
[root@Git git]# autoconf
[root@Git git]# make prefix=/usr/local/git all
这个地方会出现错误:解决办法 ,http://my.oschina.net/u/878124/blog/263644
[root@Git git]# make prefix=/usr/local/git install
[root@Git git]# yum erase git
[root@Git git]# ln -s /usr/local/git/bin/* /usr/bin/
[root@Git git]# git --version
git version 1.9.2 #表示安装成功
#删除git安装包
[root@Git git]# cd ..
[root@Git soft]# rm -rf git/
——安装配置ruby
1)下载ruby
[root@Git soft]# wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
2)编译安装ruby
[root@Git soft]# tar zfvx ruby-2.1.1.tar.gz
[root@Git soft]# cd ruby-2.1.1
[root@Git ruby-2.1.1]# ./configure
[root@Git ruby-2.1.1]# make && make install
#安装bundler需要添加rubygems的国内镜像
[root@Git ruby-2.1.1]# gem sources --remove https://rubygems.org/
[root@Git ruby-2.1.1]# gem source -a http://ruby.taobao.org/
[root@Git ruby-2.1.1]# gem sources -l
*** CURRENT SOURCES ***
http://ruby.taobao.org/
[root@Git ruby-2.1.1]# gem install bundler
Fetching: bundler-1.6.2.gem (100%)
Successfully installed bundler-1.6.2
Parsing documentation for bundler-1.6.2
Installing ri documentation for bundler-1.6.2
Done installing documentation for bundler after 2 seconds
1 gem installed
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/ruby /usr/bin/ruby
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/gem /usr/bin/gem
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/bundle /usr/bin/bundle
3)创建一个Git用户供GitLab使用
#之前已经搭建过Git Server不需要再次创建Git用户
[root@Git ruby-2.1.1]# adduser --comment 'GitLab' git
[root@Git ruby-2.1.1]# passwd git
#为了方便添加git用户拥有root权限 [sudoers文件默认没有写权限需要强制保存:wq!]
[root@Git ruby-2.1.1]# vi /etc/sudoers
git ALL=(ALL) ALL
[root@Git ruby-2.1.1]# chmod -R 755 /home/git
[root@Git ruby-2.1.1]# vi /home/git/.bash_profile
export GIT_SSL_NO_VERIFY=1
[root@Git ruby-2.1.1]# source /home/git/.bash_profile
#不添加变量的话使用https链接会报如下错误
fatal: unable to access 'https://github.com/gitlabhq/grit.git/': Peer certificate cannot be authenticated with known CA certificates
4)安装GitLab的Shell
[root@Git git]# su - git
#克隆gitlab的shell
[git@Git ~]$ git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0
正克隆到 'gitlab-shell'...
remote: Reusing existing pack: 1222, done.
remote: Total 1222 (delta 0), reused 0 (delta 0)
接收对象中: 100% (1222/1222), 218.70 KiB | 16.00 KiB/s, done.
处理 delta 中: 100% (620/620), done.
检查连接... 完成。
[git@Git ~]$ cd gitlab-shell/
[git@Git gitlab-shell]$ cp config.yml.example config.yml
[git@Git gitlab-shell]$ vi config.yml
#自己的gitlab域名
gitlab_url: "http://git.test.com/"
#完成配置
[git@Git gitlab-shell]$ ./bin/install
mkdir -p /home/git/repositories: true
mkdir -p /home/git/.ssh: true
chmod 700 /home/git/.ssh: true
touch /home/git/.ssh/authorized_keys: true
chmod 600 /home/git/.ssh/authorized_keys: true
chmod -R ug+rwX,o-rwx /home/git/repositories: true
find /home/git/repositories -type d -print0 | xargs -0 chmod g+s: true
安装mysql
http://blog.csdn.net/fyq891014/article/details/17360245
5)建立gitlab数据库并授权
[git@Git gitlab-shell]$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.36-MariaDB-wsrep MariaDB Server, wsrep_25.9.r3961
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
Query OK, 0 rows affected (0.20 sec)
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.11 sec)
MariaDB [(none)]> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.06 sec)
MariaDB [(none)]> quit
Bye
6)克隆GitLab源
[git@Git gitlab-shell]$ cd ..
[git@Git ~]$ git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-4-stable gitlab
正克隆到 'gitlab'...
remote: Reusing existing pack: 77202, done.
remote: Counting objects: 67, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 77269 (delta 25), reused 1 (delta 0)
接收对象中: 100% (77269/77269), 75.26 MiB | 241.00 KiB/s, done.
处理 delta 中: 100% (53687/53687), done.
[git@Git ~]$ cd gitlab
[git@Git gitlab]$ cp config/gitlab.yml.example config/gitlab.yml
[git@Git gitlab]$ vi config/gitlab.yml
## GitLab settings
gitlab:
## Web server settings
host: git.test.com
port: 80
https: false
[git@Git gitlab]$ chown -R git log/
[git@Git gitlab]$ chown -R git tmp/
[git@Git gitlab]$ chmod -R u+rwX log/
[git@Git gitlab]$ chmod -R u+rwX tmp/
[git@Git gitlab]$ mkdir tmp/pids/
[git@Git gitlab]$ mkdir tmp/sockets/
[git@Git gitlab]$ chmod -R u+rwX tmp/pids/
[git@Git gitlab]$ chmod -R u+rwX tmp/sockets/
[git@Git gitlab]$ mkdir public/uploads
[git@Git gitlab]$ chmod -R u+rwX public/uploads
[git@Git gitlab]$ cp config/unicorn.rb.example config/unicorn.rb
[git@Git gitlab]$ cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
[git@Git gitlab]$ git config --global user.name "GitLab"
[git@Git gitlab]$ git config --global user.email "gitlab@localhost"
[git@Git gitlab]$ git config --global core.autocrlf input
7)配置gitlab数据库
[git@Git gitlab]$ cp config/database.yml.mysql config/database.yml
[git@Git gitlab]$ vi config/database.yml
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: gitlab
password: "gitlab"
# host: localhost
# socket: /tmp/mysql.sock
8)安装gems
[git@Git gitlab]$sudo gem install charlock_holmes --version '0.6.9.4'
Fetching: charlock_holmes-0.6.9.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed charlock_holmes-0.6.9.4
Parsing documentation for charlock_holmes-0.6.9.4
Installing ri documentation for charlock_holmes-0.6.9.4
Done installing documentation for charlock_holmes after 0 seconds
1 gem installed
[git@Git gitlab]$ vi Gemfile
source "https://rubygems.org"改为source "http://rubygems.org"
[git@Git gitlab]$ bundle install --deployment --without development test postgres
Fetching source index from http://rubygems.org/
Fetching https://github.com/gitlabhq/grit.git
Could not find modernizr-2.6.2 in any of the sources
#出现错误:Could not find modernizr-2.6.2 in any of the sources
#解决办法:
[git@Git gitlab]$ vi Gemfile
第114行 gem "modernizr", "2.6.2"
更改改为:
第114行 gem "modernizr-rails", "2.7.1"
[git@Git gitlab]$ vi Gemfile.lock
第270多行 modernizr (2.6.2)
更改改为:
第270多行 modernizr-rails (2.7.1)
第800多行 modernizr (= 2.6.2)
更改改为:
第800多行 modernizr-rails (= 2.7.1)
#重新执行:
[git@Git gitlab]$ bundle install --deployment --without development test postgres puma aws
这里会有各种错误:
http://my.oschina.net/u/1169607/blog/344142
主要是在root下 执行:yum install libicu-devel mysql-devel pcre-devel postfix
9)启动redis
[git@Git gitlab]$ sudo /etc/init.d/redis start
启动 :[确定]
[git@Git gitlab]$ sudo chkconfig redis on
10)对数据库进行初始化
[git@Git gitlab]$ bundle exec rake gitlab:setup RAILS_ENV=production --verbose
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
#最后初始化成功后会获得账号和密码
Administrator account created:
login.........admin@local.host
password......5iveL!fe
这个地方会报错,需要配置:
http://my.oschina.net/wanglihui/blog/381130
11)检查GitLab及其环境的配置是否正确
[[git@Git gitlab]$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: CentOS release 6.5 (Final)
Current User: git
Using RVM: no
Ruby Version: 2.1.1p76
Gem Version: 2.2.2
Bundler Version:1.6.2
Rake Version: 10.1.0
GitLab information
Version: 6.4.3
Revision: 3173626
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://git.yingtao.com
HTTP Clone URL: http://git.yingtao.com/some-project.git
SSH Clone URL: git@git.yingtao.com:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.9.3
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
[git@Git gitlab]$ bundle exec rake sidekiq:start RAILS_ENV=production
rake aborted!
SIGTERM
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `system'
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `block (2 levels) in <top (required)>'
Tasks: TOP => sidekiq:start
(See full trace by running task with --trace)
[git@Git gitlab]$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.7.9 ? ... OK (1.9.3)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.4.10
Send ping to redis server: PONG
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
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.
#原文说可以忽略上面的错误,不影响使用
projects have namespace: ... can't check, you have no projects
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.9.2)
Checking GitLab ... Finished
11)下载启动脚本
[git@Git gitlab]$ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn -P /etc/init.d/
[git@Git gitlab]$ sudo mv /etc/init.d/gitlab-unicorn /etc/init.d/gitlab
[git@Git gitlab]$ sudo chmod +x /etc/init.d/gitlab
[git@Git gitlab]$ sudo chkconfig --add gitlab
[git@Git gitlab]$ sudo chkconfig gitlab on
[git@Git gitlab]$ sudo /etc/init.d/gitlab start
我在root下执行的
12)复制配置文件[这里使用nginx做为WEB服务]
[git@Git gitlab]$ cp lib/support/nginx/gitlab /usr/local/nginx/conf/conf.d/
[git@Git gitlab]$ cd /usr/local/nginx/conf/conf.d/
[git@Git gitlab]$ sudo chown -R git:git .
[git@Git conf.d]$ cp gitlab gitlab.conf
[git@Git conf.d]$ vi gitlab.conf
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 git.test.com; # 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;
client_max_body_size 5m;
access_log logs/gitlab_access.log;
error_log logs/gitlab_error.log;
location / {
try_files $uri $uri/index.html $uri.html @gitlab;
}
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;
}
}
[git@Git conf.d]$ sudo service nginx restart
13)拉取GitLab静态文件
[git@Git conf.d]$ cd /home/git/gitlab
[git@Git gitlab]$ bundle exec rake assets:precompile RAILS_ENV=production
[git@Git gitlab]$ sudo service gitlab restart
14)访问测试
1
2
3
初始管理员帐号和密码为:
admin@local.host
5iveL!fe
借鉴:
http://hypocritical.blog.51cto.com/3388028/1405574
注意:必须是6.0以上,不然问题太多了,崩溃
——安装前准备工作
1)添加epel源
[root@Git ~]# mkdir /tmp/soft/
[root@Git ~]# cd /tmp/soft/
[root@Git soft]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@Git soft]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
2)配置epel源
vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#download.fedoraproject.org域名已经失效
#去掉#号将download.fedoraproject.org变更为dl.fedoraproject.org
baseurl=http://dl.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
3)执行yum makecache 更新
[root@Git soft]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.7 kB 00:00
base/group_gz | 220 kB 00:00
base/filelists_db | 5.9 MB 00:03
base/other_db | 2.8 MB 00:01
epel | 4.4 kB 00:00
epel/group_gz | 237 kB 00:05
epel/filelists_db | 8.4 MB 05:56
epel/primary_db | 6.1 MB 03:36
epel/other_db | 3.6 MB 01:22
epel/updateinfo | 780 kB 00:11
extras | 3.4 kB 00:00
extras/filelists_db | 11 kB 00:00
extras/prestodelta | 907 B 00:00
extras/other_db | 5.8 kB 00:00
mariadb | 1.9 kB 00:00
mariadb/filelists_db | 47 kB 00:01
mariadb/primary_db | 15 kB 00:00
mariadb/other_db | 1.2 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 1.7 MB 00:01
updates/prestodelta | 249 kB 00:00
updates/primary_db | 2.6 MB 00:02
updates/other_db | 21 MB 00:15
epel/pkgtags | 1.0 MB 00:36
Metadata Cache Created
4)安装软件所需依赖包
[root@Git soft]# yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis wget crontabs logwatch logrotate perl-Time-HiRes git gettext-devel libel openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel expat-devel gettext-devel tk-devel libxml2-devel libffi-devel libxslt-devel libicu-devel python-pip sqlite-devel patch libyaml* pcre-devel
——安装Git Server
[root@Git soft]# yum -y install git perl-ExtUtils-MakeMaker
[root@Git soft]# git clone git://github.com/git/git
Initialized empty Git repository in /tmp/soft/git/.git/
remote: Counting objects: 171891, done.
remote: Compressing objects: 100% (46560/46560), done.
remote: Total 171891 (delta 123695), reused 171404 (delta 123322)
Receiving objects: 100% (171891/171891), 60.16 MiB | 571 KiB/s, done.
Resolving deltas: 100% (123695/123695), done.
[root@Git soft]# cd git/
[root@Git git]# git checkout v1.9.2
[root@Git git]# autoconf
[root@Git git]# make prefix=/usr/local/git all
这个地方会出现错误:解决办法 ,http://my.oschina.net/u/878124/blog/263644
[root@Git git]# make prefix=/usr/local/git install
[root@Git git]# yum erase git
[root@Git git]# ln -s /usr/local/git/bin/* /usr/bin/
[root@Git git]# git --version
git version 1.9.2 #表示安装成功
#删除git安装包
[root@Git git]# cd ..
[root@Git soft]# rm -rf git/
——安装配置ruby
1)下载ruby
[root@Git soft]# wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
2)编译安装ruby
[root@Git soft]# tar zfvx ruby-2.1.1.tar.gz
[root@Git soft]# cd ruby-2.1.1
[root@Git ruby-2.1.1]# ./configure
[root@Git ruby-2.1.1]# make && make install
#安装bundler需要添加rubygems的国内镜像
[root@Git ruby-2.1.1]# gem sources --remove https://rubygems.org/
[root@Git ruby-2.1.1]# gem source -a http://ruby.taobao.org/
[root@Git ruby-2.1.1]# gem sources -l
*** CURRENT SOURCES ***
http://ruby.taobao.org/
[root@Git ruby-2.1.1]# gem install bundler
Fetching: bundler-1.6.2.gem (100%)
Successfully installed bundler-1.6.2
Parsing documentation for bundler-1.6.2
Installing ri documentation for bundler-1.6.2
Done installing documentation for bundler after 2 seconds
1 gem installed
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/ruby /usr/bin/ruby
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/gem /usr/bin/gem
[root@Git ruby-2.1.1]# ln -s /usr/local/bin/bundle /usr/bin/bundle
3)创建一个Git用户供GitLab使用
#之前已经搭建过Git Server不需要再次创建Git用户
[root@Git ruby-2.1.1]# adduser --comment 'GitLab' git
[root@Git ruby-2.1.1]# passwd git
#为了方便添加git用户拥有root权限 [sudoers文件默认没有写权限需要强制保存:wq!]
[root@Git ruby-2.1.1]# vi /etc/sudoers
git ALL=(ALL) ALL
[root@Git ruby-2.1.1]# chmod -R 755 /home/git
[root@Git ruby-2.1.1]# vi /home/git/.bash_profile
export GIT_SSL_NO_VERIFY=1
[root@Git ruby-2.1.1]# source /home/git/.bash_profile
#不添加变量的话使用https链接会报如下错误
fatal: unable to access 'https://github.com/gitlabhq/grit.git/': Peer certificate cannot be authenticated with known CA certificates
4)安装GitLab的Shell
[root@Git git]# su - git
#克隆gitlab的shell
[git@Git ~]$ git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0
正克隆到 'gitlab-shell'...
remote: Reusing existing pack: 1222, done.
remote: Total 1222 (delta 0), reused 0 (delta 0)
接收对象中: 100% (1222/1222), 218.70 KiB | 16.00 KiB/s, done.
处理 delta 中: 100% (620/620), done.
检查连接... 完成。
[git@Git ~]$ cd gitlab-shell/
[git@Git gitlab-shell]$ cp config.yml.example config.yml
[git@Git gitlab-shell]$ vi config.yml
#自己的gitlab域名
gitlab_url: "http://git.test.com/"
#完成配置
[git@Git gitlab-shell]$ ./bin/install
mkdir -p /home/git/repositories: true
mkdir -p /home/git/.ssh: true
chmod 700 /home/git/.ssh: true
touch /home/git/.ssh/authorized_keys: true
chmod 600 /home/git/.ssh/authorized_keys: true
chmod -R ug+rwX,o-rwx /home/git/repositories: true
find /home/git/repositories -type d -print0 | xargs -0 chmod g+s: true
安装mysql
http://blog.csdn.net/fyq891014/article/details/17360245
5)建立gitlab数据库并授权
[git@Git gitlab-shell]$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.36-MariaDB-wsrep MariaDB Server, wsrep_25.9.r3961
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
Query OK, 0 rows affected (0.20 sec)
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.11 sec)
MariaDB [(none)]> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.06 sec)
MariaDB [(none)]> quit
Bye
6)克隆GitLab源
[git@Git gitlab-shell]$ cd ..
[git@Git ~]$ git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-4-stable gitlab
正克隆到 'gitlab'...
remote: Reusing existing pack: 77202, done.
remote: Counting objects: 67, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 77269 (delta 25), reused 1 (delta 0)
接收对象中: 100% (77269/77269), 75.26 MiB | 241.00 KiB/s, done.
处理 delta 中: 100% (53687/53687), done.
[git@Git ~]$ cd gitlab
[git@Git gitlab]$ cp config/gitlab.yml.example config/gitlab.yml
[git@Git gitlab]$ vi config/gitlab.yml
## GitLab settings
gitlab:
## Web server settings
host: git.test.com
port: 80
https: false
[git@Git gitlab]$ chown -R git log/
[git@Git gitlab]$ chown -R git tmp/
[git@Git gitlab]$ chmod -R u+rwX log/
[git@Git gitlab]$ chmod -R u+rwX tmp/
[git@Git gitlab]$ mkdir tmp/pids/
[git@Git gitlab]$ mkdir tmp/sockets/
[git@Git gitlab]$ chmod -R u+rwX tmp/pids/
[git@Git gitlab]$ chmod -R u+rwX tmp/sockets/
[git@Git gitlab]$ mkdir public/uploads
[git@Git gitlab]$ chmod -R u+rwX public/uploads
[git@Git gitlab]$ cp config/unicorn.rb.example config/unicorn.rb
[git@Git gitlab]$ cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
[git@Git gitlab]$ git config --global user.name "GitLab"
[git@Git gitlab]$ git config --global user.email "gitlab@localhost"
[git@Git gitlab]$ git config --global core.autocrlf input
7)配置gitlab数据库
[git@Git gitlab]$ cp config/database.yml.mysql config/database.yml
[git@Git gitlab]$ vi config/database.yml
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: gitlab
password: "gitlab"
# host: localhost
# socket: /tmp/mysql.sock
8)安装gems
[git@Git gitlab]$sudo gem install charlock_holmes --version '0.6.9.4'
Fetching: charlock_holmes-0.6.9.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed charlock_holmes-0.6.9.4
Parsing documentation for charlock_holmes-0.6.9.4
Installing ri documentation for charlock_holmes-0.6.9.4
Done installing documentation for charlock_holmes after 0 seconds
1 gem installed
[git@Git gitlab]$ vi Gemfile
source "https://rubygems.org"改为source "http://rubygems.org"
[git@Git gitlab]$ bundle install --deployment --without development test postgres
Fetching source index from http://rubygems.org/
Fetching https://github.com/gitlabhq/grit.git
Could not find modernizr-2.6.2 in any of the sources
#出现错误:Could not find modernizr-2.6.2 in any of the sources
#解决办法:
[git@Git gitlab]$ vi Gemfile
第114行 gem "modernizr", "2.6.2"
更改改为:
第114行 gem "modernizr-rails", "2.7.1"
[git@Git gitlab]$ vi Gemfile.lock
第270多行 modernizr (2.6.2)
更改改为:
第270多行 modernizr-rails (2.7.1)
第800多行 modernizr (= 2.6.2)
更改改为:
第800多行 modernizr-rails (= 2.7.1)
#重新执行:
[git@Git gitlab]$ bundle install --deployment --without development test postgres puma aws
这里会有各种错误:
http://my.oschina.net/u/1169607/blog/344142
主要是在root下 执行:yum install libicu-devel mysql-devel pcre-devel postfix
9)启动redis
[git@Git gitlab]$ sudo /etc/init.d/redis start
启动 :[确定]
[git@Git gitlab]$ sudo chkconfig redis on
10)对数据库进行初始化
[git@Git gitlab]$ bundle exec rake gitlab:setup RAILS_ENV=production --verbose
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
#最后初始化成功后会获得账号和密码
Administrator account created:
login.........admin@local.host
password......5iveL!fe
这个地方会报错,需要配置:
http://my.oschina.net/wanglihui/blog/381130
11)检查GitLab及其环境的配置是否正确
[[git@Git gitlab]$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: CentOS release 6.5 (Final)
Current User: git
Using RVM: no
Ruby Version: 2.1.1p76
Gem Version: 2.2.2
Bundler Version:1.6.2
Rake Version: 10.1.0
GitLab information
Version: 6.4.3
Revision: 3173626
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://git.yingtao.com
HTTP Clone URL: http://git.yingtao.com/some-project.git
SSH Clone URL: git@git.yingtao.com:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.9.3
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
[git@Git gitlab]$ bundle exec rake sidekiq:start RAILS_ENV=production
rake aborted!
SIGTERM
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `system'
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `block (2 levels) in <top (required)>'
Tasks: TOP => sidekiq:start
(See full trace by running task with --trace)
[git@Git gitlab]$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.7.9 ? ... OK (1.9.3)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.4.10
Send ping to redis server: PONG
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
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.
#原文说可以忽略上面的错误,不影响使用
projects have namespace: ... can't check, you have no projects
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.9.2)
Checking GitLab ... Finished
11)下载启动脚本
[git@Git gitlab]$ sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn -P /etc/init.d/
[git@Git gitlab]$ sudo mv /etc/init.d/gitlab-unicorn /etc/init.d/gitlab
[git@Git gitlab]$ sudo chmod +x /etc/init.d/gitlab
[git@Git gitlab]$ sudo chkconfig --add gitlab
[git@Git gitlab]$ sudo chkconfig gitlab on
[git@Git gitlab]$ sudo /etc/init.d/gitlab start
我在root下执行的
12)复制配置文件[这里使用nginx做为WEB服务]
[git@Git gitlab]$ cp lib/support/nginx/gitlab /usr/local/nginx/conf/conf.d/
[git@Git gitlab]$ cd /usr/local/nginx/conf/conf.d/
[git@Git gitlab]$ sudo chown -R git:git .
[git@Git conf.d]$ cp gitlab gitlab.conf
[git@Git conf.d]$ vi gitlab.conf
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 git.test.com; # 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;
client_max_body_size 5m;
access_log logs/gitlab_access.log;
error_log logs/gitlab_error.log;
location / {
try_files $uri $uri/index.html $uri.html @gitlab;
}
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;
}
}
[git@Git conf.d]$ sudo service nginx restart
13)拉取GitLab静态文件
[git@Git conf.d]$ cd /home/git/gitlab
[git@Git gitlab]$ bundle exec rake assets:precompile RAILS_ENV=production
[git@Git gitlab]$ sudo service gitlab restart
14)访问测试
1
2
3
初始管理员帐号和密码为:
admin@local.host
5iveL!fe
借鉴:
http://hypocritical.blog.51cto.com/3388028/1405574
相关推荐
在本教程中,我们将探讨如何在CentOS 6.4操作系统上安装Oracle 11g数据库。Oracle 11g是Oracle公司推出的企业级数据库管理系统,适用于大型企业应用,提供高性能、高可用性和安全性。在CentOS 6.4上安装Oracle 11g...
centos6.4的安装镜像。可以下一个VM,安装流程百度一大堆。
### CentOS 6.4 U盘安装详细指南 #### 一、前言 随着Linux系统的广泛应用,CentOS作为一款稳定...此外,由于CentOS 6.4版本较为老旧,建议用户在条件允许的情况下选择更新的版本进行安装,以便获得更好的性能和支持。
在《CentOS 6.4 i386的学习笔记-001 自定义安装图形界面》中,作者详细记录了在虚拟机环境下进行自定义安装CentOS 6.4 i386图形界面的全过程。自定义安装是一种高级安装方式,允许用户根据实际需求选择安装的组件和...
### CentOS 6.4安装(超级详细图解教程) #### 知识点一:CentOS 6.4系统概述 CentOS是Community ENTerprise Operating System的缩写,是一款基于Red Hat Enterprise Linux(RHEL)源代码编译的免费Linux发行版。...
### CentOS6.4单用户模式下Root密码破解详解 #### 一、背景介绍 在Linux系统管理中,可能会遇到忘记root账户密码的情况。这不仅会给系统维护带来不便,还可能影响到系统的正常使用。CentOS 6.4作为一款广泛使用的...
在本教程中,我们将深入探讨如何在 CentOS 6.4 操作系统上安装 Oracle 11g 数据库管理系统。Oracle 11g 是一个企业级的数据库解决方案,它提供了高性能、高可用性和安全性,适用于大型企业的关键业务应用。在 CentOS...
本文是关于如何在CentOS 6.4操作系统上安装和配置Qt 4.8.4开发环境的详细步骤。首先,我们将关注CentOS 6.4的安装过程,然后转向Qt开发环境的配置。 **一、CentOS 6.4的安装** 1. 将CentOS 6.4的安装盘放入光驱。 ...
本篇教程将详细介绍如何在CentOS 6.4操作系统上安装Oracle 12c数据库的单实例版本,并使用自动存储管理(ASM)。 首先,安装Oracle数据库之前,需要对系统环境进行全面的检查,确保操作系统满足Oracle 12c的安装...
根据给定的信息,本文将详细解释如何在CentOS 7上安装和配置GitLab服务器,具体包括以下几个步骤:安装依赖软件、设置Postfix为GitLab提供邮件服务、下载并安装GitLab安装包以及最终的GitLab配置。 ### 一、安装...
CentOS 6.4安装(超级详细图解教程) 说明: 1、CentOS 6.4 系统镜像有两个,安装系统只用到第一个镜像即 CentOS-6.4-i386-bin-DVD1.iso(32 位) 或者 CentOS-6.4-x86_64-bin-DVD1.iso(64 位),第二个镜像是...
在没有显示器的情况下安装Oracle数据库非常有用。在CentOS中,可以通过以下命令安装VNC Server: ```bash sudo yum install tigervnc-server -y ``` 然后设置VNC密码,并启动VNC服务: ```bash vncpasswd sudo ...
通过对CentOS 6.4系统下SSH服务器的详细介绍,我们可以了解到SSH不仅仅是一个简单的远程登录工具,它还提供了一系列强大的安全特性和服务。掌握SSH的使用对于Linux系统的管理和维护至关重要。通过本文所述的方法和...
自己动手从开箱上架开始,Dell CentOS 6.4服务器安装Oracle VM VirtualBox 操作的文档
VMware上的centos6.4虚拟机,直接下载解压导入即可使用
Centos7 源码安装Gitlab.md 存放这里,让大家下载快捷一点
在这种情况下,压缩包文件`centOs6.4补充rpm包`就派上用场了。这个压缩包可能包含了CentOS 6.4安装GCC和G++过程中可能缺少的一些特定依赖。解压该文件,然后逐个安装缺少的RPM包,例如: ```bash cd /path/to/...