一、CentOS 7 GitLab搭建前的準備工作
1、安裝CentOS 7操作系統
首先,我們需要安裝CentOS 7操作系統。可以從CentOS官方網站上下載CentOS 7的ISO鏡像文件,並在需要安裝的電腦上將其燒錄至U盤或DVD中,進行安裝。
https://www.centos.org/download/
2、安裝必要的軟件包
接下來,我們需要安裝一些必要的軟件包,包括curl, policycoreutils-python, openssh-server, postfix等。
yum install -y curl policycoreutils-python openssh-server postfix
3、添加鏡像源
由於默認的CentOS 7源在國內訪問速度較慢,建議添加阿里雲鏡像源,以提高下載速度。
curl -sS https://mirrors.aliyun.com/repo/Centos-7.repo | tee /etc/yum.repos.d/CentOS-Base.repo
二、CentOS 7上安裝GitLab
1、添加GitLab鏡像源
在CentOS 7上安裝GitLab,需要先添加GitLab官方鏡像源。
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
2、安裝GitLab Community Edition
使用yum來安裝GitLab Community Edition。
sudo yum install gitlab-ce
3、配置GitLab
默認情況下,GitLab會監聽80和443端口。如果防火牆沒有關閉,需要添加HTTP和HTTPS服務。
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
接下來,通過修改/etc/gitlab/gitlab.rb配置文件來修改GitLab的某些設置。
sudo nano /etc/gitlab/gitlab.rb
修改external_url,指定GitLab的URL:
external_url 'http://192.168.0.100'
在最後添加以下內容,以啟用HTTPS加密:
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.key"
4、啟動GitLab
完成配置後,啟動GitLab服務。
sudo gitlab-ctl reconfigure
如果沒有錯誤提示,則表示GitLab安裝成功。
三、CentOS 7上安裝SQL Lab
1、安裝Python和pip
SQL Lab需要依賴Python和pip。
sudo yum install -y python-pip
2、安裝SQL Lab
使用pip來安裝SQL Lab。
sudo pip install apache-superset
3、初始化數據庫
使用superset db upgrade命令,初始化SQL Lab的後台數據庫。
superset db upgrade
4、啟動SQL Lab
啟動SQL Lab服務。
superset runserver -p 8088
5、訪問SQL Lab
訪問http://localhost:8088,即可進入SQL Lab的web界面。在這裡,您可以創建連接到不同數據源的數據。
四、CentOS 7上安裝Rancher
1、添加Rancher鏡像源
在CentOS 7上安裝Rancher,需要先添加Rancher官方鏡像源。
sudo nano /etc/yum.repos.d/rancher.repo
在文件中添加如下內容:
[rancher-rhel7]
name=Rancher RHEL 7 - $basearch
baseurl=https://releases.rancher.com/install-docker/17.03.2.sh
enabled=1
gpgcheck=0
2、安裝Docker和docker-compose
Rancher需要依賴Docker和docker-compose來運行。
sudo yum install -y docker docker-compose
3、啟動Docker
啟用並啟動Docker服務。
sudo systemctl enable docker
sudo systemctl start docker
4、啟動Rancher服務
使用docker-compose來啟動Rancher服務。
sudo docker-compose up -d rancher-server
5、訪問Rancher
訪問http://ip_address:8080,即可進入Rancher的web界面。在這裡,您可以管理容器、部署應用程序等。
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/193814.html