环境: 192.168.88.69 rhel7(8G)
[root@server69 ~]# yum install curl policycoreutils-python openssh-server openssh-clients postfix -y [root@server69 ~]# systemctl enable postfix && systemctl start postfix #开启邮件服务 [root@server69 ~]# rz #上传gitlab rpm包 [root@server69 ~]# ls anaconda-ks.cfg gitlab-ce-13.9.3-ce.0.el7.x86_64.rpm [root@server69 ~]# rpm -ivh gitlab-ce-13.9.3-ce.0.el7.x86_64.rpm 警告:gitlab-ce-13.9.3-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:gitlab-ce-13.9.3-ce.0.el7 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! [root@server69 ~]# vim /etc/gitlab/gitlab.rb ##修改 gitlab 外部访问地址 32 external_url 'http://192.168.88.69' #32行改为自己的ip [root@server69 ~]# gitlab-ctl reconfigure #重新加载配置
访问 192.168.88.69,需要修改新的密码
随后填写用户名root和填写刚刚设定的密码
此处用QQ邮箱作为示例,打开这两处服务,拿到授权码并保持
[root@server69 ~]# vim /etc/gitlab/gitlab.rb #配置smtp邮箱服务 在89行后加入 gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "[email protected]" gitlab_rails['smtp_password'] = "填写授权码!" gitlab_rails['smtp_domain'] = "qq.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['gitlab_email_from'] = "[email protected]" [root@server69 ~]# gitlab-ctl reconfigure #重新加载配置文件 [root@server69 ~]# gitlab-rails console -------------------------------------------------------------------------------- Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux] GitLab: 13.9.3 (ea359c58edb) FOSS GitLab Shell: 13.17.0 PostgreSQL: 12.5 -------------------------------------------------------------------------------- Loading production environment (Rails 6.0.3.4) irb(main):001:0>irb(main):005:0> Notify.test_email('[email protected]', ' pekeka666 Message Subject', 'pekeka666 Message Body').deliver_now
至此gitlab邮件服务搭建成功
点击群组,新建群组
随后新建项目
点击新建文件,创建名为index.html,编写内容
修改用户密码 ,点击编辑用户
用普通会员登录gitlib,需要重新设定密码
点击群组,点击进入需要的群组pekeka
[root@server70 ~]# yum install git -y [root@server70 ~]# git clone http://192.168.88.69/pekeka/pekeka-pro.git 正克隆到 'pekeka-pro'... Username for 'http://192.168.88.69': pekeka1 Password for 'http://[email protected]': remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. [root@server70 ~]# ls anaconda-ks.cfg pekeka-pro [root@server70 ~]# cd pekeka-pro/ [root@server70 pekeka-pro]# ls index.html [root@server70 pekeka-pro]# cat index.html hello world [root@server70 pekeka-pro]# vim index.html [root@server70 pekeka-pro]# cat index.html hello world pekeka666 hhhhhhhhhh [root@server70 pekeka-pro]# git config --global user.name "pekeka1" [root@server70 pekeka-pro]# git config --global user.email "[email protected]" [root@server70 pekeka-pro]# git add index.html #添加文件到暂存区 [root@server70 pekeka-pro]# git commit -m "add" #提交文件到工作区 [root@server70 pekeka-pro]# git push #提交代码到 git 服务器上 Username for 'http://192.168.88.69': pekeka1 Password for 'http://[email protected]': Counting objects: 5, done. Writing objects: 100% (3/3), 255 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To http://192.168.88.69/pekeka/pekeka-pro.git 019b456..7c4eef3 master -> master