Lundebakkevej 5, 4684 Holmegaard

Home of Skau

Install SnipeIT on Ubuntu 20.04

Snipe it is a versatile asset management sytem – this guide will get you started.

Install a Ubuntu 20.04 LTS server and set a fixed IP – then get you basic packages ready:

apt-get install openssh-server net-tools -y
apt-get update
apt-get upgrade

Then install all the packages needed by SnipeIt

apt-get install php php-json php-mbstring php-tokenizer php-curl php-mysql php-ldap php-zip php-bcmath php-gd php-xml -y
apt-get install mariadb-server -y
apt-get install git curl -y

Ensure mysql and apache start up at boot (and start them)

systemctl enable mariadb
systemctl enable apache2
systemctl start mariadb
systemctl start apache2

Create database and user (here are the values I used
dbhost: localhost
dbname: snipeit
dbuser: snipeituser
dbpasswd: snipeitpasswd

mysql -u root -p
CREATE DATABASE snipeit CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON snipeit.* TO 'snipeituser'@'localhost' IDENTIFIED BY 'snipeitpasswd';

Get the software

mkdir /var/www/html/snipe-it
cd /var/www/html/snipe-it

git clone .

Now use the sample env file to create one matching your environment

cp .env.example .env

vi .env (these are the lines I set)

setup composer to download dependencies:

cd /var/www/html/snipe-it
curl -sS | php
php composer.phar install --no-dev --prefer-source

Generate app key (keep it safe at you might need it later.

php artisan key:generate

Now fix all the permissions

chown -R www-data:www-data /var/www/html/snipe-it
chmod -R g-w /var/www/html/snipe-it
chmod -R g+w /var/www/html/snipe-it/storage
chmod -R g+w /var/www/html/snipe-it/public/uploads

Create a new apache default config file

cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/snipe-it.conf

Make the content of your new file like this
(vi /etc/apache2/sites-available/snipe-it.conf)

<VirtualHost *:80>

        #Use the email address of whoever is responsible for this server
        ServerAdmin you@youremail.domain

        #this should be the public directory under your snipe-it installation
        DocumentRoot /var/www/html/snipe-it/public

        #this should match the APP_URL in the .env configuration file

        <Directory /var/www/html/snipe-it/public>
                Allow From All
                AllowOverride All
                Options -Indexes

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


Then disable the old default, enable the new one, add mod_rewrite and restart apache

a2dissite 000-default.conf
a2ensite snipe-it.conf
a2enmod rewrite
systemctl restart apache2

Now hit the webpage and go through the wizard – it will fail on DB create (seems like a bug as DB is created) – just press back and when trying agin it sais nothing to migrate then continue.