Saturday, December 28, 2024

Here’s a step-by-step guide to installing FOSSBilling

1. Preparation
System Requirements
Server Environment:
Linux OS (recommended: Ubuntu or CentOS).
LAMP stack (Linux, Apache, MySQL, PHP).
PHP Version: 7.4 or higher.
MySQL Version: 5.7+ or MariaDB 10.3+.
Web Server: Apache or Nginx.
Required PHP Extensions:
CURL, GD, ZIP, PDO, OpenSSL, MBString, etc.
Tools Required
SSH client (e.g., PuTTY or Terminal).
FTP client (e.g., FileZilla) or terminal file operations.
2. Set Up Your Server Environment
Install Apache, MySQL, and PHP
On Debian/Ubuntu-based systems:

sudo apt update
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql php-curl php-zip php-xml php-mbstring php-gd unzip -y

On CentOS/RHEL-based systems:

sudo yum update
sudo yum install httpd mariadb-server php php-mysqlnd php-curl php-zip php-xml php-mbstring php-gd unzip -y

Start and Enable Services

sudo systemctl start apache2      # For Ubuntu
sudo systemctl start httpd        # For CentOS
sudo systemctl enable mysql
sudo systemctl enable apache2     # For Ubuntu
sudo systemctl enable httpd       # For CentOS

3. Download FOSSBilling
Download Installation Files
1.Clone the latest version using Git:

git clone https://github.com/FOSSBilling/FOSSBilling.git /var/www/html/fossbilling

2.Or download via wget:

wget https://github.com/FOSSBilling/FOSSBilling/archive/refs/heads/main.zip
unzip main.zip
mv FOSSBilling-main /var/www/html/fossbilling

Set File Permissions

sudo chown -R www-data:www-data /var/www/html/fossbilling
sudo chmod -R 755 /var/www/html/fossbilling

4. Configure MySQL Database
1.Log in to MySQL:

sudo mysql -u root -p

2.Create a new database and user:

CREATE DATABASE fossbilling;
CREATE USER 'fossuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON fossbilling.* TO 'fossuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

5. Configure Apache or Nginx
Apache Configuration
1.Create a virtual host configuration file:

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

2.Add the following content:

<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/html/fossbilling
    <Directory /var/www/html/fossbilling>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/fossbilling_error.log
    CustomLog ${APACHE_LOG_DIR}/fossbilling_access.log combined
</VirtualHost>

3.Enable the virtual host and restart Apache:

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

Nginx Configuration
Refer to the official FOSSBilling documentation for Nginx configuration.

6. Run the Installation Wizard
1.Open your browser and navigate to your server address:

Example: http://yourdomain.com or http://your-server-ip
2.Follow the on-screen instructions:

Enter the database details (name, username, password).
Set up the admin account.
3.Once completed, FOSSBilling will initialize and prepare the system.

7. Secure the Installation
Remove the Installation Directory
To enhance security, delete the installation folder:

sudo rm -rf /var/www/html/fossbilling/install

Enable HTTPS
Use Let’s Encrypt for a free SSL certificate:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

8. Access the Admin Panel
1.Open the FOSSBilling admin panel in your browser:

Example: http://yourdomain.com/admin
2.Log in with the admin credentials created during setup.

3.Configure products, services, and payment gateways from the admin interface.

Common Issues and Solutions
1.Page Not Loading or 500 Errors:

Ensure all required PHP extensions are installed.
Check the Apache or Nginx logs for errors.
2.Database Connection Failure:

Verify database username, password, and host.
Ensure the MySQL service is running.
3.Permission Issues:

Double-check file ownership and permissions.
Summary
After completing the installation, regularly update both FOSSBilling and your server environment to maintain security and performance. The admin panel provides a user-friendly interface for managing clients, services, and billing.