Snipe-IT is a free and open source web based application software that can be used for IT assets management and software license management. It is written in Laravel framework and uses MySQL to store its data.
Snipe-IT provides lots of features, some of them are listed below:
- Supports Windows, Linux and Mac operating system.
- Supports two-factor authentication with Google Authenticator.
- Easily translate multiple languages.
- Automated backups, Custom reports and Mobile friendly.
- Integrates with Active Directory and LDAP.
- Bulk user actions and user role management for different levels of access.
Here, we will learn how to install Snipe-IT on Ubuntu 16.04 server.
Requirements
- A server running Ubuntu 16.04.
- A normal user with sudo privileges setup on your server.
Update the System
Before installing any packages, it is recommended to update your system with the latest stable version. You can do this with the following command:
sudo apt-get update -y
sudo apt-get upgrade -y
Once your system is up to date, you can proceed to install Apache web server.
Install Apache Web Server
First, you will need to install Apache web server on your system. You can easily install it by running the following command:
sudo apt-get install apache2 -y
Once apache is installed, start the Apache web server and enable it to start on boot with the following command:
sudo systemctl start apache2
sudo systemctl enable apache2
Install PHP
Snipe-IT is compatible with any version of PHP greater than 5.5.9. You can install PHP and other required modules with the following command:
sudo apt-get install git unzip php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-ldap libapache2-mod-php5 curl
Once all the packages are install, you can proceed to install MariaDB server.
Install and Configure MariaDb Server
You will need to install MariaDB server to store data. You can install it with the following command:
sudo apt-get install mariadb-server -y
Start MariaDB and enable it to automatically start at boot time.
sudo systemctl start mysql
sudo systemctl enable mysql
By default, MariaDB is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script.
sudo mysql_secure_installation
Answer all the questions as shown below:
Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Once MariaDB is secured, log in to the MySQL shell and create a database for Snipeit:
mysql -u root -p
Enter your root password when prompt, then create a database for Snipeit. It is recommended to set secure password:
MariaDB [(none)]>CREATE DATABASE snipeit;
Query OK, 1 row affected (0.00 sec)
Next, create a username and password for Snipeit with the following command:
MariaDB [(none)]>CREATE USER 'snipeit'@'localhost' IDENTIFIED BY 'password';
Query OK, 1 row affected (0.00 sec)
Next, grant privileges to the Snipeit database with the following command:
MariaDB [(none)]>GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeit'@'localhost';
Query OK, 1 row affected (0.00 sec)
Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MariaDB and we can use new credential:
MariaDB [(none)]>FLUSH PRIVILEGES;
Query OK, 1 row affected (0.00 sec)
Next, exit from the MariaDB console with the following command:
MariaDB [(none)]>\q
Once you are done, you can proceed to the next step.
Install Composer
Composer is a dependency manager for PHP. You can install all dependency required by PHP using Composer.
You can install Composer with the following command:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Once Composer is installed, you can proceed to install Snipe-IT.
Install Snipe-IT
First, you will need to download the latest version of the Snipe-IT from Git Hub repository. You can download it with the following command:
cd /var/www/
sudo git clone https://github.com/snipe/snipeit snipe-it
Next, copy example .env file:
cd snipeit
sudo cp cp .env.example .env
Next, make the following changes:
sudo nano .env
Change the following lines:
APP_TIMEZONE=Asia/Kolkata
DB_HOST=localhost
DB_DATABASE=snipeit
DB_USERNAME=snipeit
DB_PASSWORD=password
APP_URL=http://your-server-ip
APP_KEY=dv9tq7fco1VsV6cRO8OhRo0Ux4eFIzUI
Save and close the file when you are finished.
Next, provide the appropriate ownership and file permissions.
sudo chown -R www-data:www-data storage public/uploads
sudo chmod -R 755 storage
sudo chmod -R 755 public/uploads
Next, install all the dependency required by PHP using Composer:
sudo composer install --no-dev --prefer-source
Once all the dependency are installed, generate the “APP_Key” with the following command:
sudo php artisan key:generate
Once you are done, you can proceed to the next step.
Configure Apache for Snipe-IT
Next, you will need to create a virtual host file for Snipe-IT. You can do this by creating snipeit.conf file inside /etc/apache2/sites-available/ directory:
`sudo nano /etc/apache2/sites-available/snipeit.conf
Add the following lines:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
<Directory /var/www/snipeit/public>
Require all granted
AllowOverride All
</Directory>
DocumentRoot /var/www/snipeit/public
ServerName your-server-ip
ErrorLog /var/log/apache2/snipeIT.error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Save and close the file when you are finished. Then activate virtual host with the following command:
sudo a2ensite snipeit.conf
Next, enable apache rewrite module and php mcrypt module:
sudo php5enmod mcrypt
sudo a2enmod rewrite
Finally, restart the apache servcie with the following command:
sudo systemctl restart apache2
Access Snipe-IT Web
Once everything is configured. Open your web browser and type the URL http://your-server-ip, you should see the following Pre-Flight Check page:
HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/1989095703.png” alt=”” />
Make sure your configuration looks correct, then click on the Create Database Table
button you should see the following page:
HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/346811017.png” alt=”” />
Here, click on the Create User
button you should see the following page:
HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/10700819.png” alt=”” />
Here, provide all the details like, site name, email address, username and password, then click on the Save User
button you should see the Snipe-IT default dashboard in the following page:
HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/1884863982.png” alt=”” />
Thats it.
Congratulations! You have successfully installed Snipe-IT on your Ubuntu 16.04 server.