公司前端大佬由于某些缘由离职了,走的比较匆忙,本身以前一直不多接触这方面的东西,一直都是只知其一;不知其二。这两天我一边学,一边动手搭建,同时记录整个搭建过程。html
这是一系列文章,从搭建 Gitlab 到 安装、注册Gitlab-runner 再到两者结合去部署一个简单的项目,经过这几篇文章,你将学会如何在 Gitlab 上自动化打包部署本身的项目。前端
系列文章一共有四篇,包括:python
因为本身一直作的是前端,对于Linux我不算熟练,若有错误的地方,请你们指出。git
原文地址:阿里云安装Gitlab笔记github
访问 Gitlab安装地址,选择对应系统的安装方式,个人是 CentOS 7.6 故选择 CentOS 7.X 的安装方式。安全
lsb_release -a
复制代码
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
复制代码
在执行 sudo firewall-cmd --permanent --add-service=http
时可能会遇到 FirewallD is not running
错误提示,意思是未运行防火墙
。 使用如下命令开启防火墙便可:bash
systemctl start firewalld.service
复制代码
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
复制代码
这一步可能会遇到一个报错 Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.
解决方法是修改 /etc/postfix/main.cf
的配置,使用:服务器
vi /etc/postfix/main.cf
复制代码
进入编辑 'main.cf',按 I
进入修改:ssh
inet_interfaces = all
inet_protocols = ipv4 // 或 all
复制代码
修改完成后 依次按 Esc
、:
、w
、q
,回车保存修改,以后重启服务。curl
sudo systemctl restart postfix
复制代码
# 开启 8888 端口
firewall-cmd --zone=public --add-port=8888/tcp --permanent
# 重启防火墙
systemctl restart firewalld
复制代码
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
复制代码
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
复制代码
将https://gitlab.example.com更改成您要访问GitLab实例的URL。 安装将自动配置并启动该URL的GitLab。
我这里没有域名就直接使用 IP + 端口号的形式:
sudo EXTERNAL_URL="xx.xx.xxx.xx:8888" yum install -y gitlab-ee
复制代码
而后等待安装
若是安装完以后要修改访问的域名或者 IP,则需修改 /etc/gitlab/gitlab.rb
文件中的 external_url
一项,修改方法与上面修改 /etc/postfix/main.cf
的同样。
以后从新配置服务
gitlab-ctl reconfigure
复制代码
通过上面,的安装与设置,就能够访问域名或者IP了。
打开xx.xx.xxx.xx:8888,须要设置root账号
的密码,以后便可使用root账号登陆。
这里忘记截图了,就附上用户设置的一张截图吧
Gitlab经常使用命令:
//启动
sudo gitlab-ctl start
//中止
sudo gitlab-ctl stop
//重启
sudo gitlab-ctl restart
//查看状态
sudo gitlab-ctl status
//使更改配置生效
sudo gitlab-ctl reconfigure
复制代码
GitLab Installation
阿里云 GitLab 折腾笔记
CentOS下yum命令出现Loaded plugins: fastestmirror
Failed to set locale, defaulting to C解决