10.centos7.6 安裝gitLab

搭建環境:阿里雲   node

 遠程操做工具:xshellpython

參考:linux

        安裝過程:git

            http://www.javashuo.com/article/p-tswiznxo-bh.htmlshell

       遇到問題解決方案:vim

         

 

1.效果

2. 安裝gitHub過程

2.1 安裝ssh

sudo yum install -y curl policycoreutils-pythonopenssh-server

2.2 將SSH服務設置成開機自啓動

sudo systemctl enable sshd

 

2.3 啓動SSH服務

sudo systemctl start sshd

 

2.4 安裝防火牆

2.4.1 查看防火牆狀態

firewall-cmd --state

2.4.2 安裝防火牆

yum install firewalld systemd -y

 

 

2.4.3 開啓防火牆

service firewalld  start安全

 

2.4.4 添加http服務到firewalld,pemmanent表示永久生效,若不加--permanent系統下次啓動後就會失效。

sudo firewall-cmd --permanent --add-service=http

2.4.5 重啓防火牆

sudo systemctl reload firewalld

2.4.6 安裝Postfix以發送通知郵件

sudo yum install postfix

2.4.7 將postfix服務設置成開機自啓動

sudo systemctl enable postfix服務器

 

2.4.8 啓動postfixapp

sudo systemctl start postfix

2.4.9 wget 用於從外網上下載插件

wget -vssh

 

若wget未安裝則進行安裝,安裝命令:yum -y install wget

 

2.4.10 安裝vim編輯器

yum install vim -y

 

2.5 添加GitLab鏡像源並安裝gitlab服務器

2.5.1 添加gitlab鏡像

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

 

2.5.2  安裝gitlab

rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm --nodeps  --force

 

 

2.5.3 修改gitlab配置文件指定服務器ip和自定義端口

 

 

2.6 安裝lokkit

查看

sudo lokkit -s http -s ssh

安裝

yum install lokkit

 

2.7 防火牆設置

2.7.1 開啓開機  啓動防火牆

systemctl enable firewalld.service

 

2.7.2  開啓 9999端口

 

firewall-cmd --zone=public --add-port=9999/tcp --permanent

 

2.7.3 重啓Linux系統

 

2.7.4  阿里雲 開啓安全組9999端口

 

2.8 重置並啓動GitLab

 

重啓gitLab

gitlab-ctl reconfigure

查看服務狀態

gitlab-ctl restart

 

2.9 訪問 並修改密碼

2.9.1 訪問

第一次訪問很慢

2.9.2 初始化 root用戶密碼

參考:

http://www.javashuo.com/article/p-tkdgqauq-ey.html

2.9.2.1 切換目錄

cd /opt/gitlab/bin

 

2.9.2.2 執行初始化密碼命令

第一句:
sudo gitlab-rails console production
第二句:
 u=User.where(id:1).fir

 

 

 

2.9.2.3 第一次 設置密碼

u.password='12345678'

2.9.2.4 再次設置密碼

 

2.9.2.5  保存密碼

 u.save!

 

2.9.2.6 重啓linux系統

 

2.10 改變root密碼 及登陸

這裏你能夠改變 我設置的和剛剛在Linux中的同樣 12345678

設置初始化 root 用戶密碼

 

 

 

3.優化

3.1 特別卡

解決參考文檔

https://blog.csdn.net/qq_30745307/article/details/82829064

3.2  解決過程

3.2.1 經過如下命令查看swap分區狀況:

 

cat /proc/swaps

 

3.2.2 建立 swap 分區(這裏須要等待幾秒)

dd if=/dev/zero of=/mnt/swap bs=512 count=8388616

3.2.3 經過mkswap命令將上面新建出的文件作成swap分區

 

mkswap /mnt/swap

 

 

3.2.4 查看內核參數vm.swappiness中的數值是否爲0,若是爲0則根據實際須要調整成60

 

cat /proc/sys/vm/swappiness

 

sysctl -w vm.swappiness=60

 

 

3.2.5 啓用 swap 分區

第一步:

swapon /mnt/swap

第二步:

echo 「/mnt/swap swap swap defaults 0 0」 >> /etc/fstab

 

 

3.2.6 再次使用cat /proc/swaps 查看swap分區是否啓動

cat /proc/swaps

 

能夠看到,swap分區已經啓用,如今經過 gitlab 進行操做會發現很流暢!

相關文章
相關標籤/搜索