用GitLab构建自己的私人GitHub
目前,git是开发人员的必备技能之一,github的代码仓库管理系统是目前最好的,以下是构建专用github系统的过程。
下载gitlab:
官方网站: https://about.gitlab.com/install/
精简安装downloadagitlabomnibuspackage ) )。
安装千兆lab :
单击相应操作系统的图标,可查看详细的安装说明教程。
=====================
sudo apt-get update
sdoapt-get install-ycurlopenssh-server ca-certificates
sudo apt-get install -y postfix
curl https://packages.git lab.com/install/repositories/git lab-ee/script.deb.sh|sudo bash
Next,installthegitlabpackage.change https://git lab.example.comtotheurlatwhichyouwanttoaccessyourgitlabinstance.installllla.instatatince
sudo external _ URL=’ https://git lab.example.com ‘ apt-getinstallgitlab- ee
sudoyuminstall-ycurlpolicycoreutils-python OpenSSH-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd—- permanent—add-service=http
sudo firewall-cmd—- permanent—add-service=https
sudo systemctl reload firewalld
安装Postfix邮件通知功能
sudo yum install postfix
sudo系统启用postfix
sudo系统开始位置
2.addthegitlabpackagerepository。
curl https://packages.git lab.com/install/repositories/git lab-ee/script.rpm.sh|sudo bash
sudo external _ URL=’ https://git lab.example.com ‘ yum install-ygitlab- ee
=====================
然后,您可以使用浏览器直接访问http://ip登录管理
个性化配置和注意事项
使用自己的nignx:
$ apt-get install nginx #安装nginx
$ CD/etc/nginx/conf.dtouchgitlab-http.conf
Nginx gitlab-http.conf配置:
upstream gitlab-workhorse {
# server UNIX :/var/opt/git lab/git la B- work horse/socket;
server 127.0.0.1:8080;
}
upstream git la B- git-http-server {
server 127.0.0.1:8181;
}
服务器{
listen *:80;
server_name gitlab.guowei.com;
root/opt/git lab/embedded/service/git la B- rails/public;
client_max_body_size 0;
位置/{
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy _ set _ headerx-real-IP $ remote _ addr;
proxy _ set _ headerx-forwarded-for $ proxy _ add _ x _ forwarded _ for;
proxy _ set _ headerx-forwarded-proto http;
proxy _ pass http://git la B- work horse;
}
location ~ [-\/\w\.] \.git\/{
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy _ set _ headerx-real-IP $ remote _ addr;
proxy _ set _ headerx-forwarded-for $ proxy _ add _ x _ forwarded _ for;
proxy _ set _ headerx-forwarded-proto $ scheme;
proxy _ pass http://git la B- git-http-server;
}
location~~/[\w\.-]/[\w\.-] /资料档案库/archive {
client_max_body_size 0;
error_page 418=@git-http-server;
返回418;
}
location @git-http-server {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy _ set _ headerx-real-IP $ remote _ addr;
proxy _ set _ headerx-forwarded-for $ proxy _ add _ x _ forwarded _ for;
proxy _ set _ headerx-forwarded-proto $ scheme;
proxy _ pass http://git la B- git-http-server;
}
}
将gitlab设置为不使用nginx :
$ vim /etc/gitlab/gitlab.rb
# searchnginxfindnginx [ ‘ enable ‘ ]=true
# add
nginx[‘enable’]=false
git lab _ git _ http _ server [ ‘ listen _ network ‘ ]=’ TCP ‘
git lab _ git _ http _ server [ ‘ listen _ addr ‘ ]=’ 127.0.0.133608181 ‘
# nginx[‘enable’]=true
$ gitlab-ctl reconfigure #配置gitlab
重新启动$ gitlab-ctl restart #服务
卸载千兆实验室:
# stopgitlabandremoveitssupervisionprocess
sudo gitlab-ctl uninstall
# Debian/Ubuntu
sudo dpkg -r gitlab-ce
# Redhat/Centos
sudo rpm -e gitlab-ce
注意事项:
为了便于通过http操作git仓库,nginx具有8181端口的配置。 它与gitlab.rb上的gitlab_git_http_server配置相对应
下载仓库代码的问题,有的可以下载,有的不能下载
主要是国外库的问题,可以配置本地源以提高下载速度和成功率