LinuxTutorialsUbuntu

How To Install Snipe-IT on Ubuntu 20.04 LTS

Install Snipe-IT on Ubuntu 20.04

In this tutorial, we will show you how to install Snipe-IT on Ubuntu 20.04 LTS. For those of you who didn’t know, Snipe-IT is a free, open-source IT asset management system written in PHP. With Snipe-IT, you can manage your IT assets easily with its user-friendly portal, including management of users and security roles.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Snipe-IT open-source information technology asset management tool on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Snipe-IT on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing the LAMP stack.

A Ubuntu 20.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

Step 3. Installing Composer.

Download the Composer installer using the following command below:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Step 4. Installing Snipe-IT on Ubuntu 20.04.

Now we clone the latest Snipe-IT repository from Github:

cd /var/www/
sudo git clone https://github.com/snipe/snipe-it snipe-it

Next, switch to the Snipe-IT directory:

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

After that, edit the configuration file:

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

Add the following line:

# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=ChangeMe
APP_URL=your-domain.com
APP_TIMEZONE='UTC'
APP_LOCALE=en
MAX_RESULTS=500

# --------------------------------------------
# REQUIRED: DATABASE SETTINGS
# --------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=snipe_it
DB_USERNAME=snipe_it_user
DB_PASSWORD=type-your-password-here
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci

# --------------------------------------------
# OPTIONAL: SSL DATABASE SETTINGS

Next, go back to the Snipe-IT root directory and update all packages via Composer:

cd /var/www/snipe-it
sudo composer install --no-dev --prefer-source

From the Snipe-IT directory, run the commands below:

sudo php artisan key:generate

Output:

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

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

Application key [base64:6KnX/GoDeTuucxBM3iL4na+OwQ58yBfr3akzwpDg=] set successfully.

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

Step 4. Configuring MariaDB for Snipe-IT.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log in to the MariaDB console and create a database for Snipe-IT. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Snipe-IT installation:

MariaDB [(none)]> CREATE DATABASE snipe_it;
MariaDB [(none)]> CREATE USER 'snipe_it_user'@'localhost' IDENTIFIED BY 'Your-Str0nge-Passw0rd';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON snipe_it.* TO 'snipe_it_user'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Step 5. Configuring Apache.

Now we create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘snipeit.conf’ on your virtual server:

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

Add the following line:

<VirtualHost *:80>
     ServerAdmin admin@your-domain.com
     DocumentRoot /var/www/snipe-it/public
     ServerName your-domain.com
     ServerAlias www.your-domain.com

     <Directory /var/www/snipe-it/public/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

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

</VirtualHost>

Now, we can restart the Apache webserver so that the changes take place:

sudo a2enmod rewrite
sudo a2ensite snipeit.conf 
sudo systemctl restart apache2.service

Step 6. Configure Firewall

In case, you enabled UFW firewall and firewall block requests of the apache web server, open a port in the firewall:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

Step 7. Accessing Snipe-IT Web Interface.

Snipe-IT will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.comand complete the required steps to finish the installation.

Install Snipe-IT on Ubuntu 20.04

Congratulations! You have successfully installed Snipe-IT. Thanks for using this tutorial for installing the Snipe-IT free and open source IT asset management system on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Snipe-IT website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button