如果是Ubuntu的环境,执行以下命令安装
安装: sudo apt-get install git 配置git用户名和邮箱: git config --global user.name "your_name" git config --global user.email "your_email"
如果是centos的环境,执行以下命令安装
yum install git
执行命令:
ssh-keygen -t rsa -C "yourEmail" 一路回车,全部采用默认的方式
生成的密钥位于~/.ssh目录下的id_rsa.pub文件
执行以下命令:
添加:adduser git 修改用户密码:pwd git 禁用git用户shell登录:修改/etc/passwd文件将:git:x:1000:1000::/home/git:/bin/bash 修改为:git:x:1000:1000::/home/git:/usr/bin/git-shell
这里贴上centos7的安装配置教程,Ubuntu系统参考官网教程,官网提供了各系统的相关配置教程Gitlab
1. 安装必要的配置和依赖
sudo yum install curl policycoreutils openssh-server openssh-clients
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 systemtl reload firewalld
以上过程中,开启postifix服务可能会遇到:
Job for postfix.service failed because the control process exited with error code. See “systemctl status postfix.service” and “journalctl -xe” for details.
修改/etc/postfix/main.cf文件:
inet_protocols = ipv4
inet_interfaces = all
如果firewalld 未开启执行sudo systemctl start firewalld开启防火墙
2. 添加Gitlab软件包服务器和安装程序包
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce
3.启动gitlab
sudo yum install gitlab-ce
打开浏览器,访问你的服务器地址即可进入gitlab
4.修改gitlab默认的端口,防止和tomcat以及80端口发生冲突
修改/etc/gitlab/gitlab.rb文件:
external_url 值为’yourURL:9999’
unicorn[‘port’] = 8091
重启gitlab以生效:sudo yum install gitlab-ce