Centos7下部署本地的gitlab(CE版本)

简介:

1)操作步骤(基本参照官方文档https://about.gitlab.com/downloads/#centos7)

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
71
72
73
74
75
76
77
[root@localhost ~] # sudo yum install curl policycoreutils openssh-server openssh-client
s -y
[root@localhost ~] # sudo systemctl enable sshd
[root@localhost ~] # sudo systemctl start sshd
[root@localhost ~] # sudo yum install postfix
[root@localhost ~] # sudo systemctl enable postfix
[root@localhost ~] # sudo systemctl start postfix
[root@localhost ~] # sudo firewall-cmd --permanent --add-service=http
success
[root@localhost ~] # sudo systemctl reload firewalld
[root@localhost ~] # curl -sS https://packages.gitlab.com/install/repositories/gitlab/gi
tlab-ce /script .rpm.sh |  sudo  bash
[root@localhost ~] # sudo yum install gitlab-ce  
[root@localhost ~] # gitlab-ctl status
run: gitlab-workhorse: (pid 15903) 159s; run: log: (pid 15726) 198s
run: logrotate: (pid 15822) 186s; run: log: (pid 15821) 186s
run: nginx: (pid 15774) 192s; run: log: (pid 15773) 192s
run: postgresql: (pid 15435) 327s; run: log: (pid 15434) 327s
run: redis: (pid 15298) 339s; run: log: (pid 15297) 339s
run: sidekiq: (pid 15681) 204s; run: log: (pid 15680) 204s
run: unicorn: (pid 15625) 210s; run: log: (pid 15624) 210s
[root@localhost ~] # gitlab-ctl --help
Usage: omnibus-ctl [options]
     -t, --tmp- dir =DIR                Storage location  for  temporary data
[root@localhost ~] # gitlab-ctl restart
ok: run: gitlab-workhorse: (pid 16146) 0s
ok: run: logrotate: (pid 16156) 0s
ok: run: nginx: (pid 16162) 1s
ok: run: postgresql: (pid 16173) 0s
ok: run: redis: (pid 16175) 1s
ok: run: sidekiq: (pid 16187) 0s
ok: run: unicorn: (pid 16193) 0s
[root@localhost ~] # gitlab-ctl tail nginx
==>  /var/log/gitlab/nginx/current  <==
==>  /var/log/gitlab/nginx/error .log <==
==>  /var/log/gitlab/nginx/gitlab_access .log <==
ri /537 .36"
.2743.116 Safari /537 .36"
ppleWebKit /537 .36 (KHTML, like Gecko) Chrome /52 .0.2743.116 Safari /537 .36"
537.36"
37.36"
.0; WOW64) AppleWebKit /537 .36 (KHTML, like Gecko) Chrome /52 .0.2743.116 Safari /537 .36"
  like Gecko) Chrome /52 .0.2743.116 Safari /537 .36"
, like Gecko) Chrome /52 .0.2743.116 Safari /537 .36"
"
==>  /var/log/gitlab/nginx/gitlab_error .log <==
==>  /var/log/gitlab/nginx/access .log <==
5: in  ` tail ': Interrupt
s-ctl.rb:575: in  `run'
s-ctl:31: in  `< top  (required)>'
from  /opt/gitlab/embedded/bin/omnibus-ctl :22: in  `load'
from  /opt/gitlab/embedded/bin/omnibus-ctl :22: in  `<main>'
[root@localhost ~] # cd /opt
[root@localhost opt] # ls
gitlab  rh
[root@localhost opt] # cd gitlab/
[root@localhost gitlab] # ls
bin       etc   LICENSE   service  var                    version-manifest.txt
embedded  init  LICENSES  sv       version-manifest.json
[root@localhost gitlab] # cd etc/
[root@localhost etc] # ll
总用量 52
-rw-r--r--. 1 root root    80 11月 28 13:42 gitlab-psql-rc
drwx------. 3 git  root    38 11月 28 13:40 gitlab-rails
-rw-r--r--. 1 root root 47471 11月 23 02:51 gitlab.rb.template
drwx------. 3 git  root    16 11月 28 13:44 gitlab-workhorse
[root@localhost etc] # cp gitlab.rb.template gitlab.rb.template.20161128
部署完后,查看gitlab的状态:
[root@localhost code] # gitlab-ctl status
run: gitlab-workhorse: (pid 845) 20880s; run: log: (pid 843) 20880s
run: logrotate: (pid 28207) 2879s; run: log: (pid 849) 20880s
run: nginx: (pid 847) 20880s; run: log: (pid 846) 20880s
run: postgresql: (pid 854) 20880s; run: log: (pid 853) 20880s
run: redis: (pid 852) 20880s; run: log: (pid 851) 20880s
run: sidekiq: (pid 856) 20880s; run: log: (pid 855) 20880s
run: unicorn: (pid 842) 20880s; run: log: (pid 841) 20880s
如上我们可以看到,部署涉及到的软件比较多,建议用一个比较干净的系统来进行部署

2) 查看初始化界面

wKioL1g9OseRlnWSAADgfPzDUW8065.png-wh_50

如上图所示,我们需要配置我们的初始密码

wKiom1g9OseS-KfAAAD22ZfxDUs623.png-wh_50

配置完后,我们使用用户名root,以及已经设定的密码进行登录

3)在gitlab中添加公开密钥,这样就可以用私有密钥进行认证了

1
2
3
4
5
6
7
8
[root@localhost code] # ssh-keygen -t rsa
Generating public /private  rsa key pair.
Enter  file  in  which  to save the key ( /root/ . ssh /id_rsa ): 
/root/ . ssh /id_rsa  already exists.
Overwrite (y /n )? 
[root@localhost code] # cd /root/.ssh/
[root@localhost . ssh ] # cat id_rsa.pub 
ssh -rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgA /RQdMLqmR3TxZdoMJoSr0fZYZaynK0ueaN0fRzEPn87AH7qV6X3dCc18BCxOtsD +o8qfdp8zVYfYbxdL+P1r53Qq278BLXov+ATWCl++Ly62oLYuGTZAAdm /cBYGTTxyqLp83wLutvbmsf3vlD3owbmZyfV/UEjon +j /T6ZVMC2JYcYHDu17HwlsXHZpOpm3g1FimmzMlaf12Hd76bPfC1blE6gcEKMJVJ6qTzK4ksL2DwqaaLpTnw/hLBA0QGM4 +s74Q5WoyTSVMqoz+1H3NaXJYquRm5xFf+fZX8sg7SkYJX /7AfkxvuwzYPW +pPzpNtW1KikUgq9aq+rgMt/ root@localhost.localdomain

wKioL1g9PCaysrhDAACknW21YFg025.png-wh_50

将id_ras.pub的内容拷贝到指定的区域,并做好保存:

1
2
3
4
5
6
7
8
9
10
为git配置好颜色:
[root@localhost code] # git config --global color.ui true
[root@localhost code] # git config --list
user.name=Administrator
user.email=admin@example.com
color.ui= true
core.repositoryformatversion=0
core.filemode= true
core.bare= false
core.logallrefupdates= true

wKioL1g9PurAru6yAABbTAjm8Xo172.png-wh_50

wKioL1g9PuvzZHc1AAD_vFGGevg140.png-wh_50

wKioL1g9PuzzYh4HAADW4SKN_EM018.png-wh_50

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
[root@localhost code] # git clone git@localhost:root/cslc.git
Cloning into  'cslc' ...
warning: You appear to have cloned an empty repository.
[root@localhost code] # ls
cslc  freemind-mmx
[root@localhost code] # cd cslc
[root@localhost cslc] # cp /etc/passwd .
[root@localhost cslc] # git add passwd
[root@localhost cslc] # git commit -m "add passwd"
[master (root-commit) 8c26f36] add  passwd
  file  changed, 43 insertions(+)
  create mode 100644  passwd
[root@localhost cslc] # ll -la
total 8
drwxr-xr-x. 3 root root   30 Nov 29 16:41 .
drwxr-xr-x. 5 root root   47 Nov 29 16:40 ..
drwxr-xr-x. 8 root root 4096 Nov 29 16:41 .git
-rw-r--r--. 1 root root 2213 Nov 29 16:41  passwd
[root@localhost cslc] # git push -u origin master
Counting objects: 3,  done .
Delta compression using up to 4 threads.
Compressing objects: 100% (2 /2 ),  done .
Writing objects: 100% (3 /3 ), 1.04 KiB | 0 bytes /s done .
Total 3 (delta 0), reused 0 (delta 0)
To git@localhost:root /cslc .git
  * [new branch]      master -> master
Branch master  set  up to track remote branch master from origin.

wKioL1g9QGGy26mCAADnZlLhUl0833.png-wh_50

4)添加一个README

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@localhost cslc] # echo "欢迎来到中体彩武汉的gitlab站">>README.MD
[root@localhost cslc] # ls
README.md   passwd
[root@localhost cslc] # git add README.md
[root@localhost cslc] # git commit -m "add README"
[master fbe1bfb] add README
  file  changed, 1 insertion(+)
  create mode 100644 README.md
[root@localhost cslc] # git push -u origin master
Counting objects: 4,  done .
Delta compression using up to 4 threads.
Compressing objects: 100% (2 /2 ),  done .
Writing objects: 100% (3 /3 ), 320 bytes | 0 bytes /s done .
Total 3 (delta 0), reused 0 (delta 0)
To git@localhost:root /cslc .git
    8c26f36..fbe1bfb  master -> master
Branch master  set  up to track remote branch master from origin.

wKiom1g9QgSQ3BkIAABtxKzZWRM402.png-wh_50

到此,gitlab的本地安装基本也就完成了










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1877804,如需转载请自行联系原作者
目录
相关文章
|
8月前
|
Linux
百度搜索:蓝易云【如何在CentOS7上搭建自己的GitLab仓库详解?】
现在,您已经成功在CentOS 7上搭建了自己的GitLab仓库。通过GitLab,您可以托管和管理您的代码,并与团队成员协同开发。
271 0
|
25天前
|
Linux 数据安全/隐私保护 Docker
源码管理新征程:CentOS 7上GitLab安装全程解析
源码管理新征程:CentOS 7上GitLab安装全程解析
34 0
源码管理新征程:CentOS 7上GitLab安装全程解析
|
4月前
|
存储 安全 Linux
百度搜索:蓝易云【CentOS7环境:安装配置gitlab(适用于内网、外网环境)】
这些是在CentOS 7环境下安装和配置GitLab的基本步骤。根据您的需求和具体环境,可能还需要进行其他配置和调整。请确保在进行任何与网络连接和安全相关的操作之前,详细了解您的网络环境和安全需求,并采取适当的安全措施。
60 0
|
5月前
|
存储 Linux 网络安全
Git - Centos7下安装GitLab服务器
Git - Centos7下安装GitLab服务器
101 1
|
7月前
|
Linux 应用服务中间件 网络安全
Linux(centos 7.5)服务器安装Gitlab
Linux(centos 7.5)服务器安装Gitlab
102 0
|
8月前
|
Linux Shell 网络安全
CentOS7上使用GitLab搭建私有git代码仓库(超详细)(下)
CentOS7上使用GitLab搭建私有git代码仓库(超详细)(下)
130 1
|
8月前
|
Linux 网络安全 开发工具
CentOS7上使用GitLab搭建私有git代码仓库(超详细)(上)
CentOS7上使用GitLab搭建私有git代码仓库(超详细)(上)
290 0
|
8月前
|
关系型数据库 Linux 开发工具
百度搜索:蓝易云【CentOS7系统GitLab安装部署教程。】
GitLab是一个基于Git的版本管理系统,可以提供代码仓库、代码审核、问题跟踪等功能。
90 0
|
网络协议 Linux Shell
CentOS 7 下 GitLab安装部署教程
GitLab一个开源的git仓库管理平台,方便团队协作开发、管理。在GitLab上可以实现完整的CI(持续集成)、CD(持续发布)流程。而且还提供了免费使用的Plan,以及免费的可以独立部署的社区版本
2979 0
|
缓存 Linux 应用服务中间件
CentOS 7手把手教你搭建GitLab(二)
CentOS 7手把手教你搭建GitLab
397 0
 CentOS 7手把手教你搭建GitLab(二)