Skip to content

Install on Cloud Server (LAMP Stack)

LAMP (Linux, Apache, MySQL, PHP) is a popular web server stack. This guide covers deploying bPass on cloud servers like DigitalOcean, AWS EC2, Vultr, or any Ubuntu/Debian server with Apache.

Prerequisites

  • A fresh Ubuntu 20.04+ or Debian 11+ server
  • Root or sudo access to the server
  • A domain name pointing to your server's IP address
  • Basic knowledge of Linux command line

Step 1: Prepare Your Server Environment

Update Your System

sudo apt update && sudo apt upgrade -y

Install Apache Web Server

# Install Apache
sudo apt install apache2 -y

# Enable Apache modules
sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2enmod headers

# Start and enable Apache
sudo systemctl start apache2
sudo systemctl enable apache2

# Check Apache status
sudo systemctl status apache2

Install MySQL Database Server

# Install MySQL
sudo apt install mysql-server -y

# Secure MySQL installation
sudo mysql_secure_installation

# Start and enable MySQL
sudo systemctl start mysql
sudo systemctl enable mysql

Install PHP 8.2+

# Add PHP repository
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

# Install PHP and required extensions
sudo apt install php8.2 php8.2-fpm php8.2-mysql php8.2-xml php8.2-gd \
php8.2-mbstring php8.2-tokenizer php8.2-json php8.2-bcmath php8.2-curl \
php8.2-zip php8.2-intl php8.2-readline php8.2-imagick libapache2-mod-php8.2 -y

# Check PHP version
php -v

Install Additional Tools

# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

# Install unzip
sudo apt install unzip -y

# Install Git (optional, but useful)
sudo apt install git -y

Step 2: Configure Apache Virtual Host

Create Directory for Your Application

# Create directory
sudo mkdir -p /var/www/bpass.yourdomain.com

# Set ownership
sudo chown -R $USER:www-data /var/www/bpass.yourdomain.com

Create Apache Virtual Host Configuration

sudo nano /etc/apache2/sites-available/bpass.yourdomain.com.conf

Add the following configuration (replace bpass.yourdomain.com with your actual domain):

<VirtualHost *:80>
    ServerName bpass.yourdomain.com
    ServerAlias www.bpass.yourdomain.com
    DocumentRoot /var/www/bpass.yourdomain.com/public

    <Directory /var/www/bpass.yourdomain.com/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/bpass_error.log
    CustomLog ${APACHE_LOG_DIR}/bpass_access.log combined
</VirtualHost>

Enable the Site

# Enable your site
sudo a2ensite bpass.yourdomain.com.conf

# Disable default Apache site (optional)
sudo a2dissite 000-default.conf

# Restart Apache
sudo systemctl restart apache2

Step 3: Set Up MySQL Database

Create Database and User

# Login to MySQL
sudo mysql -u root -p

# Create database and user
CREATE DATABASE bpass_db;
CREATE USER 'bpass_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON bpass_db.* TO 'bpass_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Upload and Deploy bPass

Upload Application Files

Option A: Using SCP from your local machine

# From your local machine
scp ~/Downloads/bpass/application.zip root@your-server-ip:/tmp/

Option B: Using wget/curl (if you have a direct download link)

# On your server
cd /tmp
wget https://yourdownloadlink.com/application.zip

Extract and Set Up Application

# Navigate to web directory
cd /var/www/bpass.yourdomain.com

# Extract application
sudo unzip /tmp/application.zip -d /var/www/bpass.yourdomain.com/
sudo mv /var/www/bpass.yourdomain.com/application/* /var/www/bpass.yourdomain.com/
sudo rmdir /var/www/bpass.yourdomain.com/application

# Set proper ownership and permissions
sudo chown -R www-data:www-data /var/www/bpass.yourdomain.com
sudo find /var/www/bpass.yourdomain.com -type f -exec chmod 644 {} \;
sudo find /var/www/bpass.yourdomain.com -type d -exec chmod 755 {} \;

# Make storage and cache directories writable
sudo chmod -R 775 /var/www/bpass.yourdomain.com/storage
sudo chmod -R 775 /var/www/bpass.yourdomain.com/bootstrap/cache

Install Composer Dependencies (if needed)

cd /var/www/bpass.yourdomain.com
sudo -u www-data composer install --optimize-autoloader --no-dev

Step 5: Configure Firewall

# Allow HTTP and HTTPS traffic
sudo ufw allow 'Apache Full'
sudo ufw allow ssh
sudo ufw enable

Step 6: Run the Web Installer

  1. Visit Your Domain: Open http://bpass.yourdomain.com in your browser
  2. Automatic Redirect: You'll be redirected to /install
  3. Follow Installation Steps:

Step 1 - License Agreement: - Accept the license terms - Set your timezone - Continue

Step 2 - System Requirements: - Verify all server requirements are met - Fix any issues if shown

Step 3 - File Permissions: - Ensure all directories have proper permissions - Fix permissions if needed:

sudo chmod -R 775 /var/www/bpass.yourdomain.com/storage
sudo chmod -R 775 /var/www/bpass.yourdomain.com/bootstrap/cache

Step 4 - Database Configuration: - Database Host: localhost - Database Name: bpass_db - Database Username: bpass_user - Database Password: Your database password - Test connection and continue

Step 5 - Complete Setup: - Configure email, storage, and queue settings - Complete the installation

Using Let's Encrypt (Free SSL)

# Install Certbot
sudo apt install certbot python3-certbot-apache -y

# Get SSL certificate
sudo certbot --apache -d bpass.yourdomain.com -d www.bpass.yourdomain.com

# Test automatic renewal
sudo certbot renew --dry-run

Update Apache Configuration for SSL

Your virtual host will be automatically updated, but you can verify:

sudo nano /etc/apache2/sites-available/bpass.yourdomain.com-le-ssl.conf

Step 8: Configure Cron Jobs for Laravel

# Edit crontab
sudo crontab -e

# Add Laravel scheduler
* * * * * cd /var/www/bpass.yourdomain.com && php artisan schedule:run >> /dev/null 2>&1

Step 9: Set Up Queue Worker (Optional)

For better performance, set up a queue worker:

# Create supervisor configuration
sudo nano /etc/supervisor/conf.d/bpass-worker.conf

Add the following:

[program:bpass-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/bpass.yourdomain.com/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/bpass.yourdomain.com/storage/logs/worker.log
# Update supervisor
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start bpass-worker:*

Troubleshooting

Common Issues

Apache Configuration Test:

sudo apache2ctl configtest

Check Apache Error Logs:

sudo tail -f /var/log/apache2/bpass_error.log

Fix Permissions Issues:

sudo chown -R www-data:www-data /var/www/bpass.yourdomain.com
sudo chmod -R 755 /var/www/bpass.yourdomain.com
sudo chmod -R 775 /var/www/bpass.yourdomain.com/storage
sudo chmod -R 775 /var/www/bpass.yourdomain.com/bootstrap/cache

MySQL Connection Issues:

# Test MySQL connection
mysql -u bpass_user -p bpass_db

Performance Optimization

Enable OPcache:

sudo nano /etc/php/8.2/apache2/php.ini

Add or uncomment:

opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=4000
opcache.revalidate_freq=2

Restart Apache:

sudo systemctl restart apache2

Your bPass installation on LAMP stack is now complete and optimized for production use!