gitlab build the whole process and the pit encountered

First landing this URL Choose your virtual machine: https://about.gitlab.com/install

I chose centos7, jump to https://about.gitlab.com/install/#centos-7

You can see the steps of the installation, and can be copied directly.

first step:

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

It can be performed sequentially.

It can cause an error in the implementation of the sudo firewall-cmd --permanent --add-service = http , saying there is no firewall or firewall to open the process to be locked ( "firewalld.service: Unit is masked" ). Solution See: https://blog.csdn.net/Searchin_R/article/details/83933232

It can be resolved in the following manner.

1, start the firewall:

systemctl start firewalld

2, turn off the firewall:

systemctl stop firewalld

3, add the port release:

firewall-cmd --zone = public --add-port = 8161 / tcp --permanent (--permanent permanent, this parameter is not restarted after the failure)

4, lock Firewall service (to prevent action adds port, etc.):

systemctl mask firewalld

5、取消锁定:

systemctl unmask firewalld

第二步:

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

依次执行即可。

第三步:开始安装

离线下载gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm ,地址为https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

执行安装命令:rpm -ivh gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm 

第四步:

GitLab 的相关参数配置都存在 /etc/gitlab/gitlab.rb文件里。GitLab需要你设置好哪个url才是用户可以访问到GitLab,需要编辑下面这个文件

执行命令:vi /etc/gitlab/gitlab.rb

修改下面两个参数:

external_url 'http://192.168.31.129:9901'  external_url 应该是你的ip加你新定义的端口,这里我设置了9901,防止端口冲突

unicorn['port'] = 48080  这个端口号我设置为48080,也是为了防止端口冲突

第五步

# 配置并启动  gitlab-ctl reconfigure

第六步:

启动 gitlab-ctl start

gitlab-ctl status         #查看服务状态;

第七步:端口开通:参考:https://blog.csdn.net/Honnyee/article/details/81535464

添加

firewall-cmd --zone=public --add-port=9901/tcp --permanent   (--permanent永久生效,没有此参数重启后失效)

添加端口外部访问权限(这样外部才能访问)
firewall-cmd --add-port=9901/tcp

重新载入,添加端口后重新载入才能起作用

firewall-cmd --reload

这些之后,端口是开启成功的,如果没有成功,重启系统试试。

查看开启了哪些端口

firewall-cmd --list-ports

第八步:访问 http://192.168.31.129:9901 可以看到gitlab首页。可能会出现502,是因为gitlab比较耗费内存,所以需要修改一下虚拟机的配置。参考:https://www.cnblogs.com/zyb2016/p/11051917.html

[root@yoyo sbin]# cat /proc/swaps
Filename                Type        Size    Used    Priority
[root@yoyo sbin]# free
              total        used        free      shared  buff/cache   available
Mem:        3881692     3219200      369316       52184      293176      360244
Swap:             0           0           0

[root@yoyo sbin]# dd if=/dev/zero of=/mnt/swap bs=512 count=8388616
8388616+0 records in
8388616+0 records out
4294971392 bytes (4.3 GB) copied, 38.5364 s, 111 MB/s

[root@yoyo sbin]# mkswap /mnt/swap
Setting up swapspace version 1, size = 4194304 KiB
no label, UUID=1fa0acbf-ef66-49bd-ad05-e9fcf2727cc8

[root@yoyo sbin]# vim /etc/sysctl.conf
# vm.swappiness中的数值是否为0,如果为0则根据实际需要调整成60
修改前

vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
修改后

vm.swappiness = 60
net.ipv4.neigh.default.gc_stale_time=120
[root@yoyo sbin]# swapon /mnt/swap
swapon: /mnt/swap: insecure permissions 0644, 0600 suggested.
[root@yoyo sbin]# echo “/data/swap swap swap defaults 0 0” >> /etc/fstab
[root@yoyo sbin]# cat /proc/swaps 
Filename                Type        Size    Used    Priority
/mnt/swap                               file        4194304 0   -1
[root@yoyo sbin]# free
              total        used        free      shared  buff/cache   available
Mem:        3881692     3387168      165488       52184      329036      200184
Swap:       4194304           0     4194304

然后重新配置gitlab,gitlab-ctl reconfigure   gitlab-ctl start   就会发现已经非常快了。

发布了202 篇原创文章 · 获赞 136 · 访问量 42万+

Guess you like

Origin blog.csdn.net/u012045045/article/details/104219501