环境准备: 关闭防火墙,selinux
安装依赖:yum install curl policycoreutils openssh-server openssh-clients postfix
使用国内yum 源,安装gitlab-ce:
[root@linux-node2 ~]# vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key
[root@linux-node2 ~]# yum makecache
[root@linux-node2 ~]# yum install gitlab-ce -y
修改Postfix配置文件,启动postifx:
[root@linux-node2 ~]# vim /etc/postfix/main.cf
把inet_interfaces = localhost 改为: inet_interfaces = all
[root@linux-node2 ~]# systemctl start postfix
[root@linux-node2 ~]# systemctl enable postfix
自签发证书:(这里以fxkjnj.com 为例)
[root@linux-node2 ~]# mkdir -p /etc/gitlab/ssl
[root@linux-node2 ~]# openssl genrsa -out "/etc/gitlab/ssl/fxkjnj.com.key" 2048
[root@linux-node2 ~]# openssl req -new -key "/etc/gitlab/ssl/fxkjnj.com.key" -out "/etc/gitlab/ssl/fxkjnj.com.csr"
填写域名地址:fxkjnj.com
邮箱地址: admin@fxkjnj.com
[root@linux-node2 ~]# openssl x509 -req -days 365 -in "/etc/gitlab/ssl/fxkjnj.com.csr" -signkey "/etc/gitlab/ssl/fxkjnj.com.key" -out "/etc/gitlab/ssl/fxkjnj.com.crt
[root@linux-node2 ~]# openssl dhparam -out /etc/gitlab/ssl/dhparams 2048
[root@linux-node2 ~]# chmod 600 /etc/gitlab/ssl/*
修改gitlab 配置文件:
[root@linux-node2 ~]# vim /etc/gitlab/gitlab.rb
指定gitlab web 域名地址(大概在13行)
external_url 'https://fxkjnj.com'
指定证书的路径:
把1074行改为如下:
#nginx['ssl_certificate'] = "/etc/gitlab/ssl/fxkjnj.com.crt"
把1075行改为如下:
#nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/fxkjnj.com.key"
把1089行改为如下:
#nginx['ssl_dhparam'] = /etc/gitlab/ssl/dhparams.pem # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
初始化准备:
[root@linux-node2 ~]# gitlab-ctl reconfigure
如果一直卡在 ruby_block[supervise_redis_sleep] action run
执行:[root@linux-node2 ~]# systemctl restart gitlab-runsvdir
再执行: [root@linux-node2 ~]# gitlab-ctl reconfigure
修改nginx 配置文件:
[root@linux-node2 ~]# vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
在server_name 下面添加一行:
rewrite ^(.*)$ https://$host$1 permanent;
[root@linux-node2 ~]# gitlab-ctl restart 重启所有服务
[root@linux-node2 ~]# gitlab-ctl tail 可以查报错内容
登录gitlab web界面 https://fxkjnj.com
创建密码, 登录(默认管理员用户是root)
https://fxkjnj.com/test-porject
###这里的-c 是指使用自签发的不安全的https
git -c http.sslVerify=false clone https://fxkjnj.com/test-porject
cd test-project
echo "this is a test" > test.sh
git add .
git commit -m "test1"
git -c http.sslVerify=false push origin master
git log --pretty=oneline
查看历史日志
git reset --hard e321
回到e321版本
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容