下面由centos系統入門教程欄目給大家介紹centos7搭建gitlab服務器的方法,希望對需要的朋友有所幫助!
CentOS7搭建Gitlab服務器
centos系統入門安裝必要的依賴
第一步:安裝ssh
yum?install?-y?curl?policycoreutils-pythonopenssh-server
第二步: 將SSH服務設置成開機自啟動并啟動SSH服務(若安裝并啟動,則可跳過此步);
sudo?systemctl?enable?sshd sudo?systemctl?start?sshd
第三步:安裝并啟動防火墻(若安裝并啟動,則可跳過此步);
yum?install?firewalld?systemd?-y service?firewalld?start
第四步:添加http服務到firewalld (–permanent表示永久生效);
firewall-cmd?--permanent?--add-service=http
第五步:重啟防火墻;
systemctl?reload?firewalld
第六步:將postfix服務設置成開機自啟動并啟動postfix;
systemctl?enable?postfix systemctl?start?postfix
第七步:檢查系統中是否已經安裝wget(若不存在,用yum安裝wget);
wget?-V?--檢查wget版本 yum?-y?install?wget?--yum安裝wget
CentOS安裝必要的依賴
第一步:wget下載gitlab(社區版);
wget?https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
第二步:安裝gitlab;
rpm?-i?gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
若出現下面錯誤,需要安裝 policycoreutils-python;
yum?-y?install?policycoreutils-python
第三步:修改gitlab配置文件,指定服務器ip和自定義端口;
vi?/etc/gitlab/gitlab.rb
修改URL:external_url ‘http://192.168.2.121:8081’
修改端口:nginx[‘listen_port’] = 8081
要修改unicorn的配置
第四步:重置并啟動GitLab;
重置配置:gitlab-ctl reconfigure
重啟gitlab服務:gitlab-ctl restart
第五步:訪問Gitlab,初次登錄,修改密碼;
初始用戶:root
初始密碼:5iveL!fe
若無法訪問,則可以查看端口是否被禁用;
查看端口狀態:netstat -lntp;若netstat命令不存在,安裝yum install net-tools -y,因為CentOS7 不包含net-tools,因此ifconfig命令也不可用,安裝net-tools后即可使用netstat、ifconfig命令;
防火墻開放端口:
firewall-cmd?--zone=public?--add-port=8081/tcp?--permanent
重新加載防火墻列表:
firewall-cmd?--reload