赞
踩
yum -y install policycoreutils openssh-server openssh-clients postfix
如:
[root@localhost ~]# yum -y install policycoreutils openssh-server openssh-clients postfix
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
软件包 policycoreutils-2.5-34.el7.x86_64 已安装并且是最新版本
软件包 openssh-server-7.4p1-21.el7.x86_64 已安装并且是最新版本
软件包 openssh-clients-7.4p1-21.el7.x86_64 已安装并且是最新版本
软件包 2:postfix-2.10.1-9.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost ~]#
systemctl enable postfix
systemctl start postfix
如:
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# systemctl start postfix
[root@localhost ~]#
从 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ 找一个比较新的版本,右键拷贝链接地址,然后使用wget下载
如:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.2.5-ce.0.el7.x86_64.rpm --no-check-certificate
rpm -i gitlab-ce-14.2.5-ce.0.el7.x86_64.rpm
如
[root@localhost opt]# rpm -i gitlab-ce-14.2.5-ce.0.el7.x86_64.rpm
警告:gitlab-ce-14.2.5-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
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 readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-2
[root@localhost opt]#
vi /etc/gitlab/gitlab.rb
如下,将external_url 设置为具体的ip加端口号:
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://192.168.1.210:8080'
firewall-cmd --list-all
如下,表示当前没有端口放开
[root@localhost opt]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost opt]#
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
如:
[root@localhost opt]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost opt]# firewall-cmd --reload
success
[root@localhost opt]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports: 8080/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost opt]#
gitlab-ctl reconfigure # 此命令可能需要执行几分钟,耐心等待
gitlab-ctl restart
如果执行gitlab-ctl reconfigure 报如下错误,
Running handlers:
There was an error running gitlab-ctl reconfigure:
ruby_block[authorize Grafana with GitLab] (monitoring::grafana line 101) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 600s:
Command exceeded allowed execution time, process terminated
---- Begin output of /opt/gitlab/bin/gitlab-rails runner -e production 'app = Doorkeeper::Application.where(redirect_uri: "http://192.168.1.210:8080/-/grafana/login/gitlab", name: "GitLab Grafana").first_or_create;puts app.uid.concat(" ").concat(app.secret);' ----
STDOUT:
STDERR:
---- End output of /opt/gitlab/bin/gitlab-rails runner -e production 'app = Doorkeeper::Application.where(redirect_uri: "http://192.168.1.210:8080/-/grafana/login/gitlab", name: "GitLab Grafana").first_or_create;puts app.uid.concat(" ").concat(app.secret);' ----
Ran /opt/gitlab/bin/gitlab-rails runner -e production 'app = Doorkeeper::Application.where(redirect_uri: "http://192.168.1.210:8080/-/grafana/login/gitlab", name: "GitLab Grafana").first_or_create;puts app.uid.concat(" ").concat(app.secret);' returned
一般来说是内存不够,可以将虚拟机内存设置为4G,然后依次执行如下命令:
gitlab-ctl stop
chmod 755 /var/opt/gitlab/postgresql
systemctl restart gitlab-runsvdir
gitlab-ctl reconfigure
如果出现502 Whoops, GitLab is taking too much time to respond. 的错误,则首先检查一下端口是否被占用,如下,表示8080被占用了
[root@localhost ~]# netstat -tunlp |grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4378/nginx: master
在修改端口之前,首先检查一下新的端口是否被占用,如下,表示8181未被占用
[root@localhost ~]# netstat -tunlp |grep 8181
[root@localhost ~]#
则将端口修改为8181
vi /etc/gitlab/gitlab.rb
如下,external_url 中端口修改为8181
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://192.168.1.210:8181'
然后执行
gitlab-ctl reconfigure # 此命令可能需要执行几分钟,耐心等待
gitlab-ctl restart
并注意将防火墙开放新的端口号
firewall-cmd --zone=public --add-port=8181/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all
如:
[root@localhost ~]# firewall-cmd --zone=public --add-port=8181/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports: 8080/tcp 8181/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]#
此时在浏览器中打开 http://192.168.1.210:8181/ ,即OK了
cat /etc/gitlab/initial_root_password
如下:密码为:x+WKarjgzbQEU9vJ2a5c0UfeUc8X/0RtxwLUraO786g=
[root@localhost ~]# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: x+WKarjgzbQEU9vJ2a5c0UfeUc8X/0RtxwLUraO786g=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
[root@localhost ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。