Skip to content

Installation Guide

Kavindu Sahan Silva edited this page Oct 24, 2025 · 2 revisions

πŸ“₯ Installation Guide

Complete guide to installing and setting up HealthFirst Hospital Management System.

πŸ“‹ Prerequisites

Required Software

Software Version Download Link
β˜• Java JDK 11+ Oracle JDK
πŸ—„οΈ MySQL 8.0+ MySQL Downloads
πŸ“¦ Maven 3.6+ Maven Downloads
πŸ’» IDE Latest IntelliJ IDEA
πŸ”§ Git Latest Git Downloads

System Requirements

  • RAM: Minimum 4GB (8GB recommended)
  • Storage: At least 2GB free space
  • OS: Windows 10+, macOS 10.14+, or Linux

πŸš€ Installation Steps

Step 1: Verify Prerequisites

# Check Java version
java -version
# Should show: java version "11.x.x" or higher

# Check Maven version
mvn -version
# Should show: Apache Maven 3.6.x or higher

# Check MySQL
mysql --version
# Should show: mysql Ver 8.0.x

Step 2: Clone Repository

# Clone the repository
git clone https://github.com/IT24102083/hospital-management-system.git

# Navigate to project directory
cd hospital-management-system

# Verify files
ls -la

Step 3: Database Setup

Option A: Using MySQL Command Line

# Login to MySQL
mysql -u root -p

# Create database
CREATE DATABASE IF NOT EXISTS hospital_management;

# Verify database creation
SHOW DATABASES;

# Exit MySQL
exit;

Option B: Using MySQL Workbench

  1. Open MySQL Workbench
  2. Connect to your local MySQL server
  3. Create new schema: hospital_management
  4. Execute the data.sql file from src/main/resources/

Import Sample Data

# Import sample data
mysql -u root -p hospital_management < src/main/resources/data.sql

# Verify data import
mysql -u root -p -e "USE hospital_management; SHOW TABLES;"

Step 4: Configure Application

  1. Open configuration file:

    nano src/main/resources/application.properties
  2. Update database credentials:

    spring.datasource.url=jdbc:mysql://localhost:3306/hospital_management?createDatabaseIfNotExist=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
    spring.datasource.username=root
    spring.datasource.password=YOUR_MYSQL_PASSWORD
  3. Configure email settings:

    spring.mail.username=your-email@gmail.com
    spring.mail.password=your-app-password

    πŸ’‘ Tip: Generate Gmail App Password at Google Account Security

  4. Set upload directory:

    app.upload.dir=uploads/medicines

Step 5: Build Project

# Clean and build
mvn clean install

# Skip tests for faster build (optional)
mvn clean install -DskipTests

Expected Output:

[INFO] BUILD SUCCESS
[INFO] Total time: 45.234 s

Step 6: Run Application

Option A: Using Maven

mvn spring-boot:run

Option B: Using JAR File

java -jar target/hospital-management-system-0.0.1-SNAPSHOT.jar

Option C: From IDE (IntelliJ IDEA)

  1. Open project in IntelliJ IDEA
  2. Wait for Maven dependencies to download
  3. Locate HospitalManagementSystemApplication.java
  4. Right-click β†’ Run 'HospitalManagementSystemApplication'

Step 7: Verify Installation

  1. Check console output:

    Started HospitalManagementSystemApplication in X.XXX seconds
    
  2. Access application:

  3. Test login:

    • Username: admin
    • Password: password

πŸ” Post-Installation Checks

Verify Database Connection

-- Login to MySQL
mysql -u root -p hospital_management

-- Check tables
SHOW TABLES;

-- Verify user data
SELECT * FROM users LIMIT 5;

Test Email Configuration

# Check logs for email service initialization
tail -f logs/application.log | grep "mail"

Verify File Upload Directory

# Check if directory exists
ls -la uploads/medicines/

# Create if not exists
mkdir -p uploads/medicines
chmod 755 uploads/medicines

πŸ› Common Installation Issues

Issue 1: Port 8080 Already in Use

# Find process using port 8080
lsof -i :8080

# Kill the process (replace PID)
kill -9 <PID>

# Or change port in application.properties
server.port=8081

Issue 2: MySQL Connection Failed

# Try adding these parameters
spring.datasource.url=jdbc:mysql://localhost:3306/hospital_management?allowPublicKeyRetrieval=true&useSSL=false

Issue 3: Maven Build Failed

# Clear Maven cache
rm -rf ~/.m2/repository

# Rebuild
mvn clean install -U

Issue 4: Permission Denied on Upload Directory

# Fix permissions
sudo chmod -R 755 uploads/
sudo chown -R $USER:$USER uploads/

πŸ”„ Updating the Application

# Pull latest changes
git pull origin main

# Rebuild
mvn clean install

# Restart application

🧹 Uninstallation

# Stop the application (Ctrl+C)

# Drop database
mysql -u root -p -e "DROP DATABASE hospital_management;"

# Remove project directory
cd ..
rm -rf hospital-management-system

πŸ“š Next Steps

πŸ’‘ Tips

  • Always use environment variables for sensitive data
  • Keep your MySQL password secure
  • Regularly backup your database
  • Monitor application logs for errors

Need Help? Troubleshooting Guide | FAQ

Clone this wiki locally