基础环境搭建
基础环境需要依赖:ssh、firewalld、postfix(用于邮件通知)、wget。
基础服务存在可跳过。
ssh 服务
-
安装ssh
sudo yum install -y curl policycoreutils-pythonopenssh-server
出现 Complete! 表示安装完成
-
将 ssh 服务设置为开机启动
sudo systemctl enable sshd
-
启动 ssh 服务
sudo systemctl start sshd
firewalld 服务
-
安装防火墙
yum install firewalld systemd -y
-
开启防火墙
service firewalld start
-
添加 http 服务到 firewalld,pemmanent 表示永久生效,若不加 –permanent 系统下次启动后就会失效
sudo firewall-cmd --permanent --add-service=http
-
重启防火墙
sudo systemctl reload firewalld
postfix 服务
-
安装 postfix
sudo yum install postfix
-
将 postfix 服务设置为开机启动
sudo systemctl enable postfix
-
启动postfix
sudo systemctl start postfix
安装 wget
-
查看wget
wget -V
-
不存在,安装 wget
yum -y install wget
gitlab 搭建
-
下载 gitlab 镜像
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
-
安装 gitlab
rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
-
修改 gitlab 配置文件指定服务器 ip 和 自定义端口
vim /etc/gitlab/gitlab.rb
-
重置、启动 gitlab
gitlab-ctl reconfigure gitlab-ctl restart
-
访问 gitlab 页面
初始账户:root
初始密码:5IveL!fe
常用命令
常用 gitlab 命令 | 说明 |
---|---|
gitlab-ctl reconfigure | 重置配置信息 |
gitlab-ctl restart | 重启 gitlab 服务 |
gitlab-ctl status | 查看 gitlab 状态 |
gitlab-ctl stop | 停止 gitlab 服务 |
gitlab-ctl tail | 查看 gitlab 运行日志 |
gitlab-ctl stop unicorn | 停止 unicorn 服务 |