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,如需转载请自行联系原作者
目录
相关文章
|
Java Maven Docker
gitlab-ci 集成 k3s 部署spring boot 应用
gitlab-ci 集成 k3s 部署spring boot 应用
|
12月前
|
Ubuntu 安全 数据安全/隐私保护
在Docker容器中部署GitLab服务器的步骤(面向Ubuntu 16.04)
现在,你已经成功地在Docker上部署了GitLab。这就是我们在星际中的壮举,轻松如同土豆一样简单!星际旅行结束,靠岸,打开舱门,迎接全新的代码时代。Prepare to code, astronaut!
704 12
|
Linux 编译器 开发工具
提升CentOS 7中的gcc/G++版本
至此,你已经成功在CentOS 7中升级了gcc/G++版本。从现在开始,在终端中运行 `gcc`或 `g++`时,将会使用新版本的编译器。
1706 21
|
Linux 应用服务中间件 nginx
在CentOS上部署Minikube教程
至此,您已成功在CentOS上部署并使用Minikube。您可以自由探索Kubernetes的世界,熟练配置和管理Kubernetes集群。
1082 20
|
Linux 编译器 测试技术
【C++】CentOS环境搭建-快速升级G++版本
通过上述任一方法,您都可以在CentOS环境中高效地升级G++至所需的最新版本,进而利用C++的新特性,提升开发效率和代码质量。
914 64
|
Linux 编译器 测试技术
【C++】CentOS环境搭建-快速升级G++版本
通过上述任一方法,您都可以在CentOS环境中高效地升级G++至所需的最新版本,进而利用C++的新特性,提升开发效率和代码质量。
1058 63
|
Kubernetes 持续交付 数据库
阿里云ACK+GitLab企业级部署实战教程
GitLab 是一个功能强大的基于 Web 的 DevOps 生命周期平台,整合了源代码管理、持续集成/持续部署(CI/CD)、项目管理等多种工具。其一体化设计使得开发团队能够在同一平台上进行代码协作、自动化构建与部署及全面的项目监控,极大提升了开发效率和项目透明度。 GitLab 的优势在于其作为一体化平台减少了工具切换,高度可定制以满足不同项目需求,并拥有活跃的开源社区和企业级功能,如高级权限管理和专业的技术支持。借助这些优势,GitLab 成为许多开发团队首选的 DevOps 工具,实现从代码编写到生产部署的全流程自动化和优化。
|
运维 监控 安全
CentOS 7系统 OpenSSH和OpenSSL版本升级指南
本文详细介绍如何在CentOS 7系统上升级OpenSSH和OpenSSL至最新稳定版本(OpenSSH 9.6p1和OpenSSL 1.1.1w),解决多个已知安全漏洞(如CVE-2023-51767等)。涵盖环境说明、现存漏洞、升级准备、具体步骤及故障排查,确保服务器安全。建议先在测试环境验证,再应用于生产环境。
5417 7
|
Oracle 关系型数据库 MySQL
Centos7下图形化部署单点KFS同步工具并将Oracle增量同步到KES
Centos7下图形化部署单点KFS同步工具并将Oracle增量同步到KES
Centos7下图形化部署单点KFS同步工具并将Oracle增量同步到KES
|
运维 Linux 开发工具
第22篇 如何部署gitLab进行开发版本控制
第22篇 如何部署gitLab进行开发版本控制