Install Snipe-IT on Debian 10/Ubuntu 18.04

|
Published:
|
|

Welcome to our guide on how to install Snipe-IT on Debian 10/Ubuntu 18.04. Snipe-IT is a free and opensource IT asset/license management system that enables IT departments to track who has which device, when it was purchased, which software licenses and accessories are available,…

Read more about Snipe-IT features on the features and overview page.

Install Snipe-IT on Debian 10/Ubuntu 18.04

Snipe-IT can be run as a hosted service or self-hosted. This guide focuses on self-hosted Snipe-IT.

Prerequisites

Snipe-IT requires LAMP stack set in order to run. Hence, follow the guides below to setup LAMP Stack on Debian 10 or Ubuntu 18.04.

Install LAMP Stack with MariaDB 10 on Debian 10 Buster

Install LAMP Stack (Apache,MariaDB, PHP 7.2) on Ubuntu 18.04 LTS

Install Extra PHP Extensions and other requirements.

apt install php-{bcmath,cli,xml,mbstring,tokenizer,curl,zip,ldap,gd} openssl curl git wget zip

Create Snipe-IT Database

Next, login to MariaDB/MySQL and create Snipe-IT database and database user with all the privileges granted on Snipe-IT database.

mysql -u root -p
create database snipeitdb;
grant all on snipeitdb.* to snipeadmin@localhost identified by 'P@SSWORD';
flush privileges;
quit

Install Snipe-IT on Debian 10/Ubuntu 18.04

Download Snipe-IT

Clone the Snipe-IT github directory to your web server root directory.

git clone https://github.com/snipe/snipe-it.git /var/www/html/snipeit

Configure Snipe-IT

Rename the Snipe-IT variables file .env.example to .env file.

cp /var/www/html/snipeit/.env.example /var/www/html/snipeit/.env

Open the environment configuration file.

vim /var/www/html/snipeit/.env

Snipe-IT Basic Application Settings

Set the URL you will use to access your Snipe-IT, the Application language, Timezone. The URL should not have a trailing slash.

# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=ChangeMe
APP_URL=http://snipeit.example.com
APP_TIMEZONE='Europe/London'
APP_LOCALE=en

Snipe-IT Database Settings

Set the database host, database name, user and password created above,

# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=snipeitdb
DB_USERNAME=snipeadmin
DB_PASSWORD=P@SSWORD
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci

If you are gonna need your Snipe-IT to send emails, configure Email Server settings.

Install Required PHP Libraries

To install other required Snipe-IT PHP libraries, you need to install PHP Composer. Note that these are not the same as the PHP extensions installed on our prerequisites page. Hence, navigate to Snipe-IT install directory and install the libraries as follows.

cd /var/www/html/snipeit
curl -sS https://getcomposer.org/installer | php
php composer.phar install --no-dev --prefer-source

Set Snipe-IT Directory Ownership and Permissions

Set the user and group Ownership of Snipe-IT web root directory to Web server www-data.

chown -R www-data:www-data /var/www/html/snipeit

Generate Snipe-IT App Key

App key is a randomly generated key that Snipe-IT uses to encrypt data. The value generated will be assigned automatically to APP_KEY variable in the Snipe-IT configuration file.

php artisan key:generate

This command has to be run from the Snipe-IT directory.

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Application key [base64:7xHLDhywQyccOYN9IIOVpkqsdpv34F5RjgtC+Lf+iW8=] set successfully.

The key generated is automatically set as the value of the APP_KEY variable in the .env file.

Configure Apache Web Server for Snipe-IT

Create Snipe-IT Apache configuration file wth the content below;

vim /etc/apache2/sites-available/snipeit.conf
<VirtualHost 192.168.56.105:80>
	DocumentRoot /var/www/html/snipeit/public
	ServerName snipeit.example.com

	<Directory /var/www/html/snipeit/public>
		Allow From All
		AllowOverride None
		Options None
	</Directory>

	RewriteEngine On
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_URI} (.+)/$
	RewriteRule ^ %1 [L,R=301]
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
	RewriteRule ^ /index.php [L]

	ErrorLog ${APACHE_LOG_DIR}/snipeit-error.log
	CustomLog ${APACHE_LOG_DIR}/snipeit-access.log combined
</VirtualHost>

Save the configuration file and run a file syntax test.

apachectl configtest

If the command return, Syntax Ok, proceed. Otherwise fix the would errors.

Enable Snipe-IT site configuration.

a2ensite snipeit.conf

Enable Rewrite module.

a2enmod rewrite

Restart Apache

systemctl restart apache2

Snipe-IT Pre-Flight & Setup

Run the pre-flight setup to verify that all configurations are okay. You can access Snipe-IT pre-flight page via the URL; http://<Snipe-Hostname or Address>.

The first page will do a system check to make sure your configuration is correct.

Install Snipe-IT on Debian 10/Ubuntu 18.04

If all is fine, proceed to database configuration page. Since we already set up the database, you will be told that it is already setup.

Snipe-IT database setup

Create Snipe-IT admin user and fill in their details.

Snipe-IT create admin user

Click Next to save the user and go to Snipe-IT dashboard.

Snipe-IT dashboard

There you go. You have successfully installed Snipe-IT Asset management tool on Debian 10 Buster/Ubuntu 18.04.

The Snipe-IT dashboard has so many functionalities. Read throughbthe user manual to learn about them.

Snipe-IT Overview

In our next tutorial, we are going to learn how to add assets to Snipe-IT for management.

Snipe-IT has also some command line utilities. Read more about them on Snipe-IT Command Line Utilities page.

Other Tutorials;

Install WonderCMS on Debian 10 Buster

Install WonderCMS with Nginx on Debian 10

Install GoAccess on Ubuntu 18.04/Debian 10 Buster

Configure APT Proxy on Debian 10 Buster

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

10 thoughts on “Install Snipe-IT on Debian 10/Ubuntu 18.04”

  1. I followed your guide, but do get an empty screen at step “Snipe-IT Pre-Flight & Setup” only.
    Maybe it is because I want to use it in “intranet” only and have configured /var/www/html/snipeit/.env APP_URL=http://MYlocalIPaddress only?

    Reply
  2. I’m at Install Required PHP Libraries and got error installing the composer and

    I added this, sudo chown -R snipeit /var/www/html/snipe

    before proceeding to

    cd /var/www/html/snipeit
    curl -sS https://getcomposer.org/installer | php
    php composer.phar install –no-dev –prefer-source.

    it works and still in the midst of installing the snipeit. Hopefully it works at the end.

    Reply
  3. If this error occurs,

    apachectl configtest
    AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

    Please do this,

    Go to vim /etc/apache2/apache2.conf

    insert anywhere ServerName snipeit.example.com

    then restart apache by typing

    sudo systemctl reload apache2

    then all good to go, you will only see Syntax Ok.

    Reply
  4. Thanks for the guide. I have successfully installed snipe it. Was going through videos in youtubes, pages and etc. Nothing worked but your tutorials here helped me to set it up perfectly. I had two issues while installing it but managed to solve it and posted the solutions on top. Thanks alot for your time in creating this guide. Have a great day!

    Reply
    • Hello Karthik. We are glad the tutorial helped.
      Thank you for your feedback. This well help somebody someday. Cheers

      Reply
  5. Hi koromicha
    First of all…great post! I am very thankfull for such posts as I am a user without any debian knowledge.
    I am trying to host snipe-it on a Raspberry Pi 3 on Raspbian Buster following your guides for LAMP stack and this post.
    Unfortunately I am not able to go further after “Snipe-IT Database settings”
    My steps and the outcome are per information on the below.
    What is getting wrong on my installation and how can I solve it? As said I do not have any idear how to solve this as google search is overhelming me 🙁
    Thanks, Markus

    Install Required PHP Libraries
    sudo curl -sS https://getcomposer.org/installer | php
    giving me the output
    All settings correct for using Composer
    The installation directory “/var/www/html/snipeit” is not writable

    sudo php composer.phar install –no-dev –prefer-source
    giving me the output
    Do not run Composer as root/super user! See……
    Loading composer repositories with package information
    Installing dependencies from lock file
    Your requirements could not be resolved to an installable set of packages.

    php composer.phar install –no-dev –prefer-source
    giving me the output
    Could not open input file: composer.phar

    chown -R www-data:www-data /var/www/html/snipeit
    giving me the output
    chown: cannot read directory ‘/var/www/html/snipeit’: Permission denied

    sudo chown -R www-data:www-data /var/www/html/snipeit
    giving me the output
    no error

    Generate Snipe-IT App Key
    php artisan key:generate
    giving me the output
    Could not open input file: artisan

    Sudo php artisan key:generate
    giving me the output
    Warning: require(/var/www/html/snipeit/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/snipeit/bootstrap/autoload.php on line 17
    PHP Fatal error: require(): Failed opening required ‘/var/www/html/snipeit/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/share/php’) in /var/www/html/snipeit/bootstrap/autoload.php on line 17

    Reply
    • Hello Markus, apologies for the delayed response. We are looking into the issue, If you have not already solved it, and we will get back as soon as possible.

      Reply

Leave a Comment