您的位置 首页 centos

CentOS7如何搭建Gitlab服务器

下面由centos系统入门教程栏目给大家介绍CentOS7搭建Gitlab服务器的方法,希望对需要的朋友有所帮助!

CentOS7搭建Gitlab服务器

CentOS安装必要的依赖

第一步:安装ssh

yum install -y curl policycoreutils-pythonopenssh-server

企业微信截图_15922857951910.png

企业微信截图_15922858027086.png

第二步: 将SSH服务设置成开机自启动并启动SSH服务(若安装并启动,则可跳过此步);

sudo systemctl enable sshdsudo systemctl start sshd

第三步:安装并启动防火墙(若安装并启动,则可跳过此步);

yum install firewalld systemd -yservice firewalld start

第四步:添加http服务到firewalld (–permanent表示永久生效);

firewall-cmd --permanent --add-service=http

企业微信截图_15922858094194.png

第五步:重启防火墙;

systemctl reload firewalld

第六步:将postfix服务设置成开机自启动并启动postfix;

systemctl enable postfixsystemctl start postfix

第七步:检查系统中是否已经安装wget(若不存在,用yum安装wget);

wget -V --检查wget版本yum -y install wget --yum安装wget

CentOS安装必要的依赖

第一步:wget下载gitlab(社区版);

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm

企业微信截图_15922858155766.png

第二步:安装gitlab;

rpm -i gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm

若出现下面错误,需要安装 policycoreutils-python;

企业微信截图_1592285821678.png

yum -y install policycoreutils-python

企业微信截图_15922858274791.png

企业微信截图_1592285833622.png

第三步:修改gitlab配置文件,指定服务器ip和自定义端口;

vi /etc/gitlab/gitlab.rb

修改URL:external_url 'http://192.168.2.121:8081'

企业微信截图_15922858405191.png

修改端口:nginx['listen_port'] = 8081

企业微信截图_15922858472087.png

要修改unicorn的配置

企业微信截图_1592285853425.png

第四步:重置并启动GitLab;

重置配置:gitlab-ctl reconfigure

企业微信截图_15922858594255.png

重启gitlab服务:gitlab-ctl restart

企业微信截图_15922858652928.png

第五步:访问Gitlab,初次登录,修改密码;

初始用户:root

初始密码:5iveL!fe

企业微信截图_15922858716367.png

若无法访问,则可以查看端口是否被禁用;

查看端口状态:netstat -lntp;若netstat命令不存在,安装yum install net-tools -y,因为CentOS7 不包含net-tools,因此ifconfig命令也不可用,安装net-tools后即可使用netstat、ifconfig命令;

防火墙开放端口:

firewall-cmd --zone=public --add-port=8081/tcp --permanent

重新加载防火墙列表:

firewall-cmd --reload

文章来源:智云一二三科技

文章标题:CentOS7如何搭建Gitlab服务器

文章地址:https://www.zhihuclub.com/10237.shtml

关于作者: 智云科技

热门文章

网站地图