如需技术支持,请联系 shery@moneyslow.com
What is Snipe-IT?
Snipe-IT is a Free Open Source (FOSS) project built on Laravel. Snipe-IT was made for IT asset management, to enable IT departments to track who has which laptop, when it was purchased, which software licenses and accessories are available, and so on. - https://snipe-it.readme.io/docs
Installing Docker
Log into the Linux host
Run the following commands in a terminal window
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER
Running Snipe-IT
Continue with the following commands in terminal to setup and run Snipe-IT
# create working directories
sudo mkdir ~/docker/snipeit/{config,data} -p && sudo mkdir ~/docker/mariadb -p
# create snipeit network
docker network create snipeit
# download the base configuration
sudo wget -O ~/docker/snipeit/.env https://raw.githubusercontent.com/snipe/snipe-it/master/.env.example
# generate an app_key
docker run --rm snipe/snipe-it
# edit the .env file
sudo nano ~/docker/snipeit/.env
Scroll through the .env file, making sure to comment out the mysql connection details and change the following fields as needed
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=<%PASTED APP_KEY%>
APP_URL=null
APP_TIMEZONE='America/New_York'
APP_LOCALE=en
MAX_RESULTS=500
# --------------------------------------------
# REQUIRED: UPLOADED FILE STORAGE SETTINGS
# --------------------------------------------
PRIVATE_FILESYSTEM_DISK=local
PUBLIC_FILESYSTEM_DISK=local_public
# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=db
DB_DATABASE=snipe_it
DB_USERNAME=snipe_it_rw
DB_PASSWORD=Snip3-IT!
DB_PREFIX=null
# --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS
# --------------------------------------------
MAIL_DRIVER=smtp
MAIL_HOST=smtp.i12bretro.local
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=snipe-it@i12bretro.local
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=snipe-it@i12bretro.local
MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_AUTO_EMBED_METHOD='attachment'
Press CTRL+O, Enter, CTRL+X to write the changes to .env
Continue with the following commands in terminal
# set owner of docker directory
sudo chown "$USER":"$USER" ~/docker -R
# set permissions on docker directory
sudo chmod g+rwx "$HOME/docker" -R
# run the mariadb docker container
docker run -d --name mariadb --network snipeit --network-alias db -e MYSQL_ROOT_PASSWORD=r00tp@ss -e MYSQL_USER=snipe_it_rw -e MYSQL_PASSWORD=Snip3-IT! -e MYSQL_DATABASE=snipe_it -v ~/docker/mariadb:/var/lib/mysql --restart=unless-stopped mariadb:latest
# run the snipeit container
docker run -d --name snipeit -p 8000:80 --network snipeit --env-file=~/docker/snipeit/.env -v ~/docker/snipeit/data:/var/lib/snipeit -v ~/docker/snipeit/config:/config --restart=unless-stopped snipe/snipe-it:v5.1.7
Snipe-IT Web Installer
Open a web browser and navigate to http://DNSorIP:8000
Review the Pre-Flight Checks summary > Click the Next: Create Database Tables button
Once the database tables are created, Click the Next: Create User button
Create a user by inputting a site name, first name, last name, email address, username and password > Click the Next: Save User button
Welcome to Snipe-IT running on Docker