访问下面的gitlab官网,并选择CentOs7的安装步骤:
https://about.gitlab.com/install/
按顺序执行,下面的命令:
其中"http://gitlab.example.com",这个地址为,安装完gitlab以后,访问gitlab的地址,要改成你自己的。地址中包含的端口号,要在centOs防火墙里,把端口号开放出来,开放命令如下:
关闭防火墙:systemctl stop firewalld
查看所有打开的端口: firewall-cmd --zone=public --list-ports
开放端口号80:firewall-cmd --zone=public --add-port=80/tcp --permanent
重载:firewall-cmd --reload
如遇到访问gitlab遇到502,可能是因为,端口号被占用(因为我本地用docker安装了一个gitlab,有冲突)。或者可能是内存原因。
本地项目上传gitlab,先在网页上create project(项目名和本地项目相同)
下面是本地项目上传命令:
生成gitlab key
ssh-keygen -t rsa -C “root”
登录gitlab add key
git config --global user.email “xxxxxxx@xx.com”
git config --global user.name “root”
git init
git remote add origin ssh://git@http://192.168.1.115:9999/root/zookeeper_dubbo_springboot.git
git add .
git commit -m ‘first commit’
git push -u origin master
–如果还报错
git remote rm origin //删除
git remote add origin ssh://git@http://192.168.1.115:9999/root/zookeeper_dubbo_springboot.git //添加新的地址
git push -u origin master
----优化gitlab
----创建分区:https://www.cnblogs.com/yoyoketang/p/10281892.html
dd if=/dev/zero of=/mnt/swap bs=512 count=8388616
mkswap /mnt/swap
vim /etc/sysctl.conf
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
vm.swappiness = 60
net.ipv4.neigh.default.gc_stale_time=120