安装GitLab教程

1. 首先需要一台Linux的服务器,并进行系统预配置工作

1.1 进行服务器防火墙的关闭操作

# 关闭防火墙
systemctl stop firewalld  

# 禁止开机启动
systemctl disable firewalld 

1.2 关闭SELINUX并重启系统

sudo vi /etc/sysconfig/selinux
# 该配置调整为 disabled
SELINUX=disabled
# 根据 getenforce 命令查看是否关闭
[vagrant@gitlab ~]$ sudo getenforce
Disabled

2. 安装Omnibus Gitlab-ce package (必要的插件的集合版本)

2.1 安装gitlab依赖的组件

sudo yum -y install curl policycoreutils openssh-server openssh-clients postfix

2.2 配置YUM仓库

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

2.3 添加启动 postfix邮件服务

systemctl start postfix && systemctl enable postfix

2.4 安装Gitlab-ce 社区版本

yum install -y gitlab-ce

3. 在安装完毕GitLab-CE 后,进行后续的配置工作

3.1 创建gitlab 证书 (openssl 详细使用介绍

# 创建目录
sudo mkdir -p /etc/gitlab/ssl
# 创建秘钥
sudo openssl genrsa -out "/etc/gitlab/ssl/gitlab.examle.com.cn.key"   2048

sudo openssl req -new -key "/etc/gitlab/ssl/gitlab.examle.com.cn.key" -out 
"/etc/gitlab/ssl/gitlab.examle.com.cn.csr"

# 根据指示填写秘钥生成内容
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:biejing
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:gitlab.******.com
Email Address []:*********@qq.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456789
An optional company name []:admin

sudo openssl x509 -req -days 365 -in "/etc/gitlab/ssl/gitlab.examle.com.cn.csr"
- signkey "/etc/gitlab/ssl/gitlab.examle.com.cn.key" -out "/etc/gitlab/ssl/gitlab.examle.com.cn.crt"
Signature ok
subject=/C=cn/ST=biejing/L=beijing/O=Default Company Ltd/CN=gitlab.example.com.cn/emailAddress=********@qq.com
Getting Private key

sudo openssl dhparam -out /etc/gitlab/ssl/dhparams.pem

3.2 把创建的证书 配置到gitlab 

sudo vi /etc/gitlab/gitlab.rb

## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
# 调整前  external_url 'http://gitlab.example.com'
external_url 'https://gitlab.example.com'


# 然后搜索包含 /redirect_http_to_https 内容的配置

# nginx['enable'] = true
# nginx['client_max_body_size'] = '250m'
# nginx['redirect_http_to_https'] = false # 放开该行注释并调整属性
nginx['redirect_http_to_https'] = true
# nginx['redirect_http_to_https_port'] = 80

# 继续更改 key 的地址(也就是前面生成的key)

# nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.examle.com.cn.crt"
# nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.examle.com.cn.key"

# nginx['ssl_dhparam'] = nil # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
# 调整为之前生成的key
# nginx['ssl_dhparam'] = /etc/gitlab/ssl/dhparams.pem # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
# nginx['listen_addresses'] = ['*', '[::]']

# 修改调整完进行保存退出

3.3 初始化gitlab的相关配置

# 进行 gitlab 相关的应用进行初始化
sudo gitlab-ctl reconfigure

# 修改gitlab使用的nginx 的http 相关配置
vi /var/opt/gitlab/nginx/conf/gitlab-http.com.conf


#在 server_name gitlab.example.com; 下新增下行配置

rewrite ^(.*)$ https://$host$1 permanent;


# 使配置生效
gitlab-ctl restart

4. web页面的访问

4.1 在所使用的系统中添加 host DNS 配置
4.2 在浏览器访问你所配置的域名 会出现下列页面,

 

 

 

 

 




 

### 如何为小米路由器OpenWRT #### 准备工作 为了成功地将OpenWRT入到小米路由器中,需提前准备好必要的工具和软件。这包括但不限于一台电脑用于操作、一根网线连接至路由器以及确保拥有最新的Breed固件版本和支持的小米路由器型号列表[^1]。 #### 开启Telnet服务 通过特定命令或按钮激活隐藏模式下的telnet功能对于后续步骤至关重要。通常情况下,在浏览器地址栏输入`http://miwifi.com`进入管理界面后找到对应的选项来启用此特性;而对于某些特殊机型,则可能需要借助第三方应用或者按照官方文档指示完成设置过程[^2]。 #### 使用FTP上传文件 一旦开启了上述提到的服务之后就可以利用FTP客户端把breed.bin或者其他所需的镜像放置于设备内部存储空间当中去了。这里推荐使用FileZilla这类简单易用的应用程序来进行传输作业,并确认好目标路径是否正确无误[^3]。 #### 写Breed引导程序 当所有准备工作都已就绪之时便可以着手处理最核心的部分——即替换原有的bootloader部分为更加灵活可控的新版breed了。具体做法是在断电状态下按住reset键不放直到电源灯亮起再松手即可自动加载新安装好的环境。 #### 完成OpenWRT系统的部署 最后一步就是正式向flash芯片灌输openwrt.img映像包从而彻底改变原有操作系统架构成为基于Linux内核构建而成的强大网络平台之一。值得注意的是整个过程中要保持稳定供电以免造成不可逆损坏风险存在。 ```bash # 示例代码:通过TFTP服务器发送OpenWRT固件给路由器 tftp -l openwrt-trx-factory.bin -r /dev/mtdblock4 192.168.1.1 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值