51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Gitlab的安装

Gitlab安装 {#gitlab安装}

1.安装相关依赖

|-----------|-----------------------------------------------------------------------------------------| | 1 | hljs shell yum -y install policycoreutils openssh-server openssh-clients postfix |

2.启动ssh服务&设置为开机启动

|-----------|----------------------------------------------------------------------| | 1 | hljs shell systemctl enable sshd && sudo systemctl start sshd |

3.设置postfix开机自启,并启动,postfix支持gitlab发信功能

|-----------|----------------------------------------------------------------------------| | 1 | hljs shell systemctl enable postfix && sudo systemctl start postfix |

如果报这个错

|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | hljs shell Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details. |

可以采取以下解决方案

|-----------------|----------------------------------------------------------------------------------------------------| | 1 2 3 4 | hljs shell #修改 /etc/postfix/main.cf的设置 #别写反了。。。 inet_protocols = ipv4 inet_interfaces = all |

4.开放ssh以及http服务,然后重新加载防火墙列表

|---------------|--------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 | hljs shell firewall-cmd --add-service=ssh --permanent firewall-cmd --add-service=http --permanent firewall-cmd --reload |

5.下载gitlab包,并且安装

|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 | hljs shell #在线下载安装包 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.4.2-ce.0.el7.x86_64.rpm rpm -i gitlab-ce-12.4.2-ce.0.el7.x86_64.rpm |

6.修改gitlab配置

|-----------|--------------------------------------------| | 1 | hljs shell vi /etc/gitlab/gitlab.rb |

修改gitlab访问地址和端口,默认80,我们改成82,改这两处

|-------------|------------------------------------------------------------------------------------| | 1 2 | hljs shell external_url 'https://121.89.163.191:82' nginx['listen_port']=82 |

7.重载配置及启动gitlab

|-------------|-------------------------------------------------------------| | 1 2 | hljs shell gitlab-ctl reconfigure gitlab-ctl restart |

8.把端口添加到防火墙

|-------------|--------------------------------------------------------------------------------------------------| | 1 2 | hljs shell firewall-cmd --zone=public --add-port=82/tcp --permanent firewall-cmd --reload |

如果一直502,查看8080端口是否被占用

|-----------------|----------------------------------------------------------| | 1 2 3 4 | hljs shell #查看端口 netstat -ntpl #停止端口 kill -9 4789 |

之后重启

|-----------|--------------------------------------| | 1 | hljs shell gitlab-ctl restart |

进去了后改密码...

左上角创建一个group(有手就行) gitlab

new project

接下来是push项目 {#接下来是push项目}

创建项目,8088端口

然后在idea的

VCS->Enable Version Control Integration...

image-20200804222027830

打开后选择Git创建版本控制库

image-20200804222050074

image-20200804222146217

开始写代码

然后右键项目根路径Add代码,commit代码...

image-20200804222759496

image-20200804222858444

image-20200804223327715

image-20200804223402838

image-20200804223435012

以及Remotes里添加我们的远程仓库

image-20200804223502609

push

image-20200804223638515

也可以去管理远程仓库

image-20200804223733362

image-20200804223834907

对了,中途弹出的输入用户名和密码

如果密码输错了,可以去

windows控制面板->用户账户->凭据管理器找到windows凭据

然后删除对应的凭据就行了

image-20200804224042359

赞(0)
未经允许不得转载:工具盒子 » Gitlab的安装