How To Install Snipe-IT on AlmaLinux

By Chandrashekhar Fakirpure

Updated on Feb 02, 2024

In this tutorial, we will explain the steps of how to install Snipe-IT on AlmaLinux 9.

Snipe-IT was made for IT asset management, to enable IT departments to track who has which laptop, when it was purchased, which software licenses and accessories are available, and so on. Snipe-IT is a open-source IT asset management and it eliminates the need for complex IT asset tracking spreadsheets.

We have covered installation Snipe-IT 6 on AlmaLinux 9.

Prerequisites

  • A AlmaLinux 9 installed dedicated server or KVM VPS.
  • A root user access or normal user with sudo privileges.

Step 1 – Keep the server up to date

Always keep the server up to date the security purpose.

dnf update -y

Step 2 - Install Dependencies

dnf install unzip git -y

Step 3 - Install Apache Web Server

dnf install httpd -y

After the installation, start and enable apache2 service using following command:

systemctl start httpd && systemctl enable httpd

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

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

Now, let’s verify the Apache installation. Navigate to your browser and enter your server IP.

http://[SERVER IP]

Step 4 - Install MariaDB

dnf install mariadb-server -y

Start and enable mariadb service using following command:

systemctl start mariadb && systemctl enable mariadb

The default configuration of the MariaDB will not be secured. Let’s secured the installation using the following command:

mysql_secure_installation

Once the script gets executed, it will ask multiple questions.

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y
 ... Success!

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
    

Step 5 - Install PHP

Here we are installing the PHP version 8.0 and other modules for web deployments.

dnf install php php-bcmath php-bz2 php-intl php-gd php-mbstring php-zip php-opcache php-pdo php-calendar php-ctype php-exif php-ffi php-fileinfo php-ftp php-iconv php-intl php-json php-mysqli php-phar php-posix php-readline php-shmop php-sockets php-sysvmsg php-sysvsem php-sysvshm php-tokenizer php-curl php-ldap -y

Install PHP Composer, which is a PHP dependency management tool to install and update libraries in your Snipe-IT.

Step 6 - Download Composer

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

Move the /composer.phar executable to /usr/local/bin/./p>

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

Step 6 - Create a Database

Create a database and database user for Snipe-IT. First login into MySQL/MariaDB as a root user.

mysql -u root -p

Run following commands to perform this task:

CREATE DATABASE snipe_it;
CREATE USER 'snipe_it_user'@'localhost' IDENTIFIED BY 'EXAMPLE_PASSWORD';
GRANT ALL PRIVILEGES ON snipe_it.* TO 'snipe_it_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
    

Note: Replace snipe_it_user to your choice username and replace EXAMPLE_PASSWORD to you choice password.

Step 7 - Install Snipe-IT

Navigate to the root directory of your web server.

cd /var/www/

Use git to clone the latest Snipe-IT repository from the https://github.com/snipe/snipe-it URL and copy the downloaded files to a snipe-it directory.

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

Switch to the snipe-it directory.

cd /var/www/snipe-it

Snipe-IT ships with a sample configuration file. Copy it to /var/www/snipe-it/.env.

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

Edit the configuration file.

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

In the Snipe-IT configuration file, locate these settings.

APP_URL=null
APP_TIMEZONE='UTC'
    

Set APP_URL to your server’s Fully Qualified Domain Name, or it’s public IP address. If you use a time zone other than UTC, change the timezone to a PHP-supported timezone, and enclose it in single quotes.

APP_URL=example.com
APP_TIMEZONE='America/New_York'
    

Locate these settings.

DB_DATABASE=null
DB_USERNAME=null
DB_PASSWORD=null
    

Change those values to the database information you set up in Step 3.

DB_DATABASE=snipe_it
DB_USERNAME=snipe_it_user
DB_PASSWORD=EXAMPLE_PASSWORD
    

Save and close the file. Set the correct ownership and permission for the Snipe-IT data directory.

chown -R apache:apache /var/www/snipe-it
chmod -R 755 /var/www/snipe-it
    

Install the Snipe-IT dependencies with Composer. You’ll receive a warning not to run this as root on each command. It’s okay to continue as root for the Snipe-IT install, so type yes and hit ENTER.

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

Once the Composer finishes running, generate a Laravel APP_Key value in the /var/www/snipe-it/.env configuration file you created earlier. Type yes and hit ENTER when prompted to continue.

php artisan key:generate

Step 8 - Create a Virtual Host File

Create a new Apache configuration file.

vi /etc/httpd/conf.d/snipe-it.conf
    

Paste the information below and replace example.com with your server’s domain name or public IP address.

< VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/snipe-it/public

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

< /VirtualHost>
    

Save and exit the file. Restart your Apache web server to apply the changes.

systemctl restart httpd

Step 9 - Configure SELinux

setsebool -P httpd_unified 1
setsebool -P httpd_can_network_connect_db 1
    

Step 10 - Run the Setup Wizard

Navigate to your browser and access the setup wizard using your server IP or domain name you have mentioned in vhost conf file.

Install Snipe-IT on AlmaLinux HostnExtra

Once you complete the setup wizar your will redirect to dashbord

Install Snipe-IT HostnExtra

We have seen, how to install Snipe-IT on AlmaLinux 9. Here is the Snipe-IT's official Documentation.