Devops之gitlab安装测试

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务

gitlab下载链接

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

更新yum源

yum update -y

上传解压(比较慢...)

[root@docker ~]# rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm 
warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27e
ab47: NOKEYPreparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-10.0.0-ce.0.el7        ################################# [100%]
It 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 reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

根据提示修改配置文件

/etc/gitlab/gitlab.rb

#external_url 'http://gitlab.example.com' 将域名改成对应的ip地址 external_url 'http://192.168.1.38'

执行命令(配置东西有点多,不报错的话耐心等待)

gitlab-ctl reconfigure

......
    - execute the ruby block reload gitlab-monitor svlogd configuration
Recipe: gitlab::redis-exporter
  * ruby_block[reload redis-exporter svlogd configuration] action create
    - execute the ruby block reload redis-exporter svlogd configuration
Recipe: gitlab::prometheus
  * service[prometheus] action restart
    - restart service service[prometheus]
  * ruby_block[reload prometheus svlogd configuration] action create
    - execute the ruby block reload prometheus svlogd configuration
Recipe: gitlab::postgres-exporter
  * service[postgres-exporter] action restart
    - restart service service[postgres-exporter]
  * ruby_block[reload postgres-exporter svlogd configuration] action create
    - execute the ruby block reload postgres-exporter svlogd configuration

Running handlers:
Running handlers complete
Chef Client finished, 360/515 resources updated in 03 minutes 50 seconds
gitlab Reconfigured!
[root@docker ~]# 

启动gitlab服务


[root@docker ~]# gitlab-ctl restart
ok: run: gitaly: (pid 18240) 0s
ok: run: gitlab-monitor: (pid 18258) 1s
ok: run: gitlab-workhorse: (pid 18297) 0s
ok: run: logrotate: (pid 18305) 1s
ok: run: nginx: (pid 18310) 0s
ok: run: node-exporter: (pid 18313) 0s
ok: run: postgres-exporter: (pid 18318) 0s
ok: run: postgresql: (pid 18326) 0s
ok: run: prometheus: (pid 18338) 0s
ok: run: redis: (pid 18347) 1s
ok: run: redis-exporter: (pid 18352) 0s
ok: run: sidekiq: (pid 18357) 0s
ok: run: unicorn: (pid 18366) 0s
[root@docker ~]# systemctl stop firewalld

ip地址访问测试

默认用户是root,密码是刚才设置的

主页面

注册用户和创建项目管理页面

选择public级别,然后点击create project 会跳转到如下页面

测试上传文件

#安装git工具
[root@docker git]# yum install -y git
[root@docker ~]# mkdir /git
[root@docker ~]# cd git
#等到项目的目录
[root@docker git]# git clone http://192.168.1.38/yhd/yhd.git
Cloning into 'yhd'...
warning: You appear to have cloned an empty repository.
[root@docker git]# cd yhd/
#在项目中编辑或者上传文件到该目录下
[root@docker yhd]# echo 123456 > a.txt
[root@docker yhd]# ls
a.txt 
#添加文件到git中
[root@docker yhd]# git add a.txt 
[root@docker yhd]# git add *
#查看git上传文件的状态
[root@docker yhd]# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#	new file:   a.txt
#添加用户名和email地址
[root@docker yhd]# git config --global user.name "yhd"
[root@docker yhd]# git config --global user.email "yhd@163.com"
#提交文件
[root@docker yhd]# git push     #执行完看到下面提示需指明master,第一次提交需要执行master
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'http://192.168.1.38': yhd
Password for 'http://yhd@192.168.1.38': 
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date
[root@docker yhd]# git push origin master
Username for 'http://192.168.1.38': yhd
Password for 'http://yhd@192.168.1.38': 
Counting objects: 3, done.
Writing objects: 100% (3/3), 203 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.1.38/yhd/yhd.git
 * [new branch]      master -> master
[root@docker yhd]# 

页面查看文件是否提交成功

同一项目中再次提交不用执行master验证:

[root@docker yhd]# touch b.txt
[root@docker yhd]# echo test>b.txt
[root@docker yhd]# git add b.txt
[root@docker yhd]# git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   b.txt
#
[root@docker yhd]# git commit -m 'add b.txt'
[master e517e58] add b.txt
 1 file changed, 1 insertion(+)
 create mode 100644 b.txt
[root@docker yhd]# git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'http://192.168.1.38': yhd
Password for 'http://yhd@192.168.1.38': 
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 255 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.1.38/yhd/yhd.git
   572ed46..e517e58  master -> master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装和部署DevOps,您可以按照以下步骤进行操作: 1. 首先,确保您的系统满足DevOps的要求。这可能包括操作系统、硬件、软件和网络方面的要求。例如,您可能需要安装适当的操作系统,如Linux或Windows Server,并确保系统具备足够的内存、存储和计算能力。 2. 接下来,您需要选择适合您需求的DevOps工具集。常见的DevOps工具包括版本控制工具(如Git)、持续集成/持续交付工具(如Jenkins、Travis CI、GitLab CI/CD等)、配置管理工具(如Ansible、Puppet、Chef等)、容器化工具(如Docker、Kubernetes等)以及日志和监控工具等。根据您的项目需求和团队偏好,选择合适的工具集。 3. 安装和配置选定的DevOps工具。您可以根据每个工具的官方文档或社区资源来了解如何在您的系统上安装和配置这些工具。通常,您需要下载所需的软件包,并按照指南进行安装和配置。 4. 集成您的项目和代码到DevOps工具中。这可能涉及将您的代码存储库与版本控制工具集成,设置持续集成/持续交付流水线,配置自动化构建和部署等。您可以根据选定的工具和项目需求来设置适当的集成和自动化流程。 5. 测试和优化您的DevOps流程。确保您的持续集成/持续交付流水线正常工作,并能够在每个代码提交或版本发布时自动执行测试、构建和部署等任务。根据需要进行调整和优化,以提高流程效率和代码质量。 6. 建立监控和日志系统。为了及时发现和解决问题,您需要设置适当的监控和日志系统,以便实时跟踪应用程序和基础设施的状态。您可以使用各种监控工具和日志分析工具来帮助您收集和分析关键指标和日志数据。 以上是安装部署DevOps的一般步骤,具体的操作可能因您的项目需求和技术栈而有所不同。建议您参考各个工具的文档和教程,并与团队成员一起进行讨论和决策,以确保成功实施DevOps流程。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值