1.安装gitlab
__环境准备__
[root@gitlab ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@gitlab ~]# systemctl stop firewalld
1.1 安装gitlab依赖
yum install curl policycoreutils openssh-server openssh-clients postfix -y
systemctl start postfix #开启邮箱
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
1.2 镜像进行安装
[root@gitlab ~]# cat /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6 Repo_gpgcheck=0 Enabled=1 Gpgkey=https://packages.gitlab.com/gpg.key yum makecache yum install -y gitlab-ce #等待安装 yum install -y git #安装git客户端 gitlab-ctl reconfigure #配置gitlab
- 密码长度必须为八位数,12345678默认账户是root
第一步:我们创建一个项目和一个用户
[root@gitlab test]# cat /root/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsUUTo4zCw46aQR6zxn18mdWO6dQnryazXHlzKc+TjO5ewLp019OSo/N9Ki4PWeijvpHd7jgXepVM1jHcumuxQIj/IuuUimmwOFQ6pIxVQo0WkWcWnyMlOK804k/QudzMM5kGH4XZq4fnJX+BR7t4hYPQf4ehbkR01R2UzABE4pq5tOlgiRretLi3KlZufGeduFE8khqsUYJZ5w0hFPpCjvFmbU/YND5JWaaktjaquCuy8Cy7emT/ClO2uFc/wnmxjsTADj0of5dxNy0oxteRfUTbrzyCXAgI643Xcj1pHhNvyTo0zBIJHOWreGVKcdzSoXjBrUpejCw6Q/VOZd2Vj root@gitlab
[root@gitlab test]#git config --global user.email "you@example.com" [root@gitlab test]# git config --global user.name "Your Name" [root@gitlab test]# git commit -m "add index.html"
#我们的gitlab安装在/opt/gitlab/下,配置文件在/etc/gitlab/gitlab.rb下
可以修改一下配置文件
[root@gitlab test]# vim /etc/gitlab/gitlab.rb external_url 'http://192.168.56.11' [root@gitlab test]# gitlab-ctl reconfigure #提示:修改完需要使用reconfigure重载配置才会生效