首页 > 编程知识 正文

gitlab搭建个人博客,部署gitlab

时间:2023-05-04 20:42:40 阅读:158409 作者:4425

文章1:git优势1.1:GitLab与GitHub差异1.2:Gitlab优势及应用场景1.gitlab主要服务配置1.4:GitLab工作流安装ssh1.1启动ssh服务器1.1 360关闭ix用于发送邮件通知1.4:wget的外联网插件1.5:配置域名2 :添加GitLab镜像源安装GitLab服务器2.1:添加GitLab镜像2.2: 修改的gitlab配置文件,使用服务器IP和自定义端口2.4:重新启动gitlab2.5: git lab常用命令2.6: git lab 2.7:查看git lab页2.8: 需要创建公共密钥验证2.813360副本id_rsa.pub公钥2.9:在gitlab主页上创建新的项目

GitLab介绍

git lab :一种基于git实现的在线代码仓库托管软件。 可以使用gitlab自己构建Github这样的系统。 一般用于在企业、学校等公司内部网络上构建git私服。

功能: Gitlab是一个代码管理平台,提供代码托管、审核提交和问题跟踪。 对软件工程的质量管理非常重要。 版本:千兆实验室

分为社区版(CE )和企业版(EE )。 配置:建议使用CPU2核、内存2G以上。

1 ) git的优点git是分布式的,而svn则不是

git可以在分布式本地使用。 可以自由保存各种历史。 不用担心污染服务器。 即使无法连接到服务器,也可以提交代码或查看日志。 GIT分支和SVN分支不同

在SVN中,分支实际上是版本库的副本,但由于git仓库是快照,因此切换git、合并分支等操作速度更快。 git有一个强大的代码仓库管理系统,名为- gitlab

您可以轻松管理权限和代码review,并创建和管理不同于project 1.1:GitLab和GitHub的GitHub分布式联机代码托管仓库。 个人版可以直接在线免费使用。 企业版是收费的,必须在服务器上安装Gitlab分布式在线代码仓库托管软件。 必须分为社区免费版和企业付费版安装在服务器上。 1.2:

产品差异化版本控制、离线同步和强大的分支管理功能

方便的GUI操作界面和强大的帐户权限管理功能

集成度高,集成了大多数开发工具以支持内置HA,从而实现高并发性和高可用性

1.千兆位lab的主要服务是配置Nginx静态Web服务器千兆位lab-work horse轻量级反向代理服务器千兆位lab-shell,用于处理千兆位命令和修改授权密钥列表

创建项目的Feature分支

编写代码并提交到分支

将项目推送到远程Gitlab服务器

进行代码检查,提交主分支合并申请

项目领导审查代码,确认合并申请

另一方面,要安装ssh ',请切换root用户' sudoyuminstall-ycurlpolicycoreutils-python OpenSSH-server 1.1, 将ssh服务器设置为启动sudosystemctlenablesshd 1.2:安装topfirewalld1.3:postfix并发送邮件通知sudo yum install postfix '设置启动选择Internet Site,然后按回车键。 使用服务器外部DNS在" mail name "中按enter键。 如果出现其他屏幕,请继续按enter键接受默认值。 1.4:外联网下载插件用于检查系统中是否安装了wget。 命令时,如果显示下图中与wget相关的版本的说明,则表示系统上已安装wget。 如果在报告系统中找不到命令,则表示未安装构件

[ root @ localhost~] # wget-vgnuwget 1.14使用linux-gnu进行编译。 digesthttpsipv6IRI large-filenlsntlmopiessl/OpenSSL wgetrc 3360/etc/wgetrc (系统)字符集: /usr/share/locale编译: gcc-d have _ config _ h-d system _ wgetrc='/etc/wgetrc '-dlocaledir='/usr/share/locale ' '

gcc-switches -m64 -mtune=generic 链接程序: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -lssl -lcrypto /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so -ldl -gldbbt -gldbbt -lidn -luuid -lpcre ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a '如果没有没有则安装'yum -y install wget 1.5:配置域名 vim /var/opt/gitlab/nginx/conf/gitlab-http.conf # 外网访问的端口,如果服务器已经有服务器占用了80,那么这里可以改成其它 listen *:8888; server_name gitlab.test.domain.com; set $http_host_with_default "gitlab.test.domain.com:8888";

补充说明:因为编译gitlab的配置 /etc/gitlab/gitlab.rb 时会重新生成这个自定义nginx 配置,所以只要 gitlab 的配置配得好,上面的nginx其实不需要自定义的。

二:添加GitLab镜像源并安装gitlab服务器 2.1:添加gitlab镜像 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm 2.2:安装gitlab rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm警告:gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEYIt looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ / /_/ / / /_/ /___/ /_/ / /_/ / ____/_/__/_____/__,_/_.___/ Thank you for installing GitLab!GitLab was unable to detect a valid hostname for your instance.Please configure a URL for your GitLab instance by setting `external_url`configuration in /etc/gitlab/gitlab.rb file.Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readmehttps://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md注意:虚拟机 centos7.0 使用rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm安装时提示无效依赖使用rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm --nodeps --force命令就可以了。加后面两个参数意义,安装时不再分析包之间的依赖关系而直接安装。 2.3:修改gitlab配置文件指定服务器IP和自定义端口 vim /etc/gitlab/gitlab.rb'修改服务器IP'external_url 'http://gitlab.test.domain.com:8888' 2.4:重启Gitlab gitlab-ctl reconfigure[root@localhost ~]# gitlab-ctl restart ok: run: gitaly: (pid 90905) 1sok: run: gitlab-monitor: (pid 90923) 0sok: run: gitlab-workhorse: (pid 90962) 1sok: run: logrotate: (pid 90973) 0sok: run: nginx: (pid 90985) 0sok: run: node-exporter: (pid 90994) 1sok: run: postgres-exporter: (pid 91000) 0sok: run: postgresql: (pid 91013) 1sok: run: prometheus: (pid 91021) 0sok: run: redis: (pid 91032) 1sok: run: redis-exporter: (pid 91036) 0sok: run: sidekiq: (pid 91050) 0sok: run: unicorn: (pid 91059) 0sok:run安装完毕 2.5:Gitlab常用命令 gitlab-ctl start # 启动所有 gitlab 组件; gitlab-ctl stop # 停止所有 gitlab 组件; gitlab-ctl restart # 重启所有 gitlab 组件; gitlab-ctl status # 查看服务状态; vim /etc/gitlab/gitlab.rb # 修改gitlab配置文件; gitlab-ctl reconfigure # 重新编译gitlab的配置; gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab; gitlab-ctl tail # 查看日志; gitlab-ctl tail nginx/gitlab_access.log 2.6:查看Gitlab版本 [root@localhost ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION10.0.0 2.7:访问Gitlab页面

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-q8I3vRvz-1604847030638)(C:UsersliuAppDataRoamingTyporatypora-user-imagesimage-20201108220546379.png)]

2.8:为了安全考虑,需要创建public key认证 [root@localhost ~]# ssh-keygen '一直回车即可'Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:2GhfkwCeGlrVv3agg8GCwR4P/MpAvQmUqxkCsgGHeJc root@localhost.localdomainThe key's randomart image is:+---[RSA 2048]----+|==+ .o. ||*=B.Eo o. ||+=oO=.o .. ||=.o=+oo+ .o. ||o=....+oS.+o ||o o ...o.o.. || .o . || || |+----[SHA256]-----+ 2.81:复制id_rsa.pub公钥 [root@localhost ~]# cat .ssh/id_rsa.pubssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSFM9UWIvl6JVfvsy6gsHwUYPdK4osBXnAUjD+XEbARs7PIigVFzkCCw+BwL3cIZlNQNcOTZQ+lhhSmptBdXQsjsHL5ya5RRNoPm7d4RosXoiGxdGPQu3mxUi99RT8rjOWyljjou5UcuDA0SoHgpYZo8qJxgNUl/5F/71DHkwUTd4VDR2LLoLQhbRLOFrjywQPurjfMe0kZ8dlmFfYud6W4IMfX/BOiLmma3MXO7Iugw5A5QIdVNRGR+RPuIC0wz/O4kZ5elyrIFgX5miWRSTvx3hENbpWgRYO05uZXCJ2ImJ7MsB0t6z2KxRP4HevPNDJ623G+gqgr4CiFYXgitL3 root@localhost.localdomain

2.9:在Gitlab的主页新建一个Project

本次安装已结束

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。