[CentOS-Gitlab]CentOS-7搭建Gitlab服务器

本文演示CentOS_7.x_64系统搭建Gitlab服务器(社区版)
本文属于个人技术分享,若有错误或遗漏,请联系并在做更改。

CentOS-7搭建Gitlab服务器

CentOS安装必要的依赖

第一步:安装ssh

yum install -y curl policycoreutils-pythonopenssh-server

image.png
image.png

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

sudo systemctl enable sshd
sudo systemctl start sshd

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

yum install firewalld systemd -y
service firewalld start

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

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

image.png

第五步:重启防火墙;

systemctl reload firewalld

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

systemctl enable postfix
systemctl 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

image.png

第二步:安装gitlab;

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

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

image.png

yum -y install policycoreutils-python
image.png

image.png

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

vi /etc/gitlab/gitlab.rb

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

image.png

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

image.png

要修改unicorn的配置

image.png

第四步:重置并启动GitLab;

重置配置:gitlab-ctl reconfigure

image.png

重启gitlab服务:gitlab-ctl restart

image.png

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

初始用户:root
初始密码:5iveL!fe

image.png

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

  1. 查看端口状态:netstat -lntp;若netstat命令不存在,安装yum install net-tools -y,因为CentOS7 不包含net-tools,因此ifconfig命令也不可用,安装net-tools后即可使用netstat、ifconfig命令;
  2. 防火墙开放端口:
    firewall-cmd --zone=public --add-port=8081/tcp --permanent
  3. 重新加载防火墙列表:
    firewall-cmd --reload

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 准备环境 在正式开始安装之前,先更新软件包并打开相关服务的权限。 更新软件包 yum update -y 安装 s...
    uustop阅读 3,021评论 0 2
  • 1.背景 在当今互联网形势下,软件开发过程中,开发部署的频率会非常高,传统的本地打包-上传覆盖-重启的方式会导致开...
    Luomeng阅读 11,070评论 3 29
  • 1. 安装配置依赖项 如想使用Postfix来发送邮件,在安装期间请选择’Internet Site’. 您也可以...
    程序猿GG阅读 5,367评论 0 0
  • 1、安装依赖软件执行命令:yum -y install policycoreutils openssh-serve...
    SEL_fish阅读 3,966评论 0 1
  • 会利分享第439天 《千里马》 小灰驴和小黑马同一天出生,又在同一天拜千里马为师,练习长跑。 练了好多天,小灰驴和...
    王会利阅读 1,352评论 0 0