keepcalculator

06 Numbers and Powers

Self-Host Snipe-IT Asset Management on a VPS

Card No. 06·41900 · Updated · Standard formula, shown below

This guide walks you through installing Snipe-IT, a free and open-source IT asset management system, on your own VPS. You’ll end up with a self-hosted web app to track hardware, software, licenses, and checkouts—no monthly per-seat fees. Before starting, you’ll need a VPS with at least 2 GB RAM, a domain name (or a subdomain) pointing to its IP, and basic comfort with the command line.

What You’ll Need

  • A VPS running Ubuntu 22.04 or 24.04 (other Debian-based distros work too)
  • Root or sudo access to that server
  • A domain or subdomain (e.g., assets.example.com) with an A record pointing to your VPS IP
  • An email address for the admin account (and optionally for mail notifications)
  • SSH client (Terminal on macOS/Linux, PuTTY on Windows)

Step-by-Step

  1. Update your server
    SSH into your VPS and run:
    sudo apt update && sudo apt upgrade -y
    This ensures all existing packages are current.
  2. Install required packages
    Snipe-IT needs a web server, PHP, a database, and some utilities. Install them with:
    sudo apt install -y apache2 mariadb-server php php-cli php-mysql php-mbstring php-xml php-curl php-zip php-bcmath php-gd php-intl unzip git curl
  3. Create a database and user
    Log into MariaDB as root:
    sudo mysql
    Then run these SQL commands (replace snipeit_user and strong_password with your own):
    CREATE DATABASE snipeit CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'snipeit_user'@'localhost' IDENTIFIED BY 'strong_password';
    GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeit_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  4. Download Snipe-IT
    Clone the latest release into /var/www:
    sudo git clone https://github.com/snipe/snipe-it /var/www/snipeit
    Then set the correct ownership:
    sudo chown -R www-data:www-data /var/www/snipeit
  5. Configure the environment file
    Copy the example config:
    sudo cp /var/www/snipeit/.env.example /var/www/snipeit/.env
    Edit it with nano or vim:
    sudo nano /var/www/snipeit/.env
    Set these values at minimum:
    APP_URL=http://assets.example.com
    DB_DATABASE=snipeit
    DB_USERNAME=snipeit_user
    DB_PASSWORD=strong_password
    Also set APP_ENV=production and APP_DEBUG=false. Save and exit.
  6. Install PHP dependencies
    Run Composer (the PHP package manager) to install required libraries:
    cd /var/www/snipeit
    sudo -u www-data composer install --no-dev --prefer-dist
    If Composer isn’t installed, get it with:
    sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
  7. Generate an app key
    Still in /var/www/snipeit, run:
    sudo -u www-data php artisan key:generate
    This writes a unique encryption key into your .env file.
  8. Set up Apache
    Create a virtual host file:
    sudo nano /etc/apache2/sites-available/snipeit.conf
    Paste this, adjusting ServerName to your domain:
    <VirtualHost *:80>
        ServerName assets.example.com
        DocumentRoot /var/www/snipeit/public
        <Directory /var/www/snipeit/public>
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

    Enable the site and the rewrite module:
    sudo a2ensite snipeit.conf
    sudo a2enmod rewrite
    Then reload Apache:
    sudo systemctl reload apache2

  9. Set file permissions
    Ensure the storage and bootstrap/cache directories are writable by the web server:
    sudo chown -R www-data:www-data /var/www/snipeit/storage /var/www/snipeit/bootstrap/cache
  10. Run the installer
    Open your browser and go to http://assets.example.com. You’ll see the Snipe-IT setup wizard. Follow the prompts: enter your database credentials (the ones you created), set your admin email and password, and complete the installation.
  11. Enable HTTPS (recommended)
    Install Certbot for Let’s Encrypt:
    sudo apt install -y certbot python3-certbot-apache
    Then run:
    sudo certbot --apache -d assets.example.com
    Follow the prompts to get a free SSL certificate. Certbot will automatically update your Apache config to use HTTPS.
  12. Set up a cron job
    Snipe-IT uses scheduled tasks for email notifications and other background jobs. Add a cron entry:
    sudo crontab -e
    Add this line (adjust the path if needed):
    * * * * * cd /var/www/snipeit && php artisan schedule:run >> /dev/null 2>&1
    Save and exit.

Common Mistakes

  • Forgetting to set file permissions – If you see a “storage directory not writable� error, you missed the chown step or did it before installing dependencies.
  • Using the wrong DB credentials – Double-check your .env file; a typo in the password will cause a connection error during setup.
  • Not enabling the rewrite module – Without a2enmod rewrite, you’ll get 404 errors on pages other than the home page.
  • Skipping the cron job – Email notifications and scheduled reports won’t work until you add the cron entry.
  • Leaving APP_DEBUG=true – In production, this exposes error details and can be a security risk.

Tips

  • Back up regularly – Snipe-IT stores everything in the database, so a nightly mysqldump is your best safety net. You can also back up the .env file and the storage folder.
  • Use a subdomain – Installing on a subdomain like assets.example.com keeps it separate from your main site and makes SSL easier.
  • Set up email – Configure SMTP in the .env file (e.g., using your email provider’s SMTP settings) so users can receive password resets and notifications.
  • Keep it updated – Snipe-IT releases security patches regularly. Check the GitHub releases page and update by pulling the latest code and running composer install again.
  • Use a strong admin password – Since this app manages your IT assets, treat it like a sensitive system.

Troubleshooting

  • “Connection refused� when accessing the site – Check that Apache is running: sudo systemctl status apache2. Also check your firewall (ufw) allows ports 80 and 443.
  • “500 Internal Server Error� – This usually means a PHP error. Check the Apache error log: sudo tail -f /var/log/apache2/error.log. Also verify that the .env file has no syntax errors.
  • “No application encryption key� – You forgot to run php artisan key:generate. Do that and restart Apache.
  • “Table not found� during setup – The installer expects an empty database. If you created tables earlier, drop them or create a fresh database.
  • CSS/JS not loading – If you’re using HTTPS but the site is trying to load resources over HTTP, make sure APP_URL starts with https:// after you enable SSL.
  • Email not sending – Check your SMTP settings in .env and test with php artisan tinker to send a test mail. Also confirm the cron job is running.

Frequently Asked Questions

Do I need a VPS, or can I use shared hosting?

A VPS is recommended because Snipe-IT requires PHP extensions and a database that most shared hosts don’t provide. A $5–$10 per month VPS is sufficient for small teams.

Can I use Nginx instead of Apache?

Yes, Snipe-IT works with Nginx too. You’ll need to configure PHP-FPM and set up a server block that points to the public directory. The official docs have an Nginx config example.

How do I update Snipe-IT?

Back up your database and .env file, then run git pull in /var/www/snipeit, run composer install --no-dev --prefer-dist, and then run php artisan migrate --force. Check the release notes for any extra steps.

Can I import assets from a CSV?

Yes, Snipe-IT has a built-in importer in the Admin panel. You can upload a CSV with columns like asset tag, name, serial, and category. The importer will guide you through mapping fields.

Is Snipe-IT free forever?

Yes, the core software is open-source under AGPL. You can host it yourself for free. There is also a paid cloud version, but self-hosting has no license fees.

What if I lose my admin password?

You can reset it from the command line. Run php artisan tinker in the Snipe-IT directory, then use App\Models\User::where('id', 1)->update(['password' => bcrypt('newpassword')]); to set a new one.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →