收藏文章 楼主

debian 安装gitlab

版块:linux   类型:普通   作者:小绿叶技术博客   查看:1282   回复:1   获赞:0   时间:2022-03-21 16:22:55

#!/bin/bash

#------------------- 安装gitleb --------------#

# https://packages.gitlab.com/app/gitlab/gitlab-ce/search?q=gitlab-ce_14.8.2-ce.0_amd64.deb

# https://www.yundongfang.com/Yun39025.html


apt update


apt autoremove gitlab-ce*   先卸载原有的gitlab


wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian/pool/buster/main/g/gitlab-ce/gitlab-ce_14.0.6-ce.0_amd64.deb


apt-get install ./gitlab-ce_14.0.6-ce.0_amd64.deb -y

# 先安装这个低版本,再安装最新版本


gitlab-ctl reconfigure   

# 安装后 执行:生效配置并启动


# ipa=`ifconfig eth0 | grep -w inet | awk -F" " '{print $2}'` ; echo $ipa

#修改访问地址  external_url 'http://$ipa'

NR=`cat -n /etc/gitlab/gitlab.rb | grep external_url | grep -v "#" | awk -F" " '{print$1}'` ; echo $NR

# 修改配置访问地址,修改行:    32 行 external_url 'http://gitlab.example.com'

sed -i " $NR d" /etc/gitlab/gitlab.rb 

# 删除之前的行


ipa="eisc.cn"; sed -i "$NR a  external_url 'http://$ipa' " /etc/gitlab/gitlab.rb 

# 重新写入gitlab 的链接地址


NR=`cat -n /etc/gitlab/gitlab.rb | grep letsencrypt  | grep emails | awk -F" " '{print $1}'` ; echo $NR

sed -i "$NR d"  /etc/gitlab/gitlab.rb

# 获取行号,删除行

email="" ; sed -i "$NR a   letsencrypt['contact_emails'] = ['$email'] " /etc/gitlab/gitlab.rb 

# 修改邮箱写入


NR=`cat -n /etc/gitlab/gitlab.rb |grep gitlab_rails | grep "smtp_pool"  | awk -F" " '{print $1}'` ; echo $NR

sed -i "$NR d" /etc/gitlab/gitlab.rb

sed -i "$NR a gitlab_rails['smtp_pool'] = true " /etc/gitlab/gitlab.rb


gitlab-ctl reconfigure

# 生效配置


# 查看密码:cat /etc/gitlab/initial_root_password

# 修改密码:需要登录gitlab 进行修改; 默认账户 root

# 只修改访问地址为 ip ,则端口为 80   修改为其他端口,那么ip变为 127.0.0.1



# 参考:https://www.runoob.com/git/git-tutorial.html

提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:debian 安装gitlab

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息