一、install gitlab
1、优化系统
systemctl stop firewalld.service
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux<br>setenforce 0
hostnamectl set-hostname gitlab
hostname gitlab
exit
2、安装repo
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum clean all
yum makecache
3、安装依赖包
yum install curl policycoreutils openssh-server openssh-clients postfix -y
#启动postfix
[root@gitlab ~]# systemctl start postfix
[root@gitlab ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-05-08 23:17:09 CST; 7min ago
Main PID: 9637 (master)
CGroup: /system.slice/postfix.service
├─9637 /usr/libexec/postfix/master -w
├─9638 pickup -l -t unix -u
└─9639 qmgr -l -t unix -u
May 08 23:17:08 template.com systemd[1]: Starting Postfix Mail Transport Agent...
May 08 23:17:09 template.com postfix/postfix-script[9635]: starting the Postfix mail system
May 08 23:17:09 template.com postfix/master[9637]: daemon started -- version 2.10.1, configurati...fix
May 08 23:17:09 template.com systemd[1]: Started Postfix Mail Transport Agent.
Hint: Some lines were ellipsized, use -l to show in full.
#安装依赖包
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
#配置gitlab源
[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/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
[root@gitlab ~]# yum makecache
yum install gitlab-ce -y
版本号:
gitlab-ce.x86_64 0:11.10.4-ce.0.el7
4、安装git
[root@gitlab ~]# yum install git -y
#修改配置文件
[root@gitlab ~]# vi /etc/gitlab/gitlab.rb
external_url 'http://gitlab.example.com' 改成:external_url 'http://gitlab.nulige.com'
#配置域名解析
echo "192.168.56.32 gitlab.nulige.com" >>/etc/hosts
#查看解析
[root@gitlab ~]# tail -1 /etc/hosts
192.168.56.32 gitlab.nulige.com
#初始化
[root@node1 ~]# gitlab-ctl reconfigure
时间可能比较长,请你耐心等待即可!
#gitlab命令
关闭:gitlab-ctl stop
启动:gitlab-ctl start
重启:gitlab-ctl restart
状态:gitlab-ctl status
#在windows本地配置域名解析
C:\Windows\System32\drivers\etc\hosts
192.168.56.32 gitlab.nulige.com
#登录网站
http://gitlab.nulige.com
username: root
password: xxxxxxxx
#注册普通用户
username: nulige
password: xxxxxxxx
用户普通用户登录gitlab
#创建一个项目名称为:tale的项目
#下载java编写的tale博客户系统项目
网站地址:https://github.com/otale/tale
[root@gitlab ~]# mkdir -p /nulige/tools
[root@gitlab ~]# cd /nulige/tools/
[root@gitlab tools]# ll
total 0
[root@gitlab tools]# git clone https://github.com/otale/tale.git
#上传tale.zip包
[root@gitlab tools]# sz
total 6072
-rw-r--r-- 1 root root 6214452 May 9 00:10 tale-master.zip
#解压
[root@gitlab tools]# yum install unzip -y
[root@gitlab tools]# unzip tale-master.zip
[root@gitlab tools]# cd tale-master
[root@gitlab tale-master]# ll
total 28
drwxr-xr-x 2 root root 18 Dec 27 20:04 bin
-rw-r--r-- 1 root root 659 Dec 27 20:04 install.sh
-rw-r--r-- 1 root root 1073 Dec 27 20:04 LICENSE
-rw-r--r-- 1 root root 1453 Dec 27 20:04 package.xml
-rw-r--r-- 1 root root 7446 Dec 27 20:04 pom.xml
-rw-r--r-- 1 root root 2825 Dec 27 20:04 README.md
-rw-r--r-- 1 root root 2691 Dec 27 20:04 README_ZH.md
drwxr-xr-x 4 root root 30 Dec 27 20:04 src
[root@gitlab tale-master]# cd
#添加ssh-key认证
[root@gitlab ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:DSzUvZE5dxozZw+pr+Ke4rqNf3tgmIQEA43n8P2SYb4 root@gitlab
The key's randomart image is:
+---[RSA 2048]----+
| .+o... . o . |
| o oo... * = * |
| = o..o = X o |
| o =..o. o .|
| o =So. . |
| + + o . |
| o . . . |
| Eo. o.o |
| +=+==+ |
+----[SHA256]-----+
[root@gitlab ~]#
[root@gitlab ~]#
[root@gitlab ~]# cd .ssh/
[root@gitlab .ssh]# ll
total 8
-rw------- 1 root root 1675 May 9 00:13 id_rsa
-rw-r--r-- 1 root root 393 May 9 00:13 id_rsa.pub
#查看公钥
[root@gitlab .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWVIpkBjEpfXBQd74nYOBWv299sydQyBeoiDMdAQGwGNDUpq874O695gXkmc5V7ZFgSLlYZninx1Cl0McZRkasCbvVF/e2xsQwkMBOQVsO+TW1rbOiq/kE4taXdJNWTRXtYE9sgiH+I4A2DXeWmsZH5EolgQKlLyJP7M1Q8ifw/XtuyhbBNATIrORciL4afhtPLk4ma+h3uvi+RRPftlJxIrjM3p2csuIIJ33oOXQCoYVmf4BuYKXuJiO8M92h9WRt1/phbJi9oaCUSmR0jzxCI5UUmKsNOhQsyPeG3c19GvXBBvWyuPC/4p6K5VwfFWNHQ3XhprtCkf3DVrTWWtFF root@gitlab
#在gitlab上面添加key
#上传项目
#添加账号
[root@gitlab tale-master]# git config --global user.name "nulige"
[root@gitlab tale-master]# git config --global user.email "1034611705@qq.com"
[root@gitlab ~]# cd /nulige/tools/
[root@gitlab tools]# ll
total 6072
drwxr-xr-x 5 root root 206 Dec 27 20:04 tale-master
-rw-r--r-- 1 root root 6214452 May 9 00:10 tale-master.zip
[root@gitlab tools]# cd tale-master
[root@gitlab tale-master]# git init
Initialized empty Git repository in /nulige/tools/tale-master/.git/
[root@gitlab tale-master]# git remote add origin git@gitlab.nulige.com:nulige/tale.git
[root@gitlab tale-master]# git add .
[root@gitlab tale-master]# git commit -m "tale"
[master (root-commit) 277a762] tale
254 files changed, 52718 insertions(+)
create mode 100644 .gitattributes
create mode 100644 .gitignore
create mode 100644 .travis.yml
省略部分....
[root@gitlab tale-master]# git push -u origin master
The authenticity of host 'gitlab.nulige.com (192.168.56.32)' can't be established.
ECDSA key fingerprint is SHA256:y7PlvfvoJqD3HS85DXmRno+mth9M0PYS1OcOlj4uoSY.
ECDSA key fingerprint is MD5:ad:a2:3f:48:5e:8f:49:56:93:d1:82:c7:e6:e0:64:94.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.nulige.com,192.168.56.32' (ECDSA) to the list of known hosts.
Counting objects: 358, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (308/308), done.
Writing objects: 100% (358/358), 5.23 MiB | 0 bytes/s, done.
Total 358 (delta 38), reused 0 (delta 0)
remote: Resolving deltas: 100% (38/38), done.
To git@gitlab.nulige.com:nulige/tale.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
执行结果:
#参考网址