linux安装gitlab
转载链接:https://cloud.tencent.com/info/497b83f3ee97879ae9526ebe65061b9a.html
转载链接:https://blog.****.net/xiangshanqishi/article/details/23439397
在安装过程中根据自身情况,把遇到的问题加以说明。
1.安装gitlab的之前需要安装的环境 sudo yum install curl policycoreutils openssh-server openssh-clients git -y sudo systemctl enable sshd sudo systemctl start sshd sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix sudo firewall-cmd --permanent --add-service=http sudo systemctl reload firewalld
在安装postfix的时候,
postfix: fatal: parameter inet_interfaces: no local interface found for ::1
解决办法为:配置为:
inet_interfaces = localhost
inet_protocols = all
改成:
inet_interfaces = all
inet_protocols = all
2. 添加GitLab仓库,并安装到服务器上
curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bashsudo yum install gitlab-ce
安装GitLab遇到。Cannot allocate memory 错误,原因是因为用的1G内存的云服务进行安装的,官方最低要求为2G。
解决办法是:swap多1G给内存。
转载:https://blog.****.net/sunrising_hill/article/details/52084517
1、找到你的系统里面剩余空间够大的分区(可以使用其中足够多的空间作为SWAP用
途),
我的机器的目录为“/opt”
- cd /opt
- mkdir swap
- cd swap
- dd if=/dev/zero of=swapfile bs=1M count=1024
3、强swapfile增加为swap分区,并开启。
- mkswap swapfile
- swapon swapfile
- [[email protected]]# free
- total used free shared buffers cached
- Mem: 49413764 48869760 544004 0 141040 44653184
- -/+ buffers/cache: 4075536 45338228
- Swap: 50330960 2090112 48240848
3. 启动GitLab sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
这个时候已经可以正常访问gitlab了,第一次会要求输入root的密码,然后登录就可以了
修改配置,将项目的域名改为ip地址,因为这台机器只有ip,没有绑定域名
https://www.cnblogs.com/kaneyang/p/7090923.html
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
## GitLab settings gitlab: ## Web server settings (note: host is the FQDN, do not include http://) host: 111.15.XXX.X >> 这里改为主机的IP即可 port: 80 https: false # Uncommment this line below if your ssh host is different from HTTP/HTTPS one # (you'd obviously need to replace ssh.host_example.com with your own host). # Otherwise, ssh host will be set to the `host:` value above
重启GitLab
gitlab-ctl restart