没有合适的资源?快使用搜索试试~ 我知道了~
gitlab使用教程linux环境安装教程
需积分: 19 4 下载量 46 浏览量
2022-07-15
22:14:37
上传
评论
收藏 4.08MB PDF 举报
温馨提示
试读
31页
gitlab使用教程,linux环境下安装部署操作手册
资源详情
资源评论
资源推荐
服务器名称 服务器地址
GitLab 服务器 192.168.1.201
目录分类 目录地址
安装目录 /opt/gitlab
启动文件目录 /opt/gitlab/bin
端口号 端口作用 通讯协议
9000 访问端口 TCP
1.安装准备
1.1.服务器相关参数
1.1.1.服务器规划
1.1.2.目录规划
1.1.3.端口规划
1.2.环境检查
1.2.1.检查操作系统版本
检查内核版本
检查 RedHat 版本
1.3.安装前准备工作
cat /proc/version
> # cat /proc/version
> Linux version 3.10.0-862.el7.x86_64 (mockbuild@x86-
034.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28)
(GCC) ) #1 SMP Wed Mar 21 18:14:51 EDT 2018
cat /etc/redhat-release
> # cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 7.5 (Maipo)
1.3.1.关闭防火墙与 SELINUX
2.初始化系统参数
2.1.创建相关文件件
2.2.调整系统参数
2.2.1.上传调参脚本
将下列文件上传到 /opt/software 文件夹中
resources/Parameter_scripts/app_initEnv.sh
2.2.2.调整系统参数
脚本参数可选选项
Usage:
-user [OPTIONS...] Use this option to initialize the user and installation directory.
user OPTIONS:
--prefix Specify the installation directory with -user option,default /app.
--with-uname Specify username with -user option,default appuser.
--with-ugroup Specified user group with -user option,default appuser.
--with-upasswd Specify user password with -user option,default appuser.
-system Use this option to adjust system parameters.
-silent Combination of option -system and option -user.
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
> # systemctl stop firewalld.service
> # systemctl disable firewalld.service
> Removed symlink /etc/systemd/system/multi-
user.target.wants/firewalld.service.
> Removed symlink /etc/systemd/system/dbus-
org.fedoraproject.FirewallD1.service.
> # setenforce 0
> # sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
mkdir -p /opt/software /opt/data/git-data
> # mkdir -p /opt/software /opt/data/git-data
sh /opt/software/app_initEnv.sh -system
> # sh /opt/software/app_initEnv.sh -system
> The system parameters are adjusted as fllows:
> **************************************************
> net.ipv4.tcp_tw_recycle = 1
> Redirecting to /bin/systemctl restart sshd.service
> **************************************************
-help|help Use this option to get more information.
Extends usage:
You can use multiple options for create user.
eg: Custom initialization with option -user --prefix=/app --with-uname=appuser --with-
ugroup=appuser --with-upasswd=appuser.
2.3.安装 GitLab 依赖
3.部署 GitLab
以下步骤都使用 root 用户进行
默认安装路径在 /opt/ 目录下
官方建议最少有 4G 的内存
3.1.上传压缩包
GitLab 安装包下载地址
更具对应的系统进入对应的文件夹下,下载 GitLab 。
3.1.1.上传压缩包
将下列文件上传到 /opt/software 文件夹中
resources/GitLab/packages/gitlab-ce-*.rpm
3.2.安装 GitLab
3.2.1.安装 GitLab
yum install -y policycoreutils-python openssh-server cronie
> # yum install -y policycoreutils-python openssh-server cronie
rpm -ivh /opt/software/gitlab-ce-*.rpm
> # rpm -ivh /opt/software/gitlab-ce-*.rpm
> warning: /opt/software/gitlab-ce-12.0.9-ce.0.el7.x86_64.rpm: Header V4
RSA/SHA1 Signature, key ID f27eab47: NOKEY
> Preparing... #################################
[100%]
> Updating / installing...
> 1:gitlab-ce-12.0.9-ce.0.el7 #################################
[100%]
> It looks like GitLab has not been configured yet; skipping the upgrade
script.
>
> *. *.
> *** ***
> ***** *****
> .****** *******
> ******** ********
> ,,,,,,,,,***********,,,,,,,,,
> ,,,,,,,,,,,*********,,,,,,,,,,,
> .,,,,,,,,,,,*******,,,,,,,,,,,,
> ,,,,,,,,,*****,,,,,,,,,.
3.2.2.修改 gitlab.rb 配置文件
修改配置文件相关属性如下
external_url
--- GitLab 访问地址
external_url 'http://gitlab.example.com'
改成
external_url
'http://192.168.1.201:9000'
git_data_dirs
--- GitLab 仓库存储位置
改成
nginx['listen_port']
--- Nginx 端口(默认: 80)
# nginx['listen_port'] = nil
改成
nginx['listen_port'] = 9000
unicorn['port']
--- Unicorn 端口(默认: 8080),存在端口冲突的时候修改
# unicorn['port'] = 8080
改成
unicorn['port'] = 28001
prometheus['listen_address']
--- Prometheus 端口(默认: 9090),存在端口冲突的时
候修改
> ,,,,,,,****,,,,,,
> .,,,***,,,,
> ,*,.
>
>
>
> _______ __ __ __
> / ____(_) /_/ / ____ _/ /_
> / / __/ / __/ / / __ `/ __ \
> / /_/ / / /_/ /___/ /_/ / /_/ /
> \____/_/\__/_____/\__,_/_.___/
>
>
> Thank you for installing GitLab!
> GitLab was unable to detect a valid hostname for your instance.
> Please configure a URL for your GitLab instance by setting `external_url`
> configuration in /etc/gitlab/gitlab.rb file.
> Then, you can start your GitLab instance by running the following command:
> sudo gitlab-ctl reconfigure
>
> For a comprehensive list of configuration options please see the Omnibus
GitLab readme
> https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
# git_data_dirs({
# "default" => {
# "path" => "/mnt/nfs-01/git-data"
# }
# })
git_data_dirs({
"default" => {
"path" => "/opt/data/git-data"
}
})
# prometheus['listen_address'] = 'localhost:9090'
改成
prometheus['listen_address'] = 'localhost:28002'
unicorn['worker_timeout']
--- Unicorn 超时时间
unicorn['worker_processes']
--- unicorn 进程数 CPU核数+1
postgresql['shared_buffers']
--- PostgreSQL 数据库缓存大小(默认: 256),可适当改
小
postgresql['max_worker_processes']
--- PostgreSQL 数据库并发数,可适当改小
sidekiq['concurrency']
--- Sidekiq 并发数,可适当改小
unicorn['worker_memory_limit_min']
--- Unicorn 内存,可适当改小
unicorn['worker_memory_limit_max']
--- Unicorn 内存,可适当改小
gitlab_rails['smtp_*']
--- 邮箱服务 SMTP 服务器设置
gitlab_rails['gitlab_email_*']
--- GitLab 邮件设置
3.2.3.重新配置 GitLab 服务并启动
4.系统运维
4.1.GitLab 相关命令
vim /etc/gitlab/gitlab.rb
> # vim /etc/gitlab/gitlab.rb
gitlab-ctl reconfigure
gitlab-ctl restart
> # gitlab-ctl reconfigure
> ......
> Chef Client finished, 508/1344 resources updated in 04 minutes 07 seconds
> gitlab Reconfigured!
> # gitlab-ctl restart
> ok: run: alertmanager: (pid 3257) 0s
> ok: run: gitaly: (pid 3266) 0s
> ok: run: gitlab-monitor: (pid 3283) 0s
> ok: run: gitlab-workhorse: (pid 3286) 0s
> ok: run: grafana: (pid 3304) 0s
> ok: run: logrotate: (pid 3318) 1s
> ok: run: nginx: (pid 3327) 0s
> ok: run: node-exporter: (pid 3332) 0s
> ok: run: postgres-exporter: (pid 3338) 1s
> ok: run: postgresql: (pid 3422) 0s
> ok: run: prometheus: (pid 3432) 1s
> ok: run: redis: (pid 3441) 0s
> ok: run: redis-exporter: (pid 3466) 1s
> ok: run: sidekiq: (pid 3473) 0s
> ok: run: unicorn: (pid 3494) 1s
# 启动所有 gitlab 组件
gitlab-ctl start
剩余30页未读,继续阅读
下面我们举个栗子说明一下
- 粉丝: 2148
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0