
A Comprehensive Guide to Installing Snipe-IT on Debian & Ubuntu
Effectively managing IT assets is crucial for organizations of any size, but tracking hardware, software licenses, and accessories can quickly become a complex challenge. Snipe-IT is a powerful, free, and open-source IT asset management system designed to solve this problem. It provides a user-friendly web interface to track who has which asset, its physical location, purchase date, warranty information, and more.
This guide provides a detailed, step-by-step walkthrough for deploying Snipe-IT on a server running Debian 10 or Ubuntu 18.04/20.04. By following these instructions, you can set up a robust and reliable asset management platform.
Prerequisites
Before we begin, ensure your system meets the following requirements:
- A server running a fresh installation of Debian or Ubuntu.
- Root or sudo-level access to the server.
- A configured LAMP (Linux, Apache, MySQL, PHP) stack.
This guide assumes you have a basic LAMP stack installed. We will proceed with installing the necessary PHP extensions and configuring the environment specifically for Snipe-IT.
Step 1: Install PHP and Required Extensions
Snipe-IT has specific PHP extension requirements to function correctly. We’ll install these using the apt
package manager.
First, update your package list:
sudo apt update
Next, install PHP along with all the necessary extensions with a single command:
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-ldap
This command installs the core PHP modules required for database connectivity, image processing, LDAP integration, and other essential Snipe-IT functions.
Step 2: Create a Dedicated Database for Snipe-IT
For security and manageability, it’s best practice to create a separate MySQL database and user for the application.
Log in to your MySQL server as the root user:
sudo mysql -u root -p
From the MySQL prompt, create the database, user, and grant the necessary permissions. Remember to replace
'YourStrongPasswordHere'
with a secure, unique password.CREATE DATABASE snipeit_db; CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere'; GRANT ALL PRIVILEGES ON snipeit_db.* TO 'snipeit_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
This ensures that the Snipe-IT application has full control over its own database without having excessive permissions on the entire MySQL server.
Step 3: Download Snipe-IT from GitHub
The recommended method for downloading Snipe-IT is by cloning the official repository using Git. This makes future updates much easier.
First, install Git if it’s not already on your system:
sudo apt install git
Navigate to the webroot directory and clone the Snipe-IT project. We will place it in a subdirectory named
snipe-it
.
bash
cd /var/www/html
sudo git clone https://github.com/snipe/snipe-it snipe-it
Step 4: Configure the Environment File
Snipe-IT uses a .env
file to store all its critical configuration settings, including database credentials and your application URL.
Navigate into the newly created Snipe-IT directory:
cd /var/www/html/snipe-it
Copy the example configuration file to create your own:
sudo cp .env.example .env
Now, open the
.env
file for editing with your preferred text editor (e.g., nano):sudo nano .env
You must update the following key settings. Pay close attention to these details, as incorrect values are the most common cause of installation errors.
APP_URL
: Set this to the URL you will use to access Snipe-IT (e.g.,http://your-domain.com
orhttp://your-server-ip
).DB_DATABASE
: Set this to the database name you created (snipeit_db
).DB_USERNAME
: Set this to the database user you created (snipeit_user
).DB_PASSWORD
: Set this to the strong password you chose in Step 2.
Save and close the file after making your changes.
Step 5: Install Dependencies with Composer
Composer is a dependency manager for PHP that Snipe-IT uses to install and manage required libraries.
Install Composer globally on your system:
sudo apt install composer
Navigate to the Snipe-IT directory and run the Composer installer. The
--no-dev
flag ensures that packages required only for development are not installed, which is recommended for a production environment.cd /var/www/html/snipe-it sudo composer install --no-dev --prefer-source
After the dependencies are installed, generate the unique application key. This key is critical for securing user sessions and encrypted data.
bash
sudo php artisan key:generate
Step 6: Set Correct File Permissions and Ownership
The web server needs permission to write to certain directories within the Snipe-IT application folder. Incorrect permissions will cause application errors.
Change the ownership of the entire Snipe-IT directory to the web server user, which is typically
www-data
on Debian and Ubuntu systems.sudo chown -R www-data:www-data /var/www/html/snipe-it
Set the correct directory and file permissions:
bash
sudo chmod -R 755 /var/www/html/snipe-it
sudo chmod -R 775 /var/www/html/snipe-it/storage
sudo chmod -R 775 /var/www/html/snipe-it/public/uploads
sudo chmod -R 775 /var/www/html/snipe-it/bootstrap/cache
Step 7: Configure the Apache Virtual Host
To serve the Snipe-IT application, you need to create an Apache Virtual Host file that points your domain or IP to the correct directory.
Create a new Apache configuration file for Snipe-IT:
sudo nano /etc/apache2/sites-available/snipe-it.conf
Paste the following configuration into the file. Be sure to change
your-domain.com
to your actual domain or server IP address.<VirtualHost *:80> ServerName your-domain.com DocumentRoot /var/www/html/snipe-it/public <Directory /var/www/html/snipe-it/public> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
Enable the new site configuration and the Apache rewrite module, then restart Apache to apply the changes.
bash
sudo a2ensite snipe-it.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Finalizing the Installation: The Web-Based Pre-Flight Check
With the server-side configuration complete, the final steps are handled through Snipe-IT’s web installer.
- Open your web browser and navigate to the URL you configured in the
.env
file (e.g.,http://your-domain.com
). - You will be greeted by the “Pre-Flight Check” page. This page verifies that all server requirements, PHP extensions, and directory permissions are correctly configured. If you see any red “x” marks, go back and resolve the indicated issue before proceeding.
- Once all checks pass, click the button to proceed to the next step, where you will create your first administrator user account, set your site name, and finalize the setup.
Congratulations! You have successfully deployed Snipe-IT and are now ready to start adding assets, users, and licenses to streamline your IT management process.
Source: https://kifarunix.com/install-snipe-it-on-debian-10-ubuntu-18-04/