安裝Git
在Linux系統中是需要編譯源碼的,首先下載所需要的依賴:
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
方法一
下載:
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.39.1.tar.gz
卸載舊版本git,(安裝依賴時會自動安裝git,所以需要卸載舊版本):
yum -y remove git
解壓:
tar -zxvf git-2.39.1.tar.gz
進入解壓后的git文件夾
cd git-2.39.1.tar.gz
編譯git源碼
make prefix=/usr all
安裝git至usr路徑
make prefix=/usr install
默認位置,不用加環境變量
查看版本:
git --version
git version 2.39.1
方法二
安裝yum源:
yum install https://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
這個源會存在于/var/tmp/yum-root-5lDDzM/中
然后在安裝,就是最新版本
yum install git -y
查看版本:
git --version
git version 2.39.1
安裝gitlab
安裝依賴:
yum install curl openssh-server openssh-clients postfix policycoreutils-python
啟動sshd并設置開機自啟
systemctl enable sshd
systemctl start sshd
方法一
下載gitlab:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.8.0-ce.0.el7.x86_64.rpm
安裝:
rpm -ivh gitlab-ce-15.8.0-ce.0.el7.x86_64.rpm
方法二(極狐官方)
配置極狐GitLab 軟件源鏡像:
curl -fsSL https://packages.gitlab.cn/repository/raw/scripts/setup.sh | /bin/bash
接下來,安裝極狐GitLab。確保您已正確設置您的 DNS,并更改 https://gitlab.example.com 為您要訪問極狐GitLab 實例的 URL。安裝包將在該 URL 上自動配置和啟動極狐GitLab。
對于 https 站點,極狐GitLab 將使用 Let’s Encrypt 自動請求 SSL 證書,這需要有效的主機名和入站 HTTP 訪問。您也可以使用自己的證書或僅使用 http://(不帶s)。
如果您想為初始管理員用戶(root)指定自定義密碼,請查看文檔。如果未指定密碼,將自動生成隨機密碼。
執行如下命令開始安裝:
EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-jh
訪問極狐GitLab 實例并登錄
除非您在安裝過程中指定了自定義密碼,否則將隨機生成一個密碼并存儲在 /etc/gitlab/initial_root_password
文件中(出于安全原因,24 小時后,此文件會被第一次 gitlab-ctl reconfigure 自動刪除,因此若使用隨機密碼登錄,建議安裝成功初始登錄成功之后,立即修改初始密碼)。使用此密碼和用戶名 root 登錄。
修改端口號:
vi /etc/gitlab/gitlab.rb
external_url ' http://192.168.0.1:8188 '
防火墻新增端口8188:
firewall-cmd --zone=public --add-port=8188/tcp --permanent
firewall-cmd – reload
配置GitLab(配置完自動啟動,默認賬號root):
gitlab-ctl reconfigure
開啟重啟關閉:
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
登錄gitlab
瀏覽器訪問http://192.168.0.1:8188/
gitlab管理員賬號root,而密碼在一個自動生成的文件 /etc/gitlab/initial_root_password 中(密碼不會含空格),且會在 24 小時后自動被刪除。
通過cat /etc/gitlab/initial_root_password找到密碼進行登錄
成功登錄的頁面
修改一下密碼http://192.168.0.1:8188/admin/users/root/edit