Manual Installation on LAMPP Stack (Apache2) Linux Server

Manual Installation on LAMPP Stack (Apache2) Linux Server

Posted on : 06 Dec, 2024    |    Last Update - 1 year ago   

How to Install the Web-Based Inventory System on a Linux Server (LAMPP Stack)

This guide explains how to perform a fresh installation of the Web-Based Inventory System on a Linux server (Debian/Ubuntu) with LAMPP Stack (Linux, Apache2, MySQL/MariaDB, PHP). Ensure your server meets the following requirements:

  • PHP Version: 8.2
  • Required Extensions: fileinfo, gd, intl, mbstring, exif, mysqli, pdo_mysql, sodium
  • Database: MySQL or MariaDB

Step 1: Install Required Packages

Update the system and install LAMPP components:

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mysql-server php8.2 libapache2-mod-php8.2 php8.2-cli php8.2-mysql php8.2-gd php8.2-intl php8.2-mbstring php8.2-exif php8.2-sodium -y

Step 2: Configure MySQL/MariaDB

Secure the MySQL installation and create the database for the application:

sudo mysql_secure_installation

# Log in to MySQL
sudo mysql -u root -p

# Create a new database and user
CREATE DATABASE inventory_db;
CREATE USER 'inventory_user'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON inventory_db.* TO 'inventory_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Deploy the Application Files

Download and place the application in the Apache web root:

sudo apt install unzip -y
wget https://github.com/YuukioFuyu/Inventaris-Barang/archive/refs/heads/main.zip
unzip main.zip
sudo mv Inventaris-Barang-main /var/www/inventory

Step 4: Set File Permissions

Ensure proper ownership and permissions for the web application:

sudo chown -R www-data:www-data /var/www/inventory
sudo chmod -R 755 /var/www/inventory

Step 5: Configure Apache2 VirtualHost

Create a VirtualHost for the application:

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

# Add the following content:
<VirtualHost *:80>
    ServerName inventory.example.com
    DocumentRoot /var/www/inventory
    <Directory /var/www/inventory>
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# Save and exit

Enable the site and restart Apache:

sudo a2ensite inventory.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 6: Import Database

Import the database schema into MySQL:

mysql -u inventory_user -p inventory_db < /var/www/inventory/database/inventory.sql

Step 7: Access the Application

Open your browser and navigate to http://inventory.example.com. Log in with the default credentials provided in the README file.


Cara Install Sistem Inventarisasi Barang Berbasis Web di Linux Server (LAMPP Stack)

Panduan ini menjelaskan cara instalasi baru untuk Sistem Inventarisasi Barang Berbasis Web pada server Linux (Debian/Ubuntu) dengan LAMPP Stack (Linux, Apache2, MySQL/MariaDB, PHP). Pastikan server Anda memenuhi persyaratan berikut:

  • Versi PHP: 8.2
  • Ekstensi yang Dibutuhkan: fileinfo, gd, intl, mbstring, exif, mysqli, pdo_mysql, sodium
  • Database: MySQL atau MariaDB

Langkah 1: Instalasi Paket yang Dibutuhkan

Perbarui sistem dan instal komponen LAMPP:

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mysql-server php8.2 libapache2-mod-php8.2 php8.2-cli php8.2-mysql php8.2-gd php8.2-intl php8.2-mbstring php8.2-exif php8.2-sodium -y

Langkah 2: Konfigurasi MySQL/MariaDB

Amankan instalasi MySQL dan buat database untuk aplikasi:

sudo mysql_secure_installation

# Masuk ke MySQL
sudo mysql -u root -p

# Buat database dan pengguna baru
CREATE DATABASE inventory_db;
CREATE USER 'inventory_user'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON inventory_db.* TO 'inventory_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Langkah 3: Unggah File Aplikasi

Unduh dan letakkan aplikasi di root web Apache:

sudo apt install unzip -y
wget https://github.com/YuukioFuyu/Inventaris-Barang/archive/refs/heads/main.zip
unzip main.zip
sudo mv Inventaris-Barang-main /var/www/inventory

Langkah 4: Atur Izin File

Pastikan kepemilikan dan izin file untuk aplikasi web:

sudo chown -R www-data:www-data /var/www/inventory
sudo chmod -R 755 /var/www/inventory

Langkah 5: Konfigurasi VirtualHost Apache2

Buat VirtualHost untuk aplikasi:

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

# Tambahkan konten berikut:
<VirtualHost *:80>
    ServerName inventory.example.com
    DocumentRoot /var/www/inventory
    <Directory /var/www/inventory>
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# Simpan dan keluar

Aktifkan situs dan restart Apache:

sudo a2ensite inventory.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Langkah 6: Impor Database

Impor skema database ke MySQL:

mysql -u inventory_user -p inventory_db < /var/www/inventory/database/inventory.sql

Langkah 7: Akses Aplikasi

Buka browser Anda dan akses http://inventory.example.com. Masuk dengan kredensial default yang tertera pada file README.

Still No Luck ? Contact via WhatsApp

Please do not delete the message template!

Open WhatsApp