How to Install Snipe IT on Rocky Linux 9

Snipe-IT is a free and open source IT asset management system with powerful built-in features. It is a Free Open Source (FOSS) project built on Laravel. Snipe-IT is very user-friendly and ideal for IT operations like asset tracking (who has which laptop and accessories), handling software licenses, network devices, other peripheral accessories, when it was purchased, warranty expiry etc.


Requirement

  • HTTP server running Apache
  • PHP version PHP >= 7.4 < v8.1.2 (8.0 is recommended)
  • PHP Extensions - mysqli, gd, imap, json, mbstring, xml, pdo, openssl, curl, ldap, zip, bcmath, tokenizer, embedded, sodium, fileinfo, dom
  • MariaDB database equivalent >= 10 (10.6 is recommended)


Update System

sudo yum update


Install PHP

For installing composer and php-sodium ,EPEL and Remi repository need to install and enable on Rocky Linux 9 system with the below commands.

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-9.rpm


Install yum-utils, it is a collection of tools and programs for managing yum repositories, installing debug packages, source packages, extended information from repositories and administration.

sudo yum install yum-utils


Install PHP and the required extensions.

sudo yum install php php-openssl php-pdo php-mbstring php-tokenizer php-curl php-mysqlnd php-ldap php-zip php-fileinfo php-gd php-dom php-embedded php-bcmath php-xml php-sodium php-pecl-zip php-simplexml


Configure the timezone in php.ini file. Uncomment date.timezone = and enter the respective timezone.

sudo vim /etc/php.ini

date.timezone = Asia/Kolkata


Install Basic Packages

sudo yum install vim git composer


Change SELinux mode to Permissive

Edit the /etc/selinux/config file as follows and reboot the system

sudo vim /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.

SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.

SELINUXTYPE=targeted



Install Apache

sudo yum install httpd

Start and enable the Apache services at boot time.

sudo systemctl start httpd
sudo systemctl enable httpd


Install MariaDB Database

By default Rocky Linux 9 appstream repository provides MariaDB 10.5.16 version, which will work for Snipe-IT Assest Management application.

Install MariaDB and its dependencies

sudo yum install mariadb-server

Start and enable the MariaDB Server services at boot time.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Configure MariaDB

sudo mysql_secure_installation

Create Database and user account for Snipe-IT

sudo mysql -u root -p

create database snipeitdb;
create user 'snipeituser'@'localhost' identified BY 'Linuxyogi@123';
grant all privileges on snipeitdb.* to snipeituser@localhost;
flush privileges;


Install Snipe-IT

Clone the latest stable release of Snipe IT to new document root directory called "snipe-it".

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


Configuration

In this section Snipe-IT configuration file need to configure, such as your database credentials, mail server, preferred language, timezone, and so on. Some of the settings are optional, some are required.

All system configuration variables are stored in a single .env file. To get started, rename the .env.example file to a new .env file:

cd /var/www/html/snipe-it

sudo mv .env.example .env

sudo vim .env

APP_URL=http://localhost/


DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=snipeitdb
DB_USERNAME=snipeituser
DB_PASSWORD=Linuxyogi@123
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci



MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=support@linuxyogi.com
MAIL_PASSWORD=XXXXXXX
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=support@linuxyogi.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=admin@linuxyogi.com
MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_BACKUP_NOTIFICATION_ADDRESS=admin@linuxyogi.com


PHP Virtual Host Configuration

To configure PHP virtual host configuration for Snipe IT, create a configuration file at below location.

sudo vim /etc/httpd/conf.d/snipeit.conf

<VirtualHost *:80>
<Directory /var/www/html/snipe-it/public>
Allow From All
AllowOverride All
Options -Indexes
</Directory>

DocumentRoot /var/www/html/snipe-it/public
ServerName localhost
</VirtualHost>


Install Dependencies

Composer is a package manager for PHP that allows to manage the dependencies for the various vendor packages utilize in Snipe-IT. Vendor packages are PHP libraries that someone else wrote, and that are use in Snipe-IT to help make it awesome.

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

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


Generate the App Key

sudo php artisan key:generate
sudo php artisan migrate

Change the ownership and permission on support directory.

sudo chown -R apache:apache /var/www/html/snipe-it

sudo chown -R apache:apache storage
sudo chown -R apache:apache public/uploads
sudo chown -R apache:apache bootstrap/cache

sudo chmod -R 755 storage
sudo chmod -R 755 public/uploads
sudo chmod -R 755 bootstrap/cache

Allow http and https services from Firewall for Snipe IT web installer and Dashboard access.

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

Open browser and navigate to http://<server-ip>/ and make sure all prerequisites are marked green. Click Next.

example- http://localhost/

Create admin user and fill the account information like Site Name, Language, Currency, First Name , Last Name, email id, email domain etc.

Dashboard is ready for the use.