Linux Setup Guide

Installation and configuration for Salon Management on Linux

Prerequisites

Before installing Salon Management on Linux, ensure you have:

  • A current distribution (for example Ubuntu 20.04+, Debian 11+, CentOS/RHEL 8+, or Arch)
  • Root or sudo privileges
  • At least 4GB of RAM (8GB recommended)
  • Sufficient free disk space for Node dependencies and MySQL data
  • Internet access for packages
  • Comfort with the shell (bash or similar)

Step 1: Install Node.js

1

Update package lists

sudo apt update
2

Install Node.js 18+

Use NodeSource (or your distro’s LTS packages if they meet the version requirement):

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

Note

Salon Management expects a current Node.js (18+ recommended) and a matching npm.

3

Verify installation

node --version
npm --version
1

Install EPEL (if needed)

# CentOS 7
sudo yum install -y epel-release

# CentOS Stream / RHEL 8+
sudo dnf install -y epel-release
2

Install Node.js

# Example with dnf
sudo dnf install -y nodejs npm

Note

If the packaged Node.js is too old, install from NodeSource using the instructions for RHEL-based systems on NodeSource, similar to the Ubuntu flow.

1

Install Node.js

sudo pacman -S nodejs npm

Step 2: Install MySQL

1

Install MySQL Server

sudo apt install -y mysql-server
2

Secure MySQL (recommended)

sudo mysql_secure_installation
3

Start and enable MySQL

sudo systemctl start mysql
sudo systemctl enable mysql
1

Install MySQL Server

sudo dnf install -y mysql-server
2

Start and enable MySQL

sudo systemctl start mysqld
sudo systemctl enable mysqld
1

Install MySQL

sudo pacman -S mysql
2

Initialize and start (follow Arch Wiki if versions differ)

sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl start mysqld
sudo systemctl enable mysqld

Note

On Arch, prefer the Arch Wiki MySQL steps for your package version.

4

Create database and user

Match the database name and credentials to server/.env (example below uses salon_management and a dedicated MySQL user).

sudo mysql -u root -p

CREATE DATABASE salon_management CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE USER 'salon'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON salon_management.* TO 'salon'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Install Salon Management (server)

The application is a single Express server with EJS views and static assets—no separate frontend build step is required for local development.

1

Go to the server directory

cd /path/to/pdma_envato_salon_management/server
2

Install dependencies

npm install
3

Environment file

Copy the example file and edit values:

cp .env-example .env
nano .env

Example server/.env

NODE_ENV=development
PORT=3000

DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=salon_management
DB_USER=salon
DB_PASSWORD=your_secure_password

JWT_SECRET=your-strong-secret-change-in-production
JWT_EXPIRES_IN=7d

# Optional demo showcase (truncates data and re-seeds on a schedule)
# DEMO_SEED_CRON_ENABLED=true
# DEMO_SEED_CRON_TZ=UTC

Security

Use a long random JWT_SECRET in production. Restrict database user privileges to this database only.

4

Run migrations and seeders

npm run db:migrate
npm run db:seed

Seeders create roles, permissions, default settings, demo users, and sample data. For production, change passwords after first login.

5

Start the application

npm run dev

By default the app listens on http://127.0.0.1:3000 (or the port in PORT). The home route redirects to /auth/login.

Demo credentials (after seeding)

Password for all demo accounts: Admin@1234

  • Admin: admin@salon.com
  • Receptionist: reception@salon.com
  • Staff: staff@salon.com, staff02@salon.com, staff03@salon.com

Important

Change these passwords before any production use. If DEMO_SEED_CRON_ENABLED=true, demo data may reset periodically—disable for persistent installations. See also Home for an overview.

Step 4: Production with PM2

1

Install PM2 globally

sudo npm install -g pm2
2

Example ecosystem.config.js (in server/)

module.exports = {
  apps: [{
    name: 'salon-management',
    cwd: __dirname,
    script: './bin/www',
    instances: 1,
    autorestart: true,
    watch: false,
    max_memory_restart: '1G',
    env: {
      NODE_ENV: 'production',
      PORT: 3000
    }
  }]
};
3

Start with PM2

cd /path/to/pdma_envato_salon_management/server
pm2 start ecosystem.config.js
pm2 save
pm2 startup

Follow the command PM2 prints so the process restarts on boot.

4

Useful PM2 commands

pm2 list
pm2 logs salon-management
pm2 restart salon-management
pm2 stop salon-management

Reverse proxy

In production, place nginx or Apache in front of Node: terminate TLS, forward to 127.0.0.1:3000, and set NODE_ENV=production with a strong JWT_SECRET. See the server configuration guide.

Troubleshooting

Quick fixes

  • Permission denied: Check ownership of the project directory and use sudo only where appropriate.
  • Port in use: sudo ss -tulpn | grep :3000 to find the process using the API port.
  • MySQL connection errors: Confirm DB_HOST, DB_USER, DB_PASSWORD, and that the service is running: sudo systemctl status mysql or mysqld.
  • Migration errors: Ensure the database exists and the user has full rights on that database.

More help

See the troubleshooting guide.