centos7中gitlab服务部署

一、安装

yum install -y curl policycoreutils openssh-server openssh-clients

yum install -y postfix

systemctl enable sshd  &&  systemctl start sshd

systemctl enable postfix  &&  systemctl start postfix

firewall-cmd --permanent --add-service=http

systemctl reload firewalld

在https://packages.gitlab.com/gitlab/gitlab-ce/中找到需要安装的版本,添加源

例如 gitlab-ce 版:

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

yum install -y gitlab-ce-11.1.0-ce.0.el7.x86_64

二、配置

修改默认的gitlab 相关端口

修改/etc/gitlab/gitlab.rb

vim /etc/gitlab/gitlab.rb

#unicorn['port'] = 80 修改 8080  默认是注释的去掉前面的#
unicorn['port'] = 8080
#nginx['listen_port'] = nil 修改 8088  默认是注释的去掉前面的#
nginx['listen_port'] = 8088

修改/var/opt/gitlab/gitlab-rails/etc/unicorn.rb

vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb

#listen "127.0.0.1:80", :tcp_nopush => true
listen "127.0.0.1:8080", :tcp_nopush => true

修改默认的gitlab nginx的web服务80端 /var/opt/gitlab/nginx/conf/gitlab-http.conf

vim /var/opt/gitlab/nginx/conf/gitlab-http.conf

#listen *:80;
listen *:8088;

配置smtp邮件发送

$ 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'] = "mypwd"
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]"

重新配置gitlab

gitlab-ctl reconfigure

重新启动gitlab

gitlab-ctl restart

三、使用 

1.使用gitlab用户登陆后,使用 new project 创建新项目

2.在本地创建项目路径(项目文件夹)后,在此路径下执行 git bush here(windows:在此文件夹中,右键菜单,git bush here )

3.在弹出的git bash中,初始化本地git仓库

git init

4.添加远程仓库源(前面在gitlab中创建的项目git地址)

git remote add origin http://10.0.0.11:8088/user1/demo.git

 5.推送变更至远程仓库对应的分支

git push -u origin master

 

你可能感兴趣的:(centos7中gitlab服务部署)