Snipe-IT is an open source, feature-rich web application for IT assets management built using a PHP framework called Laravel and uses MySQL to store its data. It enables IT administrators to track physical assets, software licenses, accessories and consumables in a single place.
In this tutorial, we will describe how to install Snipe-IT on CentOS 7 using a LAMP stack (Linux, Apache, MySQL & PHP).
Step 1: System Update
Before installing anything on the server, it is recommended to update the system with the below command:
# yum update
Step 2: Install Apache Web Server and PHP
Snipe-IT requires PHP greater than 7.x and to have PHP 7.x, we need to enable the Epel and Remi repository as shown below:
# yum install epel-release # rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm # yum -y install yum-utils # yum-config-manager --enable remi-php71 [Install PHP 7.1] # yum-config-manager --enable remi-php72 [Install PHP 7.2] # yum-config-manager --enable remi-php73 [Install PHP 7.3]
Next, we will install PHP with all the required dependencies with the below command:
# yum install httpd php php-mysql php-openssl php-curl php-ldap php-zip php-pdo php-mbstring php-tokenizer php-curl php-ldap php-zip php-fileinfo php-gd php-dom php-mcrypt
Now, let us start Apache web-server and enable the service to auto-start at boot time of server:
# systemctl start httpd # systemctl status httpd # systemctl enable httpd
We can verify the server installation by browsing below URL:
Step 3: Install MariaDB
We will install MariaDB with the below command:
# yum -y install mariadb mariadb-server
Next, we will start MariaDB and enable it to start at server boot:
# systemctl start mariadb.service # systemctl enable mariadb.service
Now, we need to secure and harden our MySQL installation using the following command.
We need to set a strong root password for our MariaDB and answer
Y to all of the other questions asked ( which is self explanatory).
Step 4: Create database for Snipe-IT
We need to login to the MySQL console and create a database for Snipe-IT. All Asset data will be stored in this database.
# mysql -u root -p
Provide the password for the MariaDB root user.
CREATE DATABASE exampledb; CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'StrongPassword'; GRANT ALL PRIVILEGES ON exampledb.* TO 'example_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 5: Install Composer
Composer is a dependency manager for PHP. We will install composer with the below command.
# curl -sS https://getcomposer.org/installer | php # mv composer.phar /usr/bin/composer
Step 6: Install Snipe-IT Asset Management
We will install Snipe-IT through git, so we will install git first.
# yum install git
Next, we will clone the latest version of Snipe-IT under Apache web-root directory.
# cd /var/www/ # git clone https://github.com/snipe/snipe-it snipe-it
Now go to the snipe-it directory and copy the .env.example file to .env file.
# cd /var/www/snipe-it # sudo cp .env.example .env
Next, edit the .enf file and provide the settings as below.
APP_URL=http://server-ip/ #Provide your domain name or IP address here APP_TIMEZONE='UTC' #Change it according to your country DB_HOST=localhost # Change it according to your database server location DB_DATABASE=exampledb #Provide the database name you created earlier DB_USERNAME=example_user #Provide database user's username DB_PASSWORD=StrongPassword #Provide the DB user's password
Leave the default values for all of the other parameters. Save the file and exit the text editor.
Now, set the appropriate ownership and file permissions as below.
# sudo chown -R apache:apache storage public/uploads # sudo chmod -R 755 storage public/uploads
Next, we will install all the dependencies required by PHP using Composer as below:
# composer install --no-dev --prefer-source
Now, generate the “APP_KEY” value with the following command:
# php artisan key:generate
Step 7: Create virtual host
Before we create the virtual host, we need to open port 80 to allow HTTP traffic.
# firewall-cmd --zone=public --permanent --add-service=http # firewall-cmd --reload
Now, let us create virtual host with the below command:
# vi /etc/httpd/conf.d/snipeit.example.com.conf
Add/modify the line below in your Apache config file:
<VirtualHost *:80> ServerName snipeit.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 close the file and restart Apache service to apply the changes.
# systemctl restart httpd
Step 8: Snipe-IT Web Installation
Open the below URL on your browser to complete the installation process.
First, the Pre-Flight Check page apperas, click Next: Create Database Tables.
Next tables will be created, click Next: Create User.
Then provide the admin user details and click Next: Save User.
Next, open the login page and login with the admin details to view the Snipe-IT dashboard.
This completes the Snipe-IT installation tutorial. Enjoy using your new Snipe-IT site!