DEV Community

Megha Khateek
Megha Khateek

Posted on

How to Install Snipe-IT on Ubuntu 20.04

Snipe-IT is a powerful, open-source asset management system designed for IT teams to track and manage assets effectively. If you're looking to install Snipe-IT on Ubuntu 20.04, this guide will take you through the necessary steps, from setting up your environment to securing your installation.

Prerequisites

Before you begin, ensure you have:

  1. A fresh Ubuntu 20.04 server.
  2. A sudo user with administrative privileges. If you haven't set one up yet, check out this guide on creating a sudo user. 3 Image description. A fully configured LAMP stack (Linux, Apache, MySQL, PHP). You can refer to this detailed tutorial on installing a LAMP stack to get started.

Step 1: Update and Upgrade Your System

Before installing any software, update your system packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Snipe-IT requires several dependencies, including PHP, MySQL, and Composer. Install them using:

sudo apt install -y unzip curl git php php-cli php-mbstring php-xml php-bcmath php-tokenizer php-mysql php-curl php-zip apache2 mariadb-server

Step 3: Configure the Database

Start and secure the MySQL database:

sudo systemctl start mariadb
sudo mysql_secure_installation

Next, create a database and user for Snipe-IT:

mysql -u root -p
CREATE DATABASE snipeit;
CREATE USER 'snipeituser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeituser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Install Snipe-IT

Clone the Snipe-IT repository from GitHub:

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

Modify the .env file to match your database settings:

nano .env

Set the following values:

DB_DATABASE=snipeit
DB_USERNAME=snipeituser
DB_PASSWORD=strongpassword

Step 5: Install Composer and Dependencies

Run the following commands to install Composer and required PHP dependencies:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer install --no-dev --prefer-source

Step 6: Configure Apache

Create a virtual host configuration file:

sudo nano /etc/apache2/sites-available/snipeit.conf

Add the following content:


ServerAdmin admin@example.com
DocumentRoot /var/www/snipe-it/public
ServerName example.com

<Directory /var/www/snipe-it/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Enter fullscreen mode Exit fullscreen mode

Enable the site and necessary modules:

sudo a2ensite snipeit
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 7: Run Snipe-IT Installation

Generate an application key:

php artisan key:generate

Run migrations to finalize the database setup:

php artisan migrate --seed

Finally, set the necessary permissions:

sudo chown -R www-data:www-data /var/www/snipe-it
sudo chmod -R 775 /var/www/snipe-it/storage

Step 8: Access Snipe-IT

Open your web browser and go to http://your-server-ip to complete the installation via the web interface.

Conclusion

Congratulations! You have successfully installed Snipe-IT on Ubuntu 20.04. By following these steps, you've set up a powerful asset management system. For further optimizations and advanced configurations, check out this detailed Snipe-IT installation guide. Happy managing!

Top comments (0)