2018--- (Centos7) gitlab伺服器搭建與使用
一、註冊
二、安裝和配置依賴項 (必需)
1.安裝軟體
sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
2.防火牆設定
sudo firewall-cmd –permanent –add-service=http
sudo systemctl reload firewalld
3.安裝postfix傳送通知郵件。(可跳過)
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
4.新增gitlab庫及安裝包。
yum repolist 檢視庫中是否有包
5.安裝gitlab包
官方方法:(安裝gitlab包。改變http://gitlab.example.com
的URL為你想訪問的你的gitlab例項。安裝將自動配置和URL開始gitlab。HTTPS需要在安裝後附加配置)
sudo EXTERNAL_URL=”http://gitlab.example.com” yum install -y gitlab-ee
我的操作:
sudo yum install gitlab-ce 或 yum -y install gitlab-ce-8.14.4-ce.0.el7.x86_64.rpm
sudo gitlab-ctl reconfigure 自動配置檔案許可權,安裝資料庫(安裝的時間很長)
三、訪問
瀏覽器訪問gitlab伺服器網址 (GITLAB佔用80埠,訪問時直接訪問IP就可以
,第一次會讓你確認root賬戶登入的密碼)
接著,輸入root ,及第一次設的密碼即可
四、建立專案
此專案的儲存庫是空的。
如果已經有檔案,可以使用下面的命令列指令來推送它們。
否則,你可以開始新增一個自述,許可證,或gitignore這個專案。
當主分支被自動保護時,您將需要擁有或擁有初始推送的主許可權級別。
它將根據預定義的CI / CD配置自動構建、測試和部署應用程式。
Command line instructions
1.Git的全域性設定
git config –global user.name “Administrator”
git config –global user.email “[email protected]”
2.建立一個新的儲存庫
git clone [email protected]:root/ali.git
cd ali
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master
3.現有資料夾方式
cd existing_folder
git init
git remote add origin [email protected]:root/ali.git
git add .
git commit -m “Initial commit”
git push -u origin master
4.現有Git倉庫方式
cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:root/ali.git
git push -u origin –all
git push -u origin –tags
五、推送SSH祕鑰
2.客戶端生成祕鑰
ssh-keygen
cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Gprw28nQpAzIstXUSBMotDjSqfZ1sA2nKwaYxIpidvAnAiO1nBwNNMW+iDO81ByV/EYAsMs2ZS+NCp6sqttdSlhGgSuc2wbCACx1V+wmqi+hU4AFduEkG1CEbIVUZsaF3WLHVl4Vegb8T6Z5qJSKXa7GW4Vt1pDKM2RkwLrcjetDubLEL61B+FCHn2HK4C8JUOeChzvdgH0hs5GE9IsO31jctmQE/bjM0gAjNd37qoRDe96+ghiWrObPkZc9BpiOseMc74mlJwS7IWvUvA9PlRJHxWYw9tEKS7ElN52BYdOZTKzUxMCZgkcpo12cJzd5sMLY/KV1sTaGkEOEfaoX [email protected]
3上傳祕鑰
4檢視祕鑰
5連結地址 用於命令列,或客戶端程式進行下載使用。
六、gitlab 開啟,關閉
開啟
sudo gitlab-ctl start
關閉
sudo gitlab-ctl stop
重啟
sudo gitlab-ctl restart
結尾:檔案共享
1.cat script.rpm.sh 此檔案在此有轉碼問題,將其全部拉下複製貼上到文件,即可用
#!/bin/bash
unknown_os ()
{
echo "Unfortunately, your operating system distribution and version are not supported by this script."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version"
echo
echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
echo
echo "Please email [email protected] and let us know if you run into any issues."
exit 1
}
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
yum install -d0 -e0 -y curl
fi
}
detect_os ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
if [ -e /etc/os-release ]; then
. /etc/os-release
os=${ID}
if [ "${os}" = "poky" ]; then
dist=`echo ${VERSION_ID}`
elif [ "${os}" = "sles" ]; then
dist=`echo ${VERSION_ID}`
elif [ "${os}" = "opensuse" ]; then
dist=`echo ${VERSION_ID}`
else
dist=`echo ${VERSION_ID} | awk -F '.' '{ print $1 }'`
fi
elif [ `which lsb_release 2>/dev/null` ]; then
# get major version (e.g. '5' or '6')
dist=`lsb_release -r | cut -f2 | awk -F '.' '{ print $1 }'`
# get os (e.g. 'centos', 'redhatenterpriseserver', etc)
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`
elif [ -e /etc/oracle-release ]; then
dist=`cut -f5 --delimiter=' ' /etc/oracle-release | awk -F '.' '{ print $1 }'`
os='ol'
elif [ -e /etc/fedora-release ]; then
dist=`cut -f3 --delimiter=' ' /etc/fedora-release`
os='fedora'
elif [ -e /etc/redhat-release ]; then
os_hint=`cat /etc/redhat-release | awk '{ print tolower($1) }'`
if [ "${os_hint}" = "centos" ]; then
dist=`cat /etc/redhat-release | awk '{ print $3 }' | awk -F '.' '{ print $1 }'`
os='centos'
elif [ "${os_hint}" = "scientific" ]; then
dist=`cat /etc/redhat-release | awk '{ print $4 }' | awk -F '.' '{ print $1 }'`
os='scientific'
else
dist=`cat /etc/redhat-release | awk '{ print tolower($7) }' | cut -f1 --delimiter='.'`
os='redhatenterpriseserver'
fi
else
aws=`grep -q Amazon /etc/issue`
if [ "$?" = "0" ]; then
dist='6'
os='aws'
else
unknown_os
fi
fi
fi
if [[ ( -z "${os}" ) || ( -z "${dist}" ) ]]; then
unknown_os
fi
# remove whitespace from OS and dist name
os="${os// /}"
dist="${dist// /}"
echo "Detected operating system as ${os}/${dist}."
}
finalize_yum_repo ()
{
echo "Installing pygpgme to verify GPG signatures..."
yum install -y pygpgme --disablerepo='gitlab_gitlab-ce'
pypgpme_check=`rpm -qa | grep -qw pygpgme`
if [ "$?" != "0" ]; then
echo
echo "WARNING: "
echo "The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. "
echo "To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. "
echo "More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F"
echo
# set the repo_gpgcheck option to 0
sed -i'' 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/gitlab_gitlab-ce.repo
fi
echo "Installing yum-utils..."
yum install -y yum-utils --disablerepo='gitlab_gitlab-ce'
yum_utils_check=`rpm -qa | grep -qw yum-utils`
if [ "$?" != "0" ]; then
echo
echo "WARNING: "
echo "The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features."
echo
fi
echo "Generating yum cache for gitlab_gitlab-ce..."
yum -q makecache -y --disablerepo='*' --enablerepo='gitlab_gitlab-ce'
}
finalize_zypper_repo ()
{
zypper --gpg-auto-import-keys refresh gitlab_gitlab-ce
}
main ()
{
detect_os
curl_check
yum_repo_config_url="https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=${os}&dist=${dist}&source=script"
if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then
yum_repo_path=/etc/zypp/repos.d/gitlab_gitlab-ce.repo
else
yum_repo_path=/etc/yum.repos.d/gitlab_gitlab-ce.repo
fi
echo "Downloading repository file: ${yum_repo_config_url}"
curl -sSf "${yum_repo_config_url}" > $yum_repo_path
curl_exit_code=$?
if [ "$curl_exit_code" = "22" ]; then
echo
echo
echo -n "Unable to download repo config from: "
echo "${yum_repo_config_url}"
echo
echo "This usually happens if your operating system is not supported by "
echo "packagecloud.io, or this script's OS detection failed."
echo
echo "You can override the OS detection by setting os= and dist= prior to running this script."
echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version"
echo
echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
echo
echo "If you are running a supported OS, please email [email protected] and report this."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
elif [ "$curl_exit_code" = "35" -o "$curl_exit_code" = "60" ]; then
echo
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${yum_repo_config_url}"
echo
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact [email protected] with information about your system for help."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
elif [ "$curl_exit_code" -gt "0" ]; then
echo
echo "Unable to run: "
echo " curl ${yum_repo_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $yum_repo_path ] && rm $yum_repo_path
exit 1
else
echo "done."
fi
if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then
finalize_zypper_repo
else
finalize_yum_repo
fi
echo
echo "The repository is setup! You can now install packages."
}
main
2.cat gitlab_gitlab-ce.repo
[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
相關推薦
2018--- (Centos7) gitlab伺服器搭建與使用
一、註冊 二、安裝和配置依賴項 (必需) 1.安裝軟體 sudo yum install curl policycoreutils openssh-server openssh-clients sudo systemctl enable ss
GitLab程式碼管理伺服器搭建與配置
Git是一個應用很廣泛的程式碼管理工具,可以說,寫程式碼不用它,我都無法想象了,哈哈~ 對於企業來說,將程式碼託管在GitHub或BitBucket始終不太好,除非你想要將它開源,否則還是自己搭建伺服器來管理比較好,而GitLab就是這樣一款產品
gitlab的搭建與漢化
x86 新版 sta rpm text vim 新版本 embed 配置 gitlab的搭建:內存最好2G以上 yum -y install curl unzip policycoreutils git wget 安裝相關依賴包 所有gitlab rpm包的
伺服器搭建與管理(9-1)
1.伺服器: 192.168.9.106 admin 192.168.9.107 node1 192.168.9.108 node2 2.建立deph賬號並賦予sudo許可權:(3臺) 建立賬號 [[email protected] ~]# mkdir /app/userhome -p [[e
伺服器搭建與管理(9)
伺服器官網手冊 http://docs.ceph.org.cn/start/quick-ceph-deploy/ 在 CentOS 上,可以執行下列命令[[email protected] ~]# sudo yum install -y yum-utils[[email protecte
Linux:Samba檔案共享伺服器搭建與訪問
本文連結: https://blog.csdn.net/xietansheng/article/details/83932033 Samba 是 Linux 和 Unix 系統上實現 SMB協議 的一款免費軟體,能在 Windows、Linux、Mac 系統上訪問 Linux 系統上
centos7 dns伺服器搭建
DNS,全稱Domain Name System,即域名解析系統。 DNS幫助使用者在網際網路上尋找路徑。在網際網路上的每一個計算機都擁有一個唯一的地址,稱作“IP地址”(即網際網路協議地址) DNS功能 每個IP地址都可以有一個主機名,主機名由一個或多個字串組成,字
gitlab伺服器搭建
【版權宣告:本文為博主原創文章,未經博主允許不得轉載】 ================================================================== 執行環境:Ubuntu 18.04 LTS 64bit Linux 4.15.0-34-generic x86
樹莓派-FTP伺服器搭建與配置
1.安裝vsftpd sudo apt-get install vsftpd 2.啟用FTP服務 sudo service vsftpd start 3.編輯vsftpd的配置檔案,並自定義FTP位置 sudo nano /etc/vsftpd.conf 依照個人所需對以下選項進行定義,如需使用則
DNS伺服器搭建與配置
DNS服務簡介: DNS(Domain Name System–域名系統),是因特網的一項服務。它作為將域名和IP地址相互對映的一個分散式資料庫,能夠使人更方便地訪問網際網路。是一個應用層的協議DNS使用TCP和UDP埠53。 DNS是一個分散式資料庫,命名系統
Ubuntu 18.04 ssh伺服器搭建與配置
環境: 虛擬機器下的:Ubantu18.04 遠端連線工具:xshell 方法: 1.更新源列表 sudo apt-get update 2.安裝openssh-client
Linux下FTP伺服器搭建與配置
環境檢查 [[email protected] ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [[email protected] ~]# uname -r 2.6.32-696.el6.x86_64
騰訊雲CentOS7.5伺服器搭建簡單的圖片伺服器!
下載nginx和vsftpd[下載也可以通過二進位制包的方式,這裡用yum] yum install nginx vsftpd -y 修改相關的配置檔案 1.修改vsftpd的配置檔案 vim /etc/vsftpd/vsftpd.conf 關閉匿名登入FTP
實戰Samba伺服器搭建與進階完整版
實戰Samba伺服器搭建與進階完整版 基礎介紹 smb協議簡介 samba軟體包及核心程序 samba服務 應用場景 實戰samba伺服器搭建 檢查軟體 配置檔案 企業需求 實
CentOS下Git伺服器搭建與客戶端(windows和centos)搭建
一.伺服器端 1.yum安裝Git伺服器 yum install -y git 2.建立一個git使用者,用來執行git服務 useradd git 3.建立客戶端登入證書 注,收集所有需要登入的使用者的公鑰,就是他們自己生成的id_rsa.pub檔案,把所有公鑰複製到/
centos7 svn伺服器搭建
所有的操作都是在root下,而且關閉selinux/iptables 即/etc/sysconfig/selinux 和 /etc/sysconfig/iptable 1:安裝svn伺服器所需軟體 #yum install subversion mysql-server h
Linux CentOS 伺服器搭建與初始化配置圖文詳解
轉載自:http://www.linuxidc.com/Linux/2017-07/145878.htm 這幾天對伺服器興趣賊為濃厚,在虛擬機器上裝了一個CentOS7玩了玩,遇到過很多問題,比如網絡卡驅動設定,不能ping 等等問題,然後掏錢買個ECS搭伺服器玩玩,
centos7 SVN伺服器搭建記錄
本問介紹svn伺服器的搭建步驟及配置方法,大部分內容來源於網路,在實際配置過程中也遇到一些坑,在此簡單記錄一下。 安裝 $ sudo yum install subversion 檢視安裝所在目錄 $ which svnserve 可以看到安裝
ISCSI伺服器搭建與配置
ISCSI服務簡介 ISCSI簡介: iSCSI( Internet Small Computer System Interface 網際網路小型計算機系統介面) 技術是一種新儲存技術,該技術是將現有的SCSI介面與乙太網技術相結合,使伺服器可與使用IP網路的儲
centOS7搭建好GitLab伺服器後漢化(圖文結合&過程可能出錯的解決方案)
今天試著將安裝好的Gitlab伺服器漢化成中文,畢竟大家一起使用時,中文大家更容易上手。首先之前搭建的Gitlab步驟可以看以下部落格: https://blog.csdn.net/JJBOOM425/article/details/83997541 伺服器原本頁面: