# Snipe-IT Installation on Ubuntu 24.04

This guide explains how to install **Snipe-IT**, a self-hosted IT asset management system, on **Ubuntu 24.04** using **Nginx**, **MariaDB**, and **PHP 8.3**.

<p class="callout info">Ref. [https://snipe-it.readme.io/docs/installation](https://snipe-it.readme.io/docs/installation)</p>

#### 📦 1. Update the System

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

#### 🌐 2. Install Required Packages

Install Nginx, PHP, MariaDB, and all required PHP extensions:

```
sudo apt install nginx mariadb-server 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 git -y
```

#### ⚙️ 3. Install Composer

```
sudo apt install composer -y
```

#### 🛢️ 4. Create the Snipe-IT Database

```
sudo mysql
```

Inside the MySQL shell:

```
CREATE DATABASE snipeit;
GRANT ALL ON snipeit.* TO 'snipeit'@'localhost' IDENTIFIED BY 'yourStrongPassword';
FLUSH PRIVILEGES; 
EXIT;
```

#### 📁 5. Download Snipe-IT

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

#### ⚙️ 6. Create and Configure `.env` File

```
sudo cp .env.example .env 
sudo nano .env
```

Edit the following variables:

```
APP_URL=http://your-server-ip 
DB_DATABASE=snipeit 
DB_USERNAME=snipeit 
DB_PASSWORD=yourStrongPassword
```

#### 🔒 7. Set Permissions

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

#### 🧱 8. Install Dependencies with Composer

```
sudo composer update --no-plugins --no-scripts 
sudo composer install --no-dev --prefer-source --no-plugins --no-scripts
```

#### 🔑 9. Generate App Key

```
sudo php artisan key:generate
```

<p class="callout warning">Make sure you keep a copy of your APP\_KEY in a safe place, for example, a secure password manager. This key is required to decrypt any encrypted fields in the database.</p>

#### 🧠 10. Check PHP FPM Version

```
sudo systemctl list-units --type=service | grep php
```

Ensure PHP 8.3 (or the current version) is installed and running.

#### ▶️ 11. Enable PHP-FPM

```
sudo systemctl start php8.3-fpm 
sudo systemctl enable php8.3-fpm
```

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-bash-copyedit-sudo-s"><div class="overflow-y-auto p-4" dir="ltr">  
</div></div>#### 🌐 12. Create Nginx Configuration for Snipe-IT

```
sudo nano /etc/nginx/conf.d/snipeit.conf
```

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-paste-the-following-"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary select-none rounded-t-2xl">Paste the following (adjust IP and PHP version if needed):</div></div>```
server {
        listen 80;
        server_name 10.0.0.7;
        root /var/www/html/snipe-it/public;
        
        index index.php;
                
        location / {
                try_files $uri $uri/ /index.php?$query_string;

        }
        
        location ~ \.php$ {
include fastcgi.conf;
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        }

}
```

#### 🔗 13. Enable the Site

```
sudo ln -s /etc/nginx/conf.d/snipeit.conf /etc/nginx/sites-enabled/snipeit.conf
```

#### ⚙️ 14. Update Nginx Config

Edit main config:

```
sudo nano /etc/nginx/nginx.conf
```

Add the following line **inside the `http` block**:

```
server_names_hash_bucket_size 64;
```

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-nginx-copyedit-serve"><div class="overflow-y-auto p-4" dir="ltr">  
</div></div>#### 🔄 15. Restart Nginx

```
sudo systemctl restart nginx
```

#### 🌐 16. Access Snipe-IT Web Interface

Open your browser and go to:

```
http://your-server-ip
```

Complete the web-based setup to finish the installation.