Skip to main content

Snipe-IT@Debian

Initial installation (as normal user!)

Install Composer

cd ~/

# follow installations from https://getcomposer.org/download/

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"

sudo mv composer.phar /usr/local/bin/composer

Install package dependencies

sudo apt install git php php-bcmath php-zip

Download application and build it

mkdir ~/downloads
cd ~/downloads/
git clone https://github.com/snipe/snipe-it
cd snipe-it
composer install --no-dev --prefer-source
cd ..

Move application to corresponding destination (webserver virtualhosts' directories)

sudo su
export dir="/var/www/garage.2dz.fi/"
mkdir -p ${dir}
# cd /home/anton/downloads/
mv snipe-it ${dir}
cd ${dir}/snipe-it/
ls -la
cp .env.example .env

Configure application (database connection, storage)

vi .env

Create additional directories

mkdir -p ${dir}/snipe-it/storage/logs/
mkdir -p ${dir}/snipe-it/storage/app/backup-temp

Set permissions

sudo su
export owner="anton"
export webuser="www-data"
export dir="/var/www/garage.2dz.fi"

chown -R ${webuser}:${webuser} ${dir}/snipe-it/storage/
chown -R ${webuser}:${webuser} ${dir}/snipe-it/public/uploads/
chown -R ${webuser}:${webuser} ${dir}/snipe-it/bootstrap/cache/

find ${dir}/snipe-it/storage/         -type d -exec chmod 0770 {} \+
find ${dir}/snipe-it/storage/         -type f -exec chmod 0660 {} \+
find ${dir}/snipe-it/public/uploads/  -type d -exec chmod 0770 {} \+
find ${dir}/snipe-it/public/uploads/  -type f -exec chmod 0660 {} \+
find ${dir}/snipe-it/bootstrap/cache/ -type d -exec chmod 0770 {} \+
find ${dir}/snipe-it/bootstrap/cache/ -type f -exec chmod 0660 {} \+

Upgrading existing instance

Write down current version in WebUI

https://garage.2dz.fi/admin
Before:
Snipe-IT version: v7.1.15 build 16052 (g25bfd3e84)
Laravel Version: 10.48.23

After:
Snipe-IT version:  v7.1.16 build 16564 (gfb857ccf5)
Laravel Version: 10.48.23 
sudo su
export owner="anton"
export webuser="www-data"
export dir="/var/www/garage.2dz.fi/"

# backup
cd $dir
# TODO: exclude .git and backup/*.zip
tar -czvf snipe-it.$(date +%Y-%m-%d.%H%M).tgz snipe-it/

# update
exit
cd ${dir}/snipe-it/
git pull
php upgrade.php

Special attention to Database migrations, they must proceed successfully, if any:

STEP 9: Migrating database:
--------------------------------------------------------
   INFO  Running migrations.
  2023_08_23_232739_create_report_templates_table ....................................................................................... 426ms DONE
  2024_10_31_212512_update_new_and_drop_old_barcode_settings ............................................................................ 199ms DONE
  2025_01_06_210534_change_report_templates_options_to_column_text_field ................................................................. 88ms DONE
  2025_01_07_172419_fix_label_types_on_settings_table ................................................................................... 122ms DONE

Repeat restoring permissions from paragraph above.

Logs

tail -f ${dir}/snipe-it/storage/logs/laravel.log

Cleaning

good principle to keep one fresh backup and remove old ones.