注意:linux命令
1、全局搜索文件
find / -name (文件名)
2、显示输入过的命令
history
3、搜索进程
ps -ef|grep postfix
1、添加GitLab源
$ vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
$ yum makecache fast && yum update -y
如果执行失败,可能是没有连网:
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
$service network restart
2、安装邮件服务
$ yum install -y postfix
$ systemctl enable postfix
$ systemctl start postfix
systemctl是高版本的centeros使用的,如果遇到systemctl not found,则考虑用service命令替换systemctl命令执行:
service postfix start
3、安装GitLab
GitLab自带了Web服务器(Nginx),若需要使用服务器已有的Nginx,需要额外的配置;
$ yum install -y gitlab-ce
4、配置GitLab
1、配置服务端口
$cd /etc/gitlab/gitlab.rb
修改gitlab.rb中的external_url
external_url 'http://192.168.1.106:90'
->http://192.168.1.106 是公网地址
->90端口是公网映射端口和gitlab服务启动端口
查看 下列目录下的gitlab.yml 软链接对应的文件
gitlab.yml只有在gitlab运行的时候才有
cd /opt/gitlab/embedded/service/gitlab-rails/config
修改 gitlab.yml
#
# 1. GitLab app settings
# ==========================
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 192.168.1.106
port: 90
https: false
此处对应的Host ,然后 重启,就可以看到项目的path得到了修改。
sudo gitlab-ctl restart
2、邮件服务
Gmail
请自行更改smtp_user_name与smtp_password;
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
QQ exmail(腾讯企业邮箱)
请自行更改smtp_user_name、smtp_password与gitlab_email_from;
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = 'smtp user'
Outlook
请自行更改smtp_user_name、smtp_password与gitlab_email_from;
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-mail.outlook.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "smtp-mail.outlook.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
gitlab_rails['gitlab_email_from'] = 'smtp user'
其他邮件服务
其他邮件服务的设置,请参照官网: https://docs.gitlab.com/omnibus/settings/smtp.html ,此处就不再赘述了;
测试操作
$ gitlab-rails console
irb(main):001:0> Notify.test_email('ben_wyx@outlook.com', 'Hello', 'Hello, World').deliver_now
3、重新生成配置
每一次修改配置文件,都要执行此操作;
$ gitlab-ctl reconfigure
5、命令使用
1、启动服务
$ gitlab-ctl start
2、停止服务
$ gitlab-ctl stop
3、获取运行状态
$ gitlab-ctl status
4、获取帮助信息
$ gitlab-ctl --help
参考链接:https://www.centos.bz/2017/09/在linux上安装与配置gitlab/
网友评论