孤雪飘寒 2019-06-25
github虽好,不过因为访问速度偶尔抽风
如果用来学习git和测试一些git命令可能有点浪费了,这里我们自己架设一个gitlab来学习一些不常规的git命令等
github私有仓库需要费用,gitlab自己架设不仅适合内部开发,还可以有很多好处
yum install -y curl openssh-server openssh-clients cronie lokkit lokkit -s http -s ssh 或 iptables -A INPUT -p tcp --dport 8090 -j ACCEPT iptables -A INPUT -p tcp --dport 22 -j ACCEPT service iptables save
yum install postfix service postfix start chkconfig postfix on
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install -y gitlab-ce
gitlab-ctl reconfigure gitlab-ctl start
http://ip/ #默认是root和root密码即可登录
vim /etc/gitlab/gitlab.rb #unicorn['port'] = 8080 修改 8070 默认是注释的去掉前面的# unicorn['port'] = 8070 #nginx['listen_port'] = nil 修改 8090 默认是注释的去掉前面的# nginx['listen_port'] = 8090
vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb #listen "127.0.0.1:8080", :tcp_nopush => true listen "127.0.0.1:8070", :tcp_nopush => true
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf #listen *:80; listen *:8090;
gitlab-ctl reconfigure
gitlab-ctl restart
$ sudo vi /etc/gitlab/gitlab.rb # Change the external_url to the address your users will type in their browser external_url 'http://xxhost.com' #Sending application email via SMTP gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.163.com" gitlab_rails['smtp_port'] = 25 gitlab_rails['smtp_user_name'] = "[email protected]" gitlab_rails['smtp_password'] = "xxpassword" gitlab_rails['smtp_domain'] = "163.com" gitlab_rails['smtp_authentication'] = :login gitlab_rails['smtp_enable_starttls_auto'] = true ##修改gitlab配置的发信人 gitlab_rails['gitlab_email_from'] = "[email protected]" user["git_user_email"] = "[email protected]"