In this article, we’ll explain how to install Snipe-IT on AlmaLinux 8.
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.
Prerequisites
- An AlmaLinux 8 installed dedicated server or KVM VPS.
- A root user access or normal user with administrative privileges.
Install Snipe-IT on AlmaLinux 8
1. Update the server and install dependencies:
# dnf update -y
Install unzip dependency
# dnf install unzip git -y
2. 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. Open browser and test default page.
http://[SERVER IP]
3. 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.
It will ask you to enter the current password for root (enter for none):
Then enter yes/y to the following security questions:
Set a root password? [Y/n]: y
Remove anonymous users? : y
Disallow root login remotely? : y
Remove test database and access to it? : y
Reload privilege tables now? : y
4. Install PHP and PHP Composer
Here we are installing the PHP version 7.4 and other modules for web deployments.
Install Remi repository
# dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Next, take a look at the available PHP modules by running.
# dnf module list php
Now, in order to enable the PHP remi-7.4 stream run the following dnf commands.
# dnf module reset php -y
# dnf module enable php:remi-7.4 -y
Install PHP 7.4
# dnf install php php-bcmath php-bz2 php-intl php-gd php-mbstring php-mysql 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.
5. Download Composer
# curl -sS https://getcomposer.org/installer | php
Move the composer.phar executable to /usr/local/bin/.
# mv composer.phar /usr/local/bin/composer
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.
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
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
<Directory /var/www/snipe-it/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Save and exit the file.
Restart your Apache web server to apply the changes.
# systemctl restart apache2
9. Configure SELinux
# setsebool -P httpd_unified 1
# setsebool -P httpd_can_network_connect_db 1
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.
Once you complete the setup wizar your will redirect to dashbord
In this article, we have seen how to install Snipe-IT on AlmaLinux 8.