This brief post shows students and new users how to install BoxBilling on Ubuntu Linux with Apache HTTP web server. It also has a link to set up free Let’s Encrypt SSL certificates to secure your billing website.
BoxBilling is a free, open-source, and community-driven billing client management platform based on PHP and MySQL, and it is also capable of doing anything that is extensible for any need. If you want a trustworthy open-source platform to automate your invoicing, incoming payments, client management, and communication, then BoxBilling should be a great fit.
This tutorial is based on Ubuntu Linux. We’ll install an Apache web server, MariaDB database server, and additional PHP modules. We’ll also link to another post showing how to secure your BoxBilling website using Let’s Encrypt free SSL certificates.
For more about BoxBilling, please check its homepage
To get started with installing BoxBilling on Ubuntu Linux, follow the steps below:
How to install Apache on Ubuntu Linux
As mentioned above, we will use the Apache web server to run BoxBilling. BoxBilling requires a web server to function, and Apache is the most popular open-source web server available today.
To install Apache on Ubuntu, run the commands below:
sudo apt update sudo apt install apache2
After installing Apache, the commands below can stop, start, and enable Apache services to start up every time your server starts up.
sudo systemctl stop apache2.service sudo systemctl start apache2.service sudo systemctl enable apache2.service
To test whether Apache is installed and functioning, open your web browser and browse to the server’s IP address or hostname.
http://localhost

Apache works as expected if you see the above page in your browser.
How to install MariaDB on Ubuntu Linux
A database server is required for BoxBilling to function. This is because BoxBilling stores its content in a database, and MariaDB is probably the best database server to run BoxBilling.
MariaDB is fast, secure, and the default server for almost all Linux servers. To install MariaDB, run the commands below:
sudo apt install mariadb-server sudo apt install mariadb-client
After installing MariaDB, the commands below can stop, start, and enable MariaDB services to start up when the server boots.
sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation.
sudo mysql_secure_installation
When prompted, use the guide below to answer:
If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): PRESS ENTER Switch to unix_socket authentication [Y/n] n Change the root password? [Y/n] n Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y All done!
To verify and validate that MariaDB is installed and working, log in to the database console using the commands below:
sudo mysql -u root -p
You should automatically be logged in to the database server since we initiated the login request as root. This is because only the root can log in without a password and only from the server console.

The server was successfully installed if you see a similar screen.
How to install PHP on Ubuntu Linux
As mentioned above, we’re installing PHP on Ubuntu since BoxBilling requires it. Therefore, PHP packages are added to Ubuntu repositories. However, the versions of the repositories might not be the latest. If you need to install the latest versions, you’ll need to add a third-party PPA repository.
Run the commands below to a third-party repository with the latest versions of PHP.
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
At the time of this writing, the latest PHP version is 8.0.
sudo apt update
Next, run the commands below to install PHP 8.0 and related modules.
sudo apt install php8.0 php8.0-common php8.0-mysql php8.0-gmp php8.0-curl php8.0-intl php8.0-mbstring php8.0-xmlrpc php8.0-json php8.0-imap php8.0-gd php8.0-xml php8.0-cli php8.0-zip
Next, you’ll want to change some great PHP configuration settings with BoxBilling. First, run the commands below to open the PHP default configuration file.
sudo nano /etc/php/8.0/apache2/php.ini
Then, change the line settings to something like the lines below. Finally, save your changes and exit.
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 256M upload_max_filesize = 100M max_execution_time = 360 date.timezone = America/Chicago
How to create a BoxBilling database on Ubuntu
At this point, we’re ready to create the BoxBilling database. As mentioned above, BoxBilling uses databases to store its content.
To create a database for BoxBilling, run the commands below:
sudo mysql -u root -p
Then, create a database called boxbilling
CREATE DATABASE boxbilling;
Next, create a database user called boxbillinguser and set a password
CREATE USER 'boxbillinguser'@'localhost' IDENTIFIED BY 'new_password_here';
Then, the user will be granted full access to the database.
GRANT ALL ON boxbilling.* TO 'boxbillinguser'@'localhost' WITH GRANT OPTION;
Finally, save your changes and exit.
FLUSH PRIVILEGES; EXIT;
How to download BoxBilling
We’re ready to download BoxBilling and begin configuring it. But first, run the commands below to download the latest version of BoxBilling from its repository.
Next, extract the downloaded content into a new folder called boxbilling.
cd /tmp wget https://github.com/boxbilling/boxbilling/releases/download/4.22.1.3/BoxBilling.zip sudo mkdir -p /var/www/boxbilling unzip BoxBilling.zip -d /var/www/boxbilling sudo mkdir -p /var/www/boxbilling/bb-data/{cache,uploads}
Then, run the command below to allow the www-data user to own the new BoxBilling directory.
sudo chown -R www-data:www-data /var/www/boxbilling sudo chmod u+rw /var/www/boxbilling/bb-data/{cache,uploads}
How to configure Apache for BoxBilling
We have downloaded BoxBilling content into a new folder we called BoxBilling. Now, let’s configure Apache to create a new server block to use with our BoxBilling website. You can create as many server blocks as you want with Apache.
To do that, run the commands below to create a new configuration file called boxbilling. Conf in the /etc/apache2/sites-available/ directory to host our BoxBilling server block.
sudo nano /etc/apache2/sites-available/boxbilling.conf
In the file, copy and paste the content below into the file and save.
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com ServerAdmin admin@example.com DocumentRoot /var/www/boxbilling <Directory /var/www/boxbilling/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Save the file and exit.
After saving the file above, run the commands below to enable the new file that contains our BoxBilling server block. Restart Apache after that.
sudo a2ensite boxbilling.conf sudo a2enmod rewrite sudo systemctl restart apache2.service
At this stage, BoxBilling is ready and can be launched by going to the server’s IP or hostname.
http://localhost
However, we want to protect our server with Let’s Encrypt free SSL certificates. So, continue below to learn how to generate a Let’s Encrypt SSL certificate for websites.
How to setup Let’s Encrypt for BoxBilling
We have written a great post on generating and managing Let’s Encrypt SSL certificates for Apache web servers. You can use that post to apply it here for your BoxBilling website.
To read the post on how to generate Let’s Encrypt SSL certificates for a website, click on the link below:
How to Setup Let’s Encrypt on Ubuntu Linux with Apache – Website for Students
If you successfully generate a Let’s Encrypt SSL certificate, you should reopen the server block for our BoxBilling website by running the commands below.
sudo nano /etc/apache2/sites-available/boxbilling.conf
The new BoxBilling server block configurations should look similar to the line below. Take notes of the highlighted lines.
- The first server block listens on port 80. It contains a 301 redirect to redirect HTTP to HTTPS.
- The second server block listens on port 443. It contains a 301 redirect to redirect www to the non-www domain.
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ </VirtualHost> <VirtualHost *:443> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/boxbilling Protocols h2 http:/1.1 <If "%{HTTP_HOST} == 'www.example.com'"> Redirect permanent / https://example.com/ </If> ErrorLog ${APACHE_LOG_DIR}/example.com-error.log CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem" SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLCompression off SSLUseStapling on Header always set Strict-Transport-Security "max-age=63072000" <Directory /var/www/boxbilling/> Options FollowSymlinks AllowOverride All Require all granted </Directory> </VirtualHost>
Save the file above, then restart Apache and PHP using the commands below.
sudo systemctl reload apache2
Finally, if everything goes as planned, you can start the BoxBilling setup wizard by browsing the server hostname or IP address over HTTPS.
https://example.com/
A BoxBilling setup wizard should appear. Follow the wizard to complete the setup.
Validate that all requirements are met and click Next.

You will need to know the following items before proceeding. First, use the database connection info you created above.
- Database name
- Database Username
- Database password
- Database host

On the next page, create an administrator account. Username, email address, and password, then click Next.

BoxBilling should be successfully installed.

Even though BoxBilling was installed successfully, you must take a few more actions. Usually, the install folder should be automatically deleted. But if it still exists, you must delete the installer from your web server before starting.
sudo rm -rf /var/www/boxbilling/install
Change configuration file permissions to read-only (CHMOD 644)
sudo chmod 644 /var/www/boxbilling/bb-config.php
Setup this cron job to run every five minutes
*/5 * * * * php /var/www/boxbilling/bb-cron.php
When you’re done, BoxBilling should be installed and ready to use.

That should do it!
Conclusion:
- BoxBilling is a powerful, open-source client management platform for automating invoicing, payments, and client communication.
- The installation involves setting up the Apache web server, MariaDB database server, and PHP on Ubuntu, creating a BoxBilling database, and downloading the software.
- The configuration steps ensure that Apache is appropriately set up to serve BoxBilling, with a guide on obtaining and installing Let’s Encrypt SSL certificates for added security.
- After completing the installation, additional tasks such as deleting the installer folder, configuring file permissions, and setting up a cron job are necessary to ensure BoxBilling is fully operational.
Leave a Reply Cancel reply