1.安装SSH协议
#安装SSH协议
[root@cdh03 tools]# sudo yum install -y curl policycoreutils-python openssh-server
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
cloudera-manager | 2.9 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/6): epel/x86_64/group_gz | 96 kB 00:00:00
(2/6): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/6): extras/7/x86_64/primary_db | 247 kB 00:00:00
(4/6): epel/x86_64/primary_db | 7.0 MB 00:00:00
(5/6): updates/7/x86_64/primary_db | 16 MB 00:00:00
(6/6): docker-ce-stable/7/x86_64/primary_db | 78 kB 00:00:00
Package curl-7.29.0-59.el7_9.1.x86_64 already installed and latest version
Package policycoreutils-python-2.5-34.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package openssh-server.x86_64 0:7.4p1-21.el7 will be updated
---> Package openssh-server.x86_64 0:7.4p1-22.el7_9 will be an update
--> Processing Dependency: openssh = 7.4p1-22.el7_9 for package: openssh-server-7.4p1-22.el7_9.x86_64
--> Running transaction check
---> Package openssh.x86_64 0:7.4p1-21.el7 will be updated
--> Processing Dependency: openssh = 7.4p1-21.el7 for package: openssh-clients-7.4p1-21.el7.x86_64
---> Package openssh.x86_64 0:7.4p1-22.el7_9 will be an update
--> Running transaction check
---> Package openssh-clients.x86_64 0:7.4p1-21.el7 will be updated
---> Package openssh-clients.x86_64 0:7.4p1-22.el7_9 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Updating:
openssh-server x86_64 7.4p1-22.el7_9 updates 459 k
Updating for dependencies:
openssh x86_64 7.4p1-22.el7_9 updates 510 k
openssh-clients x86_64 7.4p1-22.el7_9 updates 655 k
Transaction Summary
==============================================================================================================================================================
Upgrade 1 Package (+2 Dependent packages)
Total download size: 1.6 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): openssh-7.4p1-22.el7_9.x86_64.rpm | 510 kB 00:00:00
(2/3): openssh-clients-7.4p1-22.el7_9.x86_64.rpm | 655 kB 00:00:00
(3/3): openssh-server-7.4p1-22.el7_9.x86_64.rpm | 459 kB 00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 10 MB/s | 1.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : openssh-7.4p1-22.el7_9.x86_64 1/6
Updating : openssh-server-7.4p1-22.el7_9.x86_64 2/6
Updating : openssh-clients-7.4p1-22.el7_9.x86_64 3/6
Cleanup : openssh-clients-7.4p1-21.el7.x86_64 4/6
Cleanup : openssh-server-7.4p1-21.el7.x86_64 5/6
Cleanup : openssh-7.4p1-21.el7.x86_64 6/6
Verifying : openssh-server-7.4p1-22.el7_9.x86_64 1/6
Verifying : openssh-clients-7.4p1-22.el7_9.x86_64 2/6
Verifying : openssh-7.4p1-22.el7_9.x86_64 3/6
Verifying : openssh-clients-7.4p1-21.el7.x86_64 4/6
Verifying : openssh-7.4p1-21.el7.x86_64 5/6
Verifying : openssh-server-7.4p1-21.el7.x86_64 6/6
Updated:
openssh-server.x86_64 0:7.4p1-22.el7_9
Dependency Updated:
openssh.x86_64 0:7.4p1-22.el7_9 openssh-clients.x86_64 0:7.4p1-22.el7_9
Complete!
2. 设置SSH服务
#设置SSH服务开机自启动
[root@cdh03 tools]# sudo systemctl enable sshd
You have mail in /var/spool/mail/root
#启动SSH服务
[root@cdh03 tools]# sudo systemctl start sshd
3. 添加GitLab软件包存储库
#添加GitLab软件包存储库
[root@cdh03 tools]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6928 100 6928 0 0 3257 0 0:00:02 0:00:02 --:--:-- 3257
Detected operating system as centos/7.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/config_file.repo?os=centos&dist=7&source=script
done.
Installing pygpgme to verify GPG signatures...
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
gitlab_gitlab-ee-source/signature | 862 B 00:00:00
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
Importing GPG key 0x51312F3F:
Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
Fingerprint: f640 3f65 44a3 8863 daa0 b6e0 3f01 618a 5131 2f3f
From : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
Retrieving key from https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey/gitlab-gitlab-ee-3D645A26AB9FBD22.pub.gpg
gitlab_gitlab-ee-source/signature | 951 B 00:00:01 !!!
gitlab_gitlab-ee-source/primary | 175 B 00:00:03
Package pygpgme-0.3-9.el7.x86_64 already installed and latest version
Nothing to do
Installing yum-utils...
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
Generating yum cache for gitlab_gitlab-ee...
Importing GPG key 0x51312F3F:
Userid : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
Fingerprint: f640 3f65 44a3 8863 daa0 b6e0 3f01 618a 5131 2f3f
From : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
Generating yum cache for gitlab_gitlab-ee-source...
The repository is setup! You can now install packages.
You have mail in /var/spool/mail/root
4. 下载安装包并安装
#下载安装包
[root@cdh03 tools]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm--no-check-certificate
--2022-06-06 14:15:33-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm--no-check-certificate
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... connected.
ERROR: cannot verify mirrors.tuna.tsinghua.edu.cn's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
To connect to mirrors.tuna.tsinghua.edu.cn insecurely, use `--no-check-certificate'.
[root@cdh03 tools]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm --no-check-certificate
--2022-06-06 14:16:10-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... connected.
WARNING: cannot verify mirrors.tuna.tsinghua.edu.cn's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 696213194 (664M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm’
100%[====================================================================================================================>] 696,213,194 2.20MB/s in 4m 28s
2022-06-06 14:20:38 (2.48 MB/s) - ‘gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm’ saved [696213194/696213194]
You have mail in /var/spool/mail/root
#查看文件
[root@cdh03 tools]# ls
gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
You have mail in /var/spool/mail/root
#安装gitlab
[root@cdh03 tools]# rpm -ivh gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm
warning: gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-12.3.5-ce.0.el7 ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab re
5. 修改配置,重置gitlab
#修改配置
[root@cdh03 gitlab]# vim /etc/gitlab/gitlab.rb
You have mail in /var/spool/mail/root
EXTERNAL_URL="https://gitlab.example.com" (将这里改为你的ip和端口号)
#查看端口号,阿里云安全组开启端口号(见截图)
[root@cdh03 gitlab]# netstat -anp |grep 9090
#重置gitlab
[root@cdh03 gitlab]# gitlab-ctl reconfigure
Starting Chef Client, version 14.13.11
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
- gitlab (0.0.1)
- package (0.1.0)
- postgresql (0.1.0)
6. 启动gitlab
#启动gitlab
[root@cdh03 gitlab]# gitlab-ctl restart
ok: run: alertmanager: (pid 20494) 0s
ok: run: gitaly: (pid 20515) 0s
ok: run: gitlab-exporter: (pid 20533) 1s
ok: run: gitlab-workhorse: (pid 20542) 0s
ok: run: grafana: (pid 20562) 1s
ok: run: logrotate: (pid 20574) 0s
ok: run: nginx: (pid 20588) 1s
ok: run: node-exporter: (pid 20634) 0s
ok: run: postgres-exporter: (pid 20684) 0s
ok: run: postgresql: (pid 20733) 0s
ok: run: prometheus: (pid 20749) 0s
ok: run: redis: (pid 20758) 0s
ok: run: redis-exporter: (pid 20774) 1s
ok: run: sidekiq: (pid 20809) 0s
ok: run: unicorn: (pid 20838) 0s
You have mail in /var/spool/mail/root
7、访问Gitlab页面
报错
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.3.5-ce.0.el6.x86_64.rpm
连接到 mirrors.tuna.tsinghua.edu.cn 不安全,使用“不检查证书”,即在 wget 后加入no-check-certificate 即可解决。
例如:wget https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.8.1/kafka_2.12-2.8.1.tgz --no-check-certificate
完成之后如果你想要直接访问是比较慢的,因为有防火墙,所以你需要去关闭防火墙
比较慢的情况示例:
参考文档:
https://blog.csdn.net/weixin_43987277/article/details/113725604
https://blog.csdn.net/weixin_39530695/article/details/102763137
https://www.it610.com/article/1502864431678291968.htm
以上