You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Introduction

Snipe-IT is a Free Open Source project built on Laravel made for IT asset management. This is to for example help to enable IT departments to track who has which laptop, when it was purchased, which software licenses and accessories are available, and so on. This guide will show you how to install Snipe-IT Asset Management on CentOS 8 Linux machine.

These are the steps you’ll follow to install and configure Snipe-IT Asset Management on CentOS 8 Linux system. You need to have a root access to the server or a standard account with sudo privileges.

Step 1: Update your Server & Install dependencies

Update your CentOS system.

sudo dnf -y update

Install git and add EPEL repository:

sudo dnf -y install epel-release vim git

Step 2: Install Apache web server

Apache httpd server will be used to host Snipe-IT Asset Management web application on CentOS 8. Install it by running the commands below.

sudo dnf -y install httpd

Start and enable Apache httpd service.

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install PHP and modules

PHP is also needed as a key dependency. Follow this guide to install PHP 7.4 on your system

How To Install PHP 7.4 on CentOS 8 / RHEL 8

There are a number of additional PHP modules required by Snipe-IT:

sudo dnf -y install php-openssl php-pdo php-mbstring php-tokenizer php-curl php-mysql php-ldap php-zip php-fileinfo php-gd php-dom php-mcrypt php-bcmath

Step 4: Install MariaDB Database server

Follow this guide to install MariaDB 10.4 on your system

How To Install MariaDB on CentOS 8 / RHEL 8

Start and enable MariaDB:

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Step 5: Create Snipe-IT Database

Login to the database you have installed in the previous step, create database and user.

$ mysql -u root -p

CREATE DATABASE snipeit;
CREATE USER 'snipeit'@'localhost' IDENTIFIED BY 'Je1eimom4chahth'; # Make sure you have used strong password here.
GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeit'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 6: Install PHP composer

Composer is a PHP application package manager created to provide a standard format for managing dependencies of PHP software and required libraries

Use this link to install PHP composer

How To Install PHP Composer on CentOS 8 / RHEL 8

Step 7: Download Snipe-IT on CentOS 8

Pull Snipe-IT from git:

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

Step 8: Configure Snipe-IT

After you have a copy of Snipe-IT in your local server, let us now proceed to configure it.
Create a .env file.

We already have a .env.example file from the downloaded files. Change into the directory where you downloaded files from git and simply copy .env.example as shown below.

cd /var/www/html/snipe
sudo cp .env.example .env

Let us now edit the .env file accordingly. The file has many options as you might have noticed, but the following are the most important for now. You can add the rest at your own pleasure such as mail server settings and the rest.

$ sudo vim .env

APP_URL=example.com           # Input the IP Address or FQDN of your Snipe App
APP_TIMEZONE='UTC'            # Input it to match the country you are at
DB_DATABASE=snipeit           # Input the name of the database we created earlier
DB_USERNAME=snipeit           # Input the username of the database we created earlier 
DB_PASSWORD=Je1eimom4chahth   # Input the password of the database we created earlier

After we are done, while still in the directory we downloaded Snipe-IT, let’s give our files the right permissions and ownerships as illustrated below.

sudo chown -R apache:apache storage public/uploads
sudo chmod -R 755 storage
sudo chmod -R 755 public/uploads

Step 9: Install PHP Dependencies using composer

Using Composer that we installed earlier, let us install all dependencies of PHP.

Check where composer is installed

$ which composer
/usr/local/bin/composer

Install the dependencies. This might take a while to complete:

sudo /usr/local/bin/composer install --no-dev --prefer-source

You should see an output as shown below

Step 10: Generate the “APP_Key”.

While still at the directory you downloaded SnipeIT files, run the command below

$ sudo php artisan key:generate
Application In Production!     *  
Do you really wish to run this command? (yes/no) [no]:
  > yes 
Application key [base64:yXaQTcuJo/rXHoNxG+C/X/aYyHQ6/Va3NHu4YUPpBAQ=] set successfully.

Step 11: Configure Apache

Configure your firewall service to allow http port:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Navigate to an Apache folder and create SnipeIT virtual host:

cd /etc/httpd/conf.d/

Create a file for your virtual host and add a normal VirtualHost configuration similar to the one illustrated below.

$ sudo vim geeksnipe.conf
<VirtualHost *:80>
  ServerName example.com
  DocumentRoot /var/www/html/snipe/public
  <Directory  /var/www/html/snipe/public>
    Options Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>

See below screenshot.

Restart Apache:

sudo systemctl restart httpd

Step 12: Configure SELinux

Run below command to get semanage packages:

sudo yum provides /usr/sbin/semanage

You should get something like policycoreutils-python-utils-2.8-16.1.el8.noarch

Install that package:

sudo yum install policycoreutils-python-utils

After it is installed, navigate to the directory that holds your SnipeIT files and run the command below as root.

sudo semanage fcontext -a -t httpd_sys_rw_content_t " /var/www/html/snipe(/.*)/?"
sudo restorecon -R -v  /var/www/html/snipe/
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/snipe/storage(/.*)?"
sudo restorecon -RF /var/www/html/snipe/storage

SELinux may prevent Apache from opening any outgoing sockets. In order to allow it, run the following command as root:

sudo setsebool -P httpd_can_network_connect on

Step 13: Finish Snipe-IT setup on CentOS 8

Click on “Create Database Tables

Click on “Create User“.

Enter the details the page asks of you to enter

Finish up and load the Dashboard

Conclusion

We now have our Asset Management System in place. You can cruise around and check what it has to offer. For more information about SnipeIT, check its Full Documentation.

Also Read:

How To Install Jira on CentOS 8 / RHEL 8 Linux

How To Install SuiteCRM on CentOS 8 Linux

How To Install Vagrant on CentOS 8 / RHEL 8

How To Install Icinga Web 2 on CentOS 8 / RHEL 8

Install and Configure DHCP Server & Client on CentOS 8 / RHEL 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF