How to Install Snipe-IT Asset Management Tool on Ubuntu 22.04

In order to track the ownership, deployment process, and details of all servers, a powerful IT asset manager is required. This can be achieved by installing and using Snipe-IT, an open-source IT asset management tool.

In this article, we will discuss the installation of Snipe-IT on an Ubuntu 22.04 server.

Installation of the Snipe-IT Asset Manager

To install the snipe-IT tool, you must have to install the LAMP stack first, that is Linux, Apache server, Mysql server, and PHP. To install them, first update the repository of the server then check out the given commands and execute it on your server as well.

$ sudo apt update && sudo apt upgrade -y

Install Apache

Install the Apache server by executing the command as:

$ sudo apt install apache2 -y

Now start and enable the apache service by executing the command similar to the command as shown below.

$ sudo systemctl start apache2
$ sudo systemctl enable apache2

Install the PHP

To install the PHP, first add the PHP repository on your server by adding it with the command as shown below:

$ sudo add-apt-repository ppa:ondrej/php

Next, install the PHP extensions. To do that, execute the command as:

$ sudo apt install -y php-{opcache,pdo,bcmath,calendar,ctype,fileinfo,ftp,gd,intl,json,ldap,mbstring,mysqli,posix,readline,sockets,bz2,tokenizer,zip,curl,iconv,phar}

Also, install other required packages.

$ sudo apt install -y openssl curl git wget zip

Next, the Apache webserver needs to be restarted for the new changes to be applied.

$ sudo systemctl restart apache2

Install the MySql/MariaDB server

Install the Mysql or MariaDB server. In our case, we are installing a MySQL server. Then start and enable the MySQL server by executing the command as shown below.

$ sudo apt install mysql-server
$ sudo systemctl start mysql
$ sudo systemctl enable mysql

Next, Secure the mysql server. To do that, you will need to execute the command as:

$ sudo mysql_secure_installation

Set the root password and flush the privileges. You will see the output similar to the screenshot below.

Secure MySQL

Create database for Snipe-IT

Login to the mysql server and create a user and database for snipe-IT. For further details, execute the command as below.

$ sudo mysql -u root -p

mysql> CREATE DATABASE snipeit_db;

Query OK, 1 row affected (0.01 sec)

mysql> CREATE USER 'snipeit'@'localhost' IDENTIFIED WITH mysql_native_password BY 'snipe@123';

Query OK, 0 rows affected (0.03 sec)

mysql> GRANT ALL PRIVILEGES ON snipeit_db.* TO 'snipeit'@'localhost';

Query OK, 0 rows affected (0.02 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

mysql> quit

Create database

Install Snipe-IT

To install the Snipe-IT tool on Ubuntu 22.04 server, download the latest package of snipe-IT from github. Navigate to the /var/www/html directory then download the package by running the command similar as:

$ cd /var/www/html

Run the git command to download the package on this directory.

$ sudo git clone https://github.com/snipe/snipe-it snipe-it

Next, copy the .env.example by creating the new file as .env.

$ cd /var/www/html/snipe-it
$ sudo cp .env.example .env

Next, edit this .env file by updating the database details and URL. For further details, check the screenshot as shown below.

$ sudo vim .env
APP_URL=snipeit-test.com
APP_TIMEZONE='UTC'
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=snipeit_db
DB_USERNAME=snipeit
DB_PASSWORD=snipe@123
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci

Create .env file

Install Composer

Install the composer on that directory. You can execute the command similar as shown below to download and install composer.

$ curl -sS https://getcomposer.org/installer | php

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

Next,navigate to the /var/www/html/snipe-it then all the PHP dependencies will be downloaded by running the command as:

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

$ sudo composer update --no-plugins --no-scripts

$ sudo composer install --no-dev --prefer-source --no-plugins --no-scripts

Next, generate the app key by running the command as shown below.

$ sudo php artisan key:generate

Next, give the required permission to your snipe-it directory

$ sudo chown -R www-data:www-data /var/www/html/snipe-it

$ sudo chmod -R 755 /var/www/html/snipe-it

Configuring the Apache web server for Snipe-IT

For the Snipe-IT, create an apache configuration file. But before that you can disable the default configuration file of apache with the similar command as shown below.

$ sudo a2dissite 000-default.conf

Next, create a configuration file for Snipe-IT with the contents similar to the given screenshot.

$ sudo vim /etc/apache2/sites-available/snipeit.conf

Virtual host file content:

<VirtualHost *:80>
  ServerName snipeit-test.com
  DocumentRoot /var/www/html/snipe-it/public
  <Directory /var/www/html/snipe-it/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>

Virtual host file

Next, you have to enable the new configuration file and restart the apache server for the changes to be applied.

$ sudo a2ensite snipeit.conf
$ sudo systemctl restart apache2

Snipe-IT Dashboard

Finally, you are ready to see the dashboard of the snipe-it by accessing it through the domain name that you set. First the page will be displayed with the details of the requirements then you can create a user. For further details, check the screenshot below.

Snipe IT web installer

Then click next by saving user details, you will see the dashboard of the snipe-IT similar to the screenshot as shown below.

Snipe-IT dashboard

Conclusion

In this article, you have learned how to install the snipe-IT asset management tool and set up the dashboard by creating the database and creating a configuration file. Thank you!