adplus-dvertising
16 C
Amsterdam
angeloma
angeloma
Senior Writer and partner

How to install Snipe-IT on Ubuntu 20.04?

Hello, friends. In this post, you will learn how to install Snipe-IT on Ubuntu 20.04. This tool will help you with IT-related operations being open source and easy to install.

So, This is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc.

It is created in Laravel so we are in the presence of a web application created in PHP. This allows you to deploy it on your home server or wherever you want as long as you have the right server.

The application has an Admin Dashboard to have access to recent activity and an overall view of what assets, accessories, consumables, and components you have.

So, the Items that have been checked in, checked out, recently updated or deleted, show up in a recent activity snapshot.

Install Snipe-IT on Ubuntu

As this is a web application, we require certain applications on our server. So to meet this requirement, it is necessary to install the LAMP stack. In it, we will have Apache, PHP, and a database manager called MariaDB. That is, we will have a web server available to install Snipe-IT.

So, read our post How to install LAMP on Ubuntu 20.04 Additionally, install these precise PHP modules for Snipe-IT

sudo apt install php-{opcache,pdo,bcmath,bz2,calendar,ctype,exif,ffi,fileinfo,ftp,gd,iconv,intl,json,mbstring,mysqli,phar,posix,readline,shmop,sockets,sysvmsg,sysvsem,sysvshm,tokenizer,zip,curl,ldap} php7.4-cli git unzip

This single command will install all the necessary PHP modules as well as the git and unzip packages.

Install Composer

Composer is an application to manage PHP dependencies. With Composer we can quickly fulfill the necessary Snipe-IT dependencies on library level without any effort.

So, download and run the Composer installer script

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

This will generate an executable that we need to move to /usr/local/bin/ so we can use it as a system command in any location.

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

With this, we will have the latest stable version of Composer installed on Ubuntu 20.04.

Creating the Database and User for Snipe-IT

Like all web applications, Snipe-IT requires a database driver to store the information it generates. As a general rule, it is convenient to create a user different from root.

So, access the MariaDB shell

sudo mysql -u root -p

And proceed to create the database, the user as well as the corresponding permissions:

CREATE DATABASE snipedb;
CREATE USER 'snipeuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON snipedb.* TO 'snipeuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

You can replace the values with the ones you need, especially the password value

Download and install Snipe-IT on Ubuntu

Now we proceed to download Snipe-IT by cloning its Git repository.

cd /var/www/
sudo git clone https://github.com/snipe/snipe-it snipe-it
Cloning into 'snipe-it'...
remote: Enumerating objects: 102845, done.
remote: Counting objects: 100% (1534/1534), done.
remote: Compressing objects: 100% (985/985), done.
remote: Total 102845 (delta 684), reused 1159 (delta 533), pack-reused 101311
Receiving objects: 100% (102845/102845), 110.88 MiB | 18.48 MiB/s, done.
Resolving deltas: 100% (65841/65841), done.

This will create a folder called snipe-it which you will need to access.

cd /var/www/snipe-it

There is a .env.example file that we will have to convert into the application configuration file. To do this, simply rename it.

sudo cp /var/www/snipe-it/.env.example /var/www/snipe-it/.env

Now you have to edit it, to balance some necessary settings.

sudo nano /var/www/snipe-it/.env

Among the configurations we will have to set the following ones:

APP_URL=[domain]
APP_TIMEZONE='[timezone]'

And also the database configuration.

DB_DATABASE=snipedb
DB_USERNAME=snipeuser
DB_PASSWORD=password

Remember that you have to replace the values with the ones you defined.

When you are ready, save your changes and close the text editor.

Then, make the Snipe-IT folder belong to Apache and assign the correct permissions to it.

sudo chown -R www-data:www-data /var/www/snipe-it
sudo chmod -R 755 /var/www/snipe-it

Now update Composer.

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

And install all application dependencies.

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

As this is an application created with Laravel, it is necessary to generate a key.

sudo php artisan key:generate
**************************************
*     Application In Production!     *
**************************************

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

Application key set successfully.

Now the Snipe-IT packages are installed.

Creating a VirtualHost for Snipe-IT

The next step is to create a VirtualHost for best access to Snipe-IT. This will also allow Apache to manage the application with policies that suit your needs.

So, create the file

sudo nano /etc/apache2/sites-available/snipeit.conf

And add the following content:

<VirtualHost *:80>
    ServerName snipe.osradar.test
    DocumentRoot /var/www/snipe-it/public
    <Directory /var/www/snipe-it/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
1.- VirtualHost for Snipe-IT
1.- VirtualHost for Snipe-IT

Replace ServerName with the name of the domain you have.

Save the changes and close the editor. To apply these changes, enable the rewrite module and restart Apache.

sudo a2ensite snipeit.conf
sudo a2enmod rewrite

Optional: Obtain a Let’s Encrypt and Enable HTTPS certificate

If Snipe-IT will be available from the internet, then the idea would be to secure access via HTTPS.

So, install Certbot and its Apache plugin.

sudo apt-get install certbot python3-certbot-apache

Now get the certificate by running

sudo certbot --apache

During the process, you will have to answer some questions and indicate the domain. All very simple.

At the end of the process, restart Apache to apply the changes.

sudo systemctl restart apache2

Complete the installation of Snipe-IT on Ubuntu

Now you can open your web browser and go to https://your-domain and you will see the following screen

2.- Installing Snipe-IT on Ubuntu 20.04
2.- Installing Snipe-IT on Ubuntu 20.04

The server is checked to see if it meets the requirements.

Then, some data will be loaded into the database as well as the table structure.

3.- creating the database tables
3.- creating the database tables

The next step is to create the admin user and configure the program with the default currency and other settings.

4.- Creating the default user
4.- Creating the default user

At the end of the installation, you will go to the Dashboard.

5.- Snipe-IT on Ubuntu
5.- Snipe-IT on Ubuntu

So, enjoy it.

Conclusion

Snipe-IT is one of the best in its field. Now you know how to install it step by step and it’s up to you to put this post into practice.

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article