How To Install Snipe-IT on Ubuntu

Install Snipe-IT on Ubuntu

Managing IT assets can be a nightmare without the right tools. If you’re tired of tracking computers, servers, and software licenses using spreadsheets, it’s time to upgrade to a proper asset management system. Snipe-IT is one of the most popular open-source solutions that can transform how you handle your organization’s IT inventory.

In this comprehensive guide, I’ll walk you through every step of installing Snipe-IT on Ubuntu. Whether you’re running Ubuntu 20.04, 22.04, or 24.04, this tutorial will get you up and running with a professional asset management system in no time.

What is Snipe-IT and Why Should You Use It?

Snipe-IT is an open-source web-based application designed specifically for asset management. It focuses primarily on IT assets, making it the go-to choice for businesses that need to track and manage their hardware and software efficiently. The primary goal is to provide a centralized platform where you can monitor everything from computers and servers to software licenses and office equipment.

Key Features of Snipe-IT

Snipe-IT comes packed with features that make asset management a breeze:

  • Asset tracking and check-in/check-out system
  • License management for software
  • Warranty tracking and alerts
  • Depreciation calculations
  • Custom fields and categories
  • Reporting and audit trails
  • Mobile-responsive interface
  • REST API for integrations

Benefits for IT Asset Management

With Snipe-IT, you’ll gain complete transparency, security, and oversight of your IT assets. The system eliminates the need for complex spreadsheets and provides real-time visibility into who has what equipment, when warranties expire, and which software licenses are available.

System Requirements and Prerequisites

Before diving into the installation process, let’s make sure your system meets all the requirements.

Ubuntu Version Compatibility

Snipe-IT works excellently on various Ubuntu versions. The installation process is similar across different versions, with minor variations in package availability:

  • Ubuntu 20.04 LTS
  • Ubuntu 22.04 LTS
  • Ubuntu 24.04 LTS

Hardware Requirements

For a small to medium-sized organization, here are the minimum hardware requirements:

  • CPU: 2 cores (4 cores recommended)
  • RAM: 2GB minimum (4GB recommended)
  • Storage: 20GB available space
  • Network: Stable internet connection

Software Dependencies

Snipe-IT requires a LEMP stack (Linux, Nginx, MySQL/MariaDB, PHP). According to the official documentation, PHP version between 7.4 and 8.1.2 is required, though newer versions are also supported.

Preparing Your Ubuntu Server

Let’s start by getting your Ubuntu server ready for the installation.

Updating Your System

First things first – we need to update all existing packages on your system. This ensures you have the latest security patches and software versions.

sudo apt update -y && sudo apt upgrade -y

This command will update your package index and upgrade all installed packages. The -y flag automatically confirms all prompts, making the process smoother.

Creating a Sudo User

If you don’t already have a non-root user with sudo privileges, it’s a good security practice to create one. However, if you’re already using a sudo user, you can skip this step.

Installing the LEMP Stack

Snipe-IT requires a LEMP stack to function properly. Let’s install each component step by step.

Installing Nginx Web Server

Nginx will serve as our web server. It’s lightweight, fast, and perfect for hosting Snipe-IT.

sudo apt install nginx -y

After installation, enable and start the Nginx service:

sudo systemctl enable nginx
sudo systemctl start nginx

Installing MariaDB Database Server

Snipe-IT only supports MySQL/MariaDB databases, even though Laravel (the framework it’s built on) supports other database types. Let’s install MariaDB:

sudo apt install mariadb-server -y

The MariaDB service will start automatically after installation.

Installing PHP and Required Extensions

Ubuntu 22.04 ships with PHP 8.1.2 by default, which is perfect for Snipe-IT. We need to install PHP along with several extensions:

sudo apt install php php-bcmath php-common php-ctype php-curl php-fileinfo php-fpm php-gd php-iconv php-intl php-mbstring php-mysql php-soap php-xml php-xsl php-zip php-cli -y

This command installs PHP and all the extensions required by Snipe-IT. These extensions handle everything from image processing to database connections.

Installing PHP Composer

Composer is essential for managing Snipe-IT’s dependencies. While Ubuntu repositories include Composer, it’s often better to install the latest version directly from the official website.

Downloading Composer

First, download the Composer installer:

wget -O composer-setup.php https://getcomposer.org/installer

Setting Up Composer Globally

Now install Composer globally so it’s available system-wide:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Verify the installation by checking the version:

composer -V

You should see output similar to “Composer version 2.8.1”, confirming successful installation.

Database Configuration

Now let’s set up the database that Snipe-IT will use to store all your asset information.

Securing MariaDB Installation

First, secure your MariaDB installation by running the security script:

sudo mysql_secure_installation

This script will guide you through several security settings, including setting a root password and removing test databases.

Creating Snipe-IT Database

Connect to the MySQL shell as root:

mysql -u root -p

Create a dedicated database for Snipe-IT:

CREATE DATABASE snipeit;

Setting Up Database User Permissions

Create a dedicated user for Snipe-IT with appropriate permissions:

CREATE USER 'snipeituser'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeituser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Remember to replace ‘your_strong_password’ with a secure password. This follows security best practices by creating a dedicated database user instead of using the root account.

Downloading and Installing Snipe-IT

Now comes the exciting part – actually installing Snipe-IT!

Cloning the Snipe-IT Repository

Navigate to your web root directory and clone the latest Snipe-IT repository:

cd /var/www/
sudo git clone https://github.com/snipe/snipe-it snipe-it

This command clones the latest repository from GitHub and creates a snipe-it folder in your web directory.

Setting Up Directory Permissions

Change to the Snipe-IT directory and set proper ownership:

cd /var/www/snipe-it
sudo chown -R www-data:www-data /var/www/snipe-it
sudo chmod -R 755 /var/www/snipe-it

These permissions ensure that the web server can read and write to the necessary files.

Installing Dependencies with Composer

Install all PHP dependencies using Composer:

sudo -u www-data composer install --no-dev --prefer-source

This process might take a few minutes as Composer downloads and installs all required packages.

Configuring Snipe-IT

With the files in place, let’s configure Snipe-IT to work with your database and environment.

Setting Up Environment Variables

Snipe-IT ships with a sample configuration file. Copy it to create your actual configuration:

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

Edit the configuration file:

sudo nano /var/www/snipe-it/.env

Update the following settings in the file:

APP_URL=http://your-domain.com
APP_TIMEZONE='UTC'
DB_HOST=127.0.0.1
DB_DATABASE=snipeit
DB_USERNAME=snipeituser
DB_PASSWORD=your_strong_password

Set APP_URL to your server’s domain name or IP address. If you’re in a different timezone, change the timezone setting accordingly.

Generating Application Key

Generate a unique application key for your Snipe-IT installation:

sudo -u www-data php artisan key:generate

This key is used for encrypting session data and other sensitive information.

Database Migration

Run the database migrations to create all necessary tables:

sudo -u www-data php artisan migrate --force

This command creates all the database tables that Snipe-IT needs to store your asset information.

Web Server Configuration

Let’s configure Nginx to serve your Snipe-IT installation properly.

Creating Nginx Virtual Host

Create a new Nginx configuration file for Snipe-IT:

sudo nano /etc/nginx/sites-available/snipeit

Add the following configuration:

server {
    listen 80;
    server_name your-domain.com;
    root /var/www/snipe-it/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/snipeit /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Setting Up SSL (Optional)

For production environments, I strongly recommend setting up SSL using Let’s Encrypt or a commercial certificate. This encrypts all communication between users and your Snipe-IT installation.

Testing Configuration

Test your Nginx configuration for syntax errors:

sudo nginx -t

If everything looks good, you should see a message confirming the configuration is valid.

Completing Installation Through Web Interface

Now for the moment of truth – let’s complete the installation through the web interface!

Accessing the Web Installer

Open your web browser and navigate to your domain or IP address. You should see the Snipe-IT installation wizard.

Install Snipe-IT on Ubuntu

Database Connection Setup

The installer will guide you through several steps:

  1. Database configuration – Enter your database details
  2. Create database tables – Click “Next: Create Database Tables”
  3. User creation – Set up your admin account

Creating Admin User

Fill in all the required fields for your admin user, including:

  • First name and last name
  • Email address
  • Username
  • Password

Click “Next: Save User” to complete the setup.

Post-Installation Security and Optimization

Your Snipe-IT installation is now functional, but let’s implement some security measures and optimizations.

Securing File Permissions

Ensure that sensitive files have proper permissions:

sudo chmod 600 /var/www/snipe-it/.env
sudo chown www-data:www-data /var/www/snipe-it/storage -R
sudo chown www-data:www-data /var/www/snipe-it/bootstrap/cache -R

Setting Up Firewall Rules

If you’re using UFW (Uncomplicated Firewall), allow necessary ports:

sudo ufw allow 'Nginx Full'
sudo ufw allow ssh
sudo ufw enable

Performance Optimization Tips

For better performance, consider:

  • Enabling PHP OPcache
  • Setting up Redis for caching
  • Configuring proper backup schedules
  • Monitoring system resources

Troubleshooting Common Issues

Even with careful installation, you might encounter some issues. Here are solutions to common problems:

PHP Extension Errors

If you get errors about missing PHP extensions, double-check that all required extensions are installed:

php -m | grep -E "(curl|gd|mbstring|mysql|xml|zip)"

Database Connection Problems

Verify your database credentials in the .env file. Test the connection manually:

mysql -u snipeituser -p snipeit

Permission Issues

File permission problems are common. Ensure the web server can write to storage and cache directories:

sudo chmod -R 775 /var/www/snipe-it/storage
sudo chmod -R 775 /var/www/snipe-it/bootstrap/cache

Best Practices for Snipe-IT Management

Now that your installation is complete, here are some best practices to keep it running smoothly.

Regular Backups

Set up automated backups of both your Snipe-IT files and database. A simple cron job can handle this:

# Backup database daily at 2 AM
0 2 * * * mysqldump -u snipeituser -p snipeit > /backup/snipeit_$(date +\%Y\%m\%d).sql

Updating Snipe-IT

Keep your installation updated by regularly pulling updates from the GitHub repository. Always backup before updating:

cd /var/www/snipe-it
git pull origin master
composer install --no-dev --prefer-source
php artisan migrate

Monitoring and Maintenance

Monitor your server resources and set up log rotation for Snipe-IT logs. Regular maintenance ensures optimal performance and prevents issues before they become problems.

Frequently Asked Questions (FAQs)

Q1: What Ubuntu versions are compatible with Snipe-IT?
A: Snipe-IT works well on Ubuntu 20.04, 22.04, and 24.04 LTS versions. The installation process is very similar across these versions, with only minor differences in package availability.

Q2: Can I use MySQL instead of MariaDB for Snipe-IT?
A: Yes, Snipe-IT supports both MySQL and MariaDB databases. However, MariaDB is often preferred as it’s the default in most modern Ubuntu installations and offers better performance.

Q3: How much disk space does Snipe-IT require?
A: The base Snipe-IT installation requires about 500MB of disk space. However, you should plan for at least 20GB to accommodate asset images, uploaded files, backups, and system logs as your asset database grows.

Q4: Is it possible to install Snipe-IT using the automated installer script?
A: Yes, Snipe-IT provides an automated installation script that can be downloaded and executed with a simple command. However, manual installation gives you better control over the configuration and is recommended for production environments.

Q5: Can I migrate from spreadsheet-based asset tracking to Snipe-IT?
A: Absolutely! Snipe-IT provides import features that allow you to migrate data from CSV files and spreadsheets. You can import assets, users, and other data, making the transition from manual tracking systems smooth and efficient.

Marshall Anthony is a professional Linux DevOps writer with a passion for technology and innovation. With over 8 years of experience in the industry, he has become a go-to expert for anyone looking to learn more about Linux.

Related Posts