1、在Centos7上安装Gitlab
以前尝试过直接yum安装,但服务器从该yum源下载实在太慢,故手动下载rpm包安装。linux
1.先安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
1
2.启动postfix,并设置开机自启动
目的:支持gitlab邮件发送git
systemctl enable postfix && systemctl start postfix
1
3.下载并安装Gitlab社区版RPM包
个人下载路径以下:gitlab-ce-10.5.2-ce.0.el7.x86_64.rpm
注意根据本身的linux系统选择合适的包
再输入:rpm -ivh gitlab-ce-10.5.2-ce.0.el7.x86_64.rpm 安装完毕!浏览器
EL是Red Hat Enterprise Linux的简写
- EL6软件包用于在Red Hat 6.x, CentOS 6.x, and CloudLinux 6.x进行安装
- EL5软件包用于在Red Hat 5.x, CentOS 5.x, CloudLinux 5.x的安装
- EL7 软件包用于在Red Hat 7.x, CentOS 7.x, and CloudLinux 7.x的安装
1
2
3
4
4.修改Gitlab访问URL配置
可使用自定义域名,也能够直接IP地址+端口访问
此处注意别使用已被占用的端口!(如8080)bash
5.重置并启动Gitlab
重置:gitlab-ctl reconfigure服务器
注:第一次预计须要几分钟 ssh
启动: gitlab-ctl restart gitlab
6.浏览器访问Gitlab
直接经过域名端口访问:http://10.3.1.12:8082post
我在此处出现问题:
1.502错误
排查过程:
首先保证Gitlab可用运行内存大于4G,端口未被占用
再赋予权限:chmod -R 755 /var/log/gitlab
再重置重启
访问后仍然可能遇到502,不过我刷新2次就一切ok了。。测试
2.进去后会提醒你从新设置密码,此处报错
用户名默认为root,密码本身设置
不管怎么样修改密码都报这个错
而后我重置重启,结果ok了。。.net
2、在Gitlab里配置项目
先本地Git导入项目到Gitlab,再经过IDEA导入GItlab上的项目
1.配置Gitlab用户邮箱
在User Settings - Emails 中添加邮箱并confirm
2.添加开发电脑的key到Gitlab上
先确保你的开发电脑上已安装Git,并作好基本准备,这个再也不多说
打开Git Bash生成key:
在bash中输入ssh-keygen -t rsa -C “yourEmail@example.com” 便可,后面输入本身的邮箱
再在 ~/.ssh/id_rsa.pub中复制其中全部内容,在User Settings - SSH Keys中添加复制内容
3.将开发电脑上已存在的项目导入到Gitlab上
先在Gitlab上建立一个空项目-test
再打开本地Git Bash,配置全局的 user.name 和 user.email:
git config --global user.name "root"
git config --global user.email "yuanjie@397.com"
1
2
首先cd到你须要导入的项目目录下,再执行导入命令:
git init
git remote add origin git@10.3.1.12:root/test.git
git add .
git commit -m "测试-test"
git push -u origin master
1
2
3
4
5
至此,能够到浏览器刷新test项目,发现导入成功
4.在IDEA上clone项目 根据图示依次操做便可: