阿里云服务器系统:CentOS 7.2 64
1、安装依赖包
sudo yum install -y curl policycoreutils-python openssh-server
2、设置SSH开机自启动并启动SSH服务
sudo systemctl enable sshd
sudo systemctl start sshd
3、安装Postfix来发送通知邮件
sudo yum install postfix
4、设置Postfix开机自启动
sudo systemctl enable postfix
5、启动Postfix服务
6、添加GitLab软件包仓库
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
7、安装GitLab
sudo EXTERNAL_URL="GitLab服务器的公网IP地址" yum install -y gitlab-ce
8、使用浏览器访问GitLab服务器的公网IP地址。
返回页面如下图所示,表示环境搭建成功,并且您需要设置新密码
9、登录GitLab。
在浏览器的地址栏中,输入ECS服务器的公网IP即可进入GitLab的登录界面,首次登录使用用户名root,密码为首次访问GitLab时设置的新密码
1、使用Linux自带的软件源安装Git工具
yum install git
2、生成密钥文件。
使用如下命令生成密钥文件.ssh/id_rsa。
ssh-keygen
3、使用如下命令查看公钥文件id_rsa.pub中的内容。在下一步操作中,您需要粘贴该内容到GitLab服务器的SSH-key的配置文件中。
cat .ssh/id_rsa.pub
1、配置使用Git仓库的人员姓名。
git config --global user.name "testname"
2、配置使用Git仓库的人员email,填写自己的公司邮箱
git config --global user.email "[email protected]"
3、克隆项目,在本地生成同名目录,并且目录中会有所有的项目文件
git clone git@iZxxxxxxxxxxxxxxxxx3Z:root/test.git
1、修改nginx端口
vi /etc/gitlab/gitlab.rb
2、修改
vi /var/opt/gitlab/nginx/conf/gitlab-http.conf
vi /etc/gitlab/gitlab.rb
4、防火墙添加端口允许访问
firewall-cmd --zone=public --permanent --add-port=8082/tcp
firewall-cmd --reload 防火墙重新加载配置
systemctl status firewalld 查看firewalld状态
systemctl start firewalld 开启防火墙
systemctl stop firewalld 关闭防火墙
5、保存配置,重启
gitlab-ctl reconfigure
gitlab-ctl restart