在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问。
centos7安装gitlab:
第一步:安装SSH
sudo yum install -y curl policycoreutils-pythonopenssh-server
第二步:将SSH服务设置成开机自启动,安装命令:sudo systemctl enable sshd
第三步 :启动SSH服务,安装命令:sudo systemctl start sshd
第四步:安装防火墙(如果已经安装了防火墙并且已经在运行状态,则可直接进行第6步)
yum install firewalld systemd -y
第五步 :开启防火墙,安装命令:service firewalld start
Dependency Updated:
cryptsetup-libs.x86_64 0:2.0.3-3.el7
firewalld-filesystem.noarch 0:0.5.3-5.el7
python-firewall.noarch 0:0.5.3-5.el7
systemd-libs.x86_64 0:219-62.el7_6.5
systemd-sysv.x86_64 0:219-62.el7_6.5
Complete!
第六步:添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。
sudo firewall-cmd --permanent --add-service=http
[root@localhost java]# sudo firewall-cmd --permanent --add-service=http
success
第七 步 :重启防火墙,安装命令:sudo systemctl reload firewalld
第八 步 :接下来,安装Postfix以发送通知邮件,安装命令:sudo yum install postfix
第九 步 :将postfix服务设置成开机自启动,安装命令:sudo systemctl enable postfix
第10 步 :启动postfix,安装命令:sudo systemctl start postfix
第11步 :wget 用于从外网上下载插件
检查系统中是否已经安装wget,使用命令若出现下图wget相关版本描述则说明系统中已经安装wget 若报系统找不到命令说明wget未安装
若wget未安装则进行安装,安装命令:yum -y install wget
第12步 .安装vim编辑器 安装命令:yum install vim -y
二、添加GitLab镜像源并安装gitlab服务器
1.添加gitlab镜像
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
2.安装gitlab 安装命令:rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
错误异常:
gitlab-ce-10.*.* 提示 error: Failed dependencies:
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64
安装gitlab的依赖项
yum install policycoreutils-python
重新执行以上步骤
安装过程需要些时间,如果出现下图,则说明安装成功。
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key 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
4.修改gitlab配置文件指定服务器ip和自定义端口:
vim /etc/gitlab/gitlab.rb
9 ## GitLab URL
10 ##! URL on which GitLab will be reachable.
11 ##! For more details on configuring external_url see:
12 ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
13 external_url 'http://192.168.0.208:9000'
5.重置并启动GitLab
gitlab-ctl reconfigure
gitlab-ctl restart
提示 "ok: run:"表示启动成功
6.访问 GitLab页面
网友评论