博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
部署自己的gitlab服务器
阅读量:5814 次
发布时间:2019-06-18

本文共 6306 字,大约阅读时间需要 21 分钟。

1.

yum install gcc* libicu* -y

yum install mysql-devel -y

yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y

yum install gettext-devel -y

yum install curl-devel -y

mkdir -p /opt/src /opt/soft

cd /opt/src

tar xf git-2.6.2.tar.xz

cd git-2.6.2

./configure --prefix=/opt/soft/git --with-curl --with-expat

make && make install

echo 'export PATH=/opt/soft/git/bin:$PATH' >> /etc/profile

source /etc/profile

git --version

git clone https://github.com/gitlabhq/gitlab-shell.git gitlab-shell

还有redis改bind ip

2.yum install mysql mysql-server mysql-devel -y

3.

tar xf ruby-2.2.3.tar.gz

cd ruby-2.2.3

./configure --prefix=/opt/soft/ruby --disable-install-rdoc

make && make install

echo 'export PATH=/opt/soft/ruby/bin:$PATH' >> /etc/profile

source /etc/profile

4.

gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/

gem install bundler --no-ri --no-rdoc

5.

tar zxf node-v4.2.2-linux-x64.tar.gz

mv node-v4.2.2-linux-x64 /opt/soft/nodejs

echo 'export PATH=/opt/soft/nodejs/bin:$PATH' >> /etc/profile

6.

tar xf go1.5.1.linux-amd64.tar 

mv go /opt/soft/

echo 'export GOROOT=/opt/soft/go' >> /etc/profile

echo 'export GOARCH=amd64' >> /etc/profile

echo 'export GOOS=linux' >> /etc/profile

echo 'export GOBIN=$GOROOT/bin' >> /etc/profile

echo 'export GOPATH=/opt/soft/go/code/go' >> /etc/profile

echo 'export PATH=$GOBIN:$PATH' >> /etc/profile

7.

create database gitlab;

grant all privileges on gitlab.* to gitlab@'localhost' identified by 'gitlab';

8.

useradd -d /opt/git git

chmod 755 /opt/git

su - git

git clone https://gitlab.com/larryli/gitlab.git -b 8-0-zh gitlab

cd gitlab/

cp config/gitlab.yml.example config/gitlab.yml

cp config/secrets.yml.example config/secrets.yml

cp config/unicorn.rb.example config/unicorn.rb

cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

cp config/resque.yml.example config/resque.yml

cp config/database.yml.mysql config/database.yml

mkdir /opt/git/gitlab-satellites/

9.修改配置文件,因为默认是在 git 账号下的 home 目录,我们这里是在 /opt/git

mkdir -p  /opt/git/gitlab-satellites /opt/git/gitlab-shell /opt/git/repositories /opt/git/gitlab-shell/hooks/

10.

redis://192.168.1.100:6379

11.bundle exec rake gitlab:shell:install[v2.6.6] REDIS_URL=redis://192.168.1.100:6379

bundle exec rake gitlab:shell:install[v2.6.6] REDIS_URL=redis://192.168.1.100:6379 RAILS_ENV=production

bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=lansgg123

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
server {
        
listen      
8580
;
        
server_name _;
if 
($time_iso8601 ~ 
"^(d{4})-(d{2})-(d{2})T(d{2}):(d{2}):(d{2})"
)
{
set 
$year1 $
1
;
set 
$month1 $
2
;
set 
$day1 $
3
;
set 
$hour1 $
4
;
set 
$minutes1 $
5
;
set 
$seconds1 $
6
;
}
access_log  
/
opt
/
log
/
gitlab
-
$year
-
$month
-
$day.log;
error_log   
/
opt
/
log
/
gitlab
-
$year
-
$month
-
$day.error;
        
root        
/
opt
/
git
/
gitlab
/
public;
   
        
location 
/
        
{
            
try_files $uri $uri
/
index.html $uri.html @gitlab;
        
}
   
        
location 
/
uploads
/
        
{
            
proxy_read_timeout      
300
;
            
proxy_connect_timeout   
300
;
            
proxy_redirect          off;
            
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_set_header    X
-
Forwarded
-
Proto   $scheme;
            
proxy_set_header    X
-
Frame
-
Options     SAMEORIGIN;
            
proxy_pass http:
/
/
gitlab;
        
}
   
        
location @gitlab
        
{
            
proxy_read_timeout      
300
;
            
proxy_connect_timeout   
300
;
            
proxy_redirect          off;
            
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_set_header    X
-
Forwarded
-
Proto   $scheme;
            
proxy_set_header    X
-
Frame
-
Options     SAMEORIGIN;
            
proxy_pass http:
/
/
gitlab;
        
}
   
        
location ~ [
-
\
/
\w\.]
+
\.git\
/
        
{
            
proxy_read_timeout      
300
;
            
proxy_connect_timeout   
300
;
            
proxy_redirect          off;
            
proxy_buffering off;
            
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_set_header    X
-
Forwarded
-
Proto   $scheme;
            
proxy_pass http:
/
/
gitlab
-
git
-
http
-
server;
        
}
   
        
location ~ ^
/
(assets)
/
        
{
            
root 
/
opt
/
git
/
gitlab
/
public;
            
#gzip_static on;
            
expires 
max
;
            
add_header Cache
-
Control public;
        
}
   
        
error_page 
502 
/
502.html
;
    
}
1
gitlab新建文件报错Commit was rejected by pre
-
receive hook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/
home
/
git
/
gitlab
/
config
/
gitlab.yml
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 
172.18
.
84.17
 
port: 
80 
# Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: false 
# Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
[root@solr2 git]
# cat /home/git/gitlab-shell/config.yml
-
-
-
user: git
gitlab_url: http:
/
/
172.18
.
84.17
/
http_settings:
self_signed_cert: true
repos_path: 
"/home/git/repositories/"
auth_file: 
"/home/git/.ssh/authorized_keys"
redis:
bin
"/usr/bin/redis-cli"
namespace: resque:gitlab
socket: 
"/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

or https

1
2
3
4
5
6
7
8
9
10
11
12
user: git
gitlab_url: https:
/
/
172.18
.
84.17
/
http_settings:
self_signed_cert: true
repos_path: 
"/home/git/repositories/"
auth_file: 
"/home/git/.ssh/authorized_keys"
redis:
bin
"/usr/bin/redis-cli"
namespace: resque:gitlab
socket: 
"/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

cat /etc/profile

export JAVA_HOME=/usr/java/jdk

export JRE_HOME=/usr/java/jdk/jre

exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export PATH=/root/shell:$JAVA_HOME/bin:$PATH

export ANDROID_SDK_HOME=/usr/java/android-sdk-linux

export GRADLE_HOME=/usr/java/gradle-3.3

export MAVEN_HOME=/usr/java/apache-maven-3.3.9

export PATH=/usr/local/apr/bin:$MAVEN_HOME/bin:$PATH

export PATH=$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$GRADLE_HOME/bin:/usr/local/apr/bin:/usr/java/apache-maven-3.3.9/bin:/root/shell:/usr/java/jdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin

export MAVEN_OPTS="-Xms1024m -Xmx1024m"

本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1956912,如需转载请自行联系原作者

你可能感兴趣的文章
【CQOI2011】放棋子
查看>>
采用JXL包进行EXCEL数据写入操作
查看>>
一周总结
查看>>
将txt文件转化为json进行操作
查看>>
线性表4 - 数据结构和算法09
查看>>
C语言数据类型char
查看>>
Online Patching--EBS R12.2最大的改进
查看>>
Binary Search Tree Iterator leetcode
查看>>
Oracle性能优化--DBMS_PROFILER
查看>>
uva-317-找规律
查看>>
Event事件的兼容性(转)
查看>>
我的2014-相对奢侈的生活
查看>>
zoj 2412 dfs 求连通分量的个数
查看>>
Java设计模式
查看>>
一文读懂 AOP | 你想要的最全面 AOP 方法探讨
查看>>
ndk制作so库,ndk-build不是内部或外部命令。。。的错误
查看>>
Spring Cloud 微服务分布式链路跟踪 Sleuth 与 Zipkin
查看>>
ORM数据库框架 SQLite 常用数据库框架比较 MD
查看>>
BNU 34990 Justice String (hash+二分求LCP)
查看>>
华为OJ 名字美丽度
查看>>