snipe-it介绍
在IT行业中,需要完整的生命周期跟踪资产的资产管理,包括采购,维护,存储和处置。Snipe-IT是专为IT资产管理而设计的免费开源应用程序,提供基于Web的界面,用于跟踪许可证,附件,耗材和组件。Snipe-IT包括具有可配置组级权限的用户帐户,可自定义的报告功能以及用于从命令行或第三方应用程序连接,管理和扩展Snipe-IT的JSON REST API。在本教程中,将教您将下载,安装和配置Snipe-IT,然后您将创建一个管理员用户帐户,以便首次登录Snipe-IT。
1.环境概括
内核版本:
物理机:vmware[1G、20G、单核]
2.linux环境配置,卸载旧版本docker
-
$ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
3.使用docker仓库进行安装
- 设置仓库
1.在新主机首次安装Docker Engine-Community之前,需要设置Docker仓库,之后,便可以从仓库中安装更新Docker。
2.安装所需的软件包yum-utils 提供了 yum-config-manager ,并且 device mapper 存储驱动程序需要device-mapper-persistent-data 和 lvm2。
-
$ sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
4.添加sinpe-it官方仓库,稳定仓库
-
$ sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
5. 安装Docker Engine-Community
安装最新版本的 Docker Engine-Community 和 containerd
-
$ sudo yum install docker-ce docker-ce-cli containerd.io
6.启动并加入开机自启动
-
$ sudo systemctl enable docker
-
$ sudo systemctl start docker
7.通过运行 hello-world 映像来验证是否正确安装了 Docker Engine-Community (测试是否陈功安装docker)此步骤可忽略.
-
$ sudo docker run helllo-world
-
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:53f1bbee2f52c39e41682ee1d388285290c5c8a76cc92b42687eecf38e0af3f0 Status: Downloaded newer image for hello-world:latest WARNING: IPv4 forwarding is disabled. Networking will not work. Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
8.有client和service两部分表示docker安装启动都成功了(测试docker是否安装成功)可忽略.
-
$ docker version
-
Client: Docker Engine - Community Version: 20.10.14 API version: 1.41 Go version: go1.16.15 Git commit: a224086 Built: Thu Mar 24 01:49:57 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.14 API version: 1.41 (minimum version 1.12) Go version: go1.16.15 Git commit: 87a90dc Built: Thu Mar 24 01:48:24 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.5.11 GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8 runc: Version: 1.0.3 GitCommit: v1.0.3-0-gf46b6ba docker-init: Version: 0.19.0 GitCommit: de40ad0
9.安装snipe-it
- 第一步:拉取最新snipe镜像源
-
$ docker pull snipe/snipe-it
- 第二步:编辑链接配置文件
-
$ sudo mkdir /root/snipe-mysqlsudo ##编辑配置文件存储位置
-
$ vim /root/my_env_file ##编辑配置文件 # Mysql Parameters //文件头部 MYSQL_ROOT_PASSWORD="123456" //数据库root密码 MYSQL_DATABASE=snipeit //数据库库名 MYSQL_USER=snipeit //数据库用户名 MYSQL_PASSWORD="123456" //数据库用户名密码 # Snipe-IT Settings //snipe-it 头部 APP_ENV=production //env文件生产 APP_DEBUG=false //调试时候改成 "true" APP_KEY=<File in Later!> //填入生成密钥 APP_URL=http://192.168.0.254:8081 //访问地址,此处填入自己的ip地址,端口号自定 APP_TIMEZONE=US/Pacific //位置 APP_LOCALE=en //语言
10.部署Docker-sinpe-it 数据库
-
docker run --name snipe-mysql --env-file=/root/my_env_file --mount source=snipesql-vol,target=/var/lib/mysql -d -P mysql:5.6
11.生产密钥
-
$ docker run --rm snipe/snipe-it
-
Please re-run this container with an environment variable $APP_KEY\ An example APP_KEY you could use is:base64:O1qSkakRiS5v9txv7uAoREIwH2YWpnMmTVpe2FUPP+U=
//将base64复制到 root/my_env_file APP_KEY设置里
12.依赖文件部署snipe-it Docker
-
docker run -d -p 8081:80 --name="snipeit" --link snipe-mysql:mysql --env-file=/root/my_env_file --mount source=snipe-vol,dst=/var/lib/snipeit snipe/snipe-it
13.部署完成后浏览器访问ip+端口会提示数据库报错
- 进入容器
docker exec -it snip-mysql /bin/bash
2.部署数据库密码跳过文件
echo -e "[mysqld]\nskip-grant-tables" >> /etc/mysql/my.cnf
14.浏览
欢迎大家讨论,制作不易,点赞三连
小饼