yum install gitlab最新版


一、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.

執行結果:

 

#參考網址

https://blog.51cto.com/12832314/2140284

 https://blog.51cto.com/12480612/2176720


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM