Raspberry Pi with Raspbian Lite can be very versatile to install a number of useful services (see also my Raspberry Pi projects article). Some addictive features can be achieved by searching for open source software and testing it with this fantastic device. An interesting example is installing a complete open source hotel reservation and booking system with Raspberry Pi and Qloapps.
What is Qloapps?
- Launch hotel booking website
- Manage offline booking
- Partial payment booking
- Integrated payment gateway
- Multiroom/multihotel bookings in a single order
- Manage refund rules
More on Raspberry Pi
It is composed of a web front end, which is the page that customers can reach from the internet, and a web back-end, which is where hotel owners manage hotels, rooms, prices, and many other customizable options.
This project is very simple, and installing only remote web services means we need only a few cheap parts:
- Raspberry Pi 3 Model B* with power supply
- a micro SD card (at least 16GB recommended)
*I'm going to use a Raspberry Pi 3 Model B, but it should also work with Raspberry Pi 3 Model A+ or newer boards.
You will also need a Desktop PC with an SFTP software (for example, the free Filezilla) to transfer installation packages into your RPI.
We'll start by setting up a classic LAMP server, and then we'll set up database users and install Qloapps.
1. Install Raspbian Buster Lite OS:
For this step, refer to my Install Raspbian Buster Lite in your Raspberry Pi article.
Make sure that your system is up to date. Connect via ssh terminal and type the following commands:
sudo apt-get update sudo apt-get upgrade
2. Install LAMP server:
LAMP (Linux, Apache, MySQL, PHP) servers usually come with MySQL database. In our project, we'll use MariaDB instead because it is lighter and works fine with Raspberry Pi. This first part will be quick because there are plenty of good instructions for installing a LAMP server on the internet.
3. Install Apache Server:
sudo apt-get install apache2 -y
You should now be able to check that Apache installation has gone correctly by browsing http://<<YouRpiIPAddress>>:
4. Install PHP:
sudo apt-get install php -y
5. Install MariaDB Server and PHP connector:
sudo apt-get install mariadb-server php-mysql -y
6. Install PHPMyAdmin:
sudo apt-get install phpmyadmin
In the PHPMyAdmin setup screens, follow these instructions:
- Select Apache (mandatory) with space and press OK.
- Select Yes to configure the database for PHPMyAdmin with dbconfig-common.
- Insert your favorite PHPMyAdmin password and press OK.
- Insert your PHPMyAdmin password again to confirm and press OK.
7. Grant PHPMyAdmin user database privileges to manage databases:
We'll connect to MariaDB with the root user (default password is empty) to grant permissions. Remember to use semicolons at the end of each command row as shown below:
sudo mysql -uroot -p grant all privileges on *.* to 'phpmyadmin'@'localhost'; flush privileges;
Finally, restart Apache service:
sudo systemctl restart apache2.service
and check that PHPMyAdmin is working by browsing "http://<<YouRpiIPAddress>>/phpmyadmin/."
Default PHPMyAdmin login credentials are:
- user: phpmyadmin
- password: the one set up in phpmyadmin installation step
Installing other Qloapps required packages and setting up PHP
We need to prepare our system for the Qloapp installation check. So we have to install PHP Soap connector:
sudo apt-get install php-soap
Another requirement to pass the compliance check is editing the PHP max upload file size to 16 MB:
sudo nano /etc/php/7.3/apache2/php.ini
Look for the row with upload_max_filesize parameter and set it as the following:
upload_max_filesize = 16M
Qloapps also suggests the following change:
max_execution_time = 500
Save and exit. Restart Apache again:
sudo systemctl restart apache2.service
We'll follow the official Qloapps installation guide, with some minor changes to have a dedicated database application user.
Create database and set up user. Go back to the PHPMyAdmin web page (browse "http://<<YourRpiIPAddress>>/phpmyadmin/") and log in:
- user: phpmyadmin
- password: the one you set up in the PHPMyAdmin installation step
Click on Database tab:
Create a database and make a note of the database name, as you will require the same name in the further installation process:
It's time to create a database user for Qloapps. In this example, I'll use the following credentials; you can use a login of your own choosing.
- user: qloapps_db_user
- password: qloapps_db_password
So, the terminal commands will be:
sudo mysql -uroot -p CREATE USER ‘qloapps_db_user’@‘localhost’ IDENTIFIED BY ‘qloapps_db_password’; GRANT ALL PRIVILEGES ON qloapps_.* TO 'qloapps_db_user' @ 'localhost'; flush privileges; quit
(The root password is still empty, if not changed by you before)
Install Qloapps Software:
Download the Qloapps installation zip file from the Qloapps download page on your local PC. At the time of this writing, this file is named "HotelCommerce-1.4.0.zip."
With your favorite SFTP software, transfer the entire zip file to a new folder in path "/home/pi/download" in your Raspberry Pi. Common (default) SFP connection parameters are:
- host: your Raspberry Pi IP address
- user: pi
- password: raspberry (if you didn't change the pi default password)
- port: 22
Back to the terminal:
cd /home/pi/download/ #Enter directory where Qloapps installation files have been transferred unzip HotelCommerce-1.4.0.zip #Extracts all files from zip cd /var/www/html/ #Enter Apache web directory sudo rm index.html #Removes Apache default page - we'll use Qloapps one sudo cp -R /home/pi/download/HotelCommerce-1.4.0/hotelcommerce/* ./ #Copy installation files to web directory sudo chown -R www-data:www-data ./
Browse http://<<YourRpiIPAddress>> to start installation:
Select your favorite language and press Next.
Read the license agreement. If you agree, check the opposite flag and press Next.
At this step, you will need to enter your store details and the credentials by which you will access your store. At the end, press OK.
Edit database connection parameters according to what was defined in previous paragraphs. With the parameters used in this guide, I will edit:
- Database name: qloapps_ (added the final underscore)
- Database login: qloapps_db_user
- Database password: qloapps_db_password
Test the database connection and it should be okay. Click Next.
The installation seems to be finished correctly, but we must remove the install folder before entering Qloapps web pages. From the terminal, type:
sudo rm -R install/
With the command "ls" from the terminal, locate a folder whose name starts with "admin." In my case, the output is the following:
but the admin folder name can vary from installation to installation.
Now your booking web server is ready, and the pages will be:
- Front-end (for customers): http://<<YourRpiIPAddress>>
- Back-end (for administrators): http://<<YourRpiIPAddress>>/<<AdminFolderName>>
First, access to the back-end goes in demo mode. This can be disabled with the switch button on the right side of the page labeled "Demo mode."
To customize, please use the Qloapps user guide.