Installation

Open Source POS (OSPOS) is a web-based application that runs on top of a LAMP server. That means you have to install the LAMP software as well as OSPOS.

LAMP stands for Linux, Apache, MySQL, and PHP. Linux is the operating system; Apache is the web server; MySQL is the relational database management system (RDBMS); and PHP Is the programming language. Note: you don't have to know how all these systems work to run OSPOS. You just need to install them.

You can run LAMP locally if you want. Install Linux first, and then install Apache, MySQL, and PHP. You can also install Apache, MySQL, and PHP on Windows and Mac, though OSPOS is meant to be run on Linux.

The easiest way to run a LAMP stack is to sign up for an account with DigitalOcean. This will give you access to a LAMP virtual private server (VPS) that you can install OSPOS on. If you sign up through our link, you'll get a $50 credit.

We're going to assume for the rest of this tutorial that you've signed up for an account with DigitalOcean. If you're using a different server, you can still follow the tutorial.

Create a Server

Once you're logged into DigitalOcean, click the Create button in the top right hand corner, and choose Droplets from the dropdown menu.

Create button

Then click the Droplets Create cloud servers link.

Droplets Create cloud servers link

Then click the Marketplace tab.

Marketplace Link

Look for the LAMP on 18.04 app, and click it.

LAMP on Ubuntu 18.04

Scroll down, and choose a size.

10 Dollars Per Month Plan

Then scroll down to Choose a datacenter region. Select the region closest to you.

Toronto datacenter

Next, choose an authentication method. SSH keys are more secure. Feel free to set them up if you want. I'll just use a password for this walkthrough. Click One-time password.

One-time password

Finally, you can choose a hostname.

Hostname

Now click the Create Droplet button to create your droplet.

Create Droplet button

When your droplet has been created, you'll receive an email from DigitalOcean.

DigitalOcean email

Log in to Your Server

You now have the information needed to log in to your server. If you have Mac or Linux, you can use the built-in terminal program.  If you have Windows, you'll want to install an SSH client, such as Putty.

If you're using Terminal, type:

ssh root@104.236.75.129

Note: replace 104.236.75.129 with your IP address.

It'll probably tell you that the authenticity of your host can't be established. Type yes to continue connecting anyway.

It'll now ask you for your password. Enter your password from the email.

Then you'll have to change your password. Enter your current password, and then enter your new password twice.

You're now logged in to your server as root.

Install Needed Software

This guide shows you the easiest way to get OSPOS up and running on your server. DigitalOcean has many guides about Linux administration that can help you learn more.

First we want to make sure all your software is up to date. Type:

apt-get update
apt-get dist-upgrade

Click Y when it asks if you want to continue. Press Enter if it asks you about any new versions of software.

Next we want to enable and/or install some modules.

First we want to enable the mod-rewrite module. Type:

a2enmod rewrite

Now we want to install some PHP modules. Type:

apt-get install php-bcmath php-intl php-mbstring php-curl

Type "Y" when it asks if you want to continue.

Then we want to restart the Apache web server. Type:

service apache2 restart

Download OSPOS

You're now ready to download OSPOS. Start by changing to the var/www/html directory. Type:

cd /var/www/html

Then we want to delete the file that is in there now.

rm index.html

Now we want to download the latest released version of OSPOS from the official repository's releases page. Type:

wget https://github.com/opensourcepos/opensourcepos/releases/download/3.3.1/opensourcepos.20191214181241.3.3.1.c786d4.zip

To extract it, you need to install the zip program. Type:

apt-get install zip

Type "Y" when it asks if you want to continue. Now you want to unzip the file. Type:

unzip opensourcepos.20191214181241.3.3.1.c786d4.zip

Now we want to delete the zip file. Type:

rm opensourcepos.20191214181241.3.3.1.c786d4.zip

Finally, we want to change the document root. Type:

cd /etc/apache2/sites-available

We want to edit the 000-default.conf file using the Nano text editor. Type:

nano 000-default.conf

Change the DocumentRoot from /var/www/html to /var/www/html/public.

(Note: Make sure you have set up .htaccess files for the html directory. DigitalOcean does this for you automatically.)

Press Ctrl-x to exit. Make sure you save your changes.

Now we want to restart the Apache web server. Type:

service apache2 restart

Configure OSPOS

We need to know our MySQL root password. DigitalOcean has stored it for us in the file system. Type:

cat /root/.digitalocean_password

Copy and paste what's between the quotation marks. Now we want to log in to MySQL. Type:

mysql -u root -p

Paste or enter your password when you're prompted. This will log you into the MySQL command prompot.

You'll want to enter the following SQL commands. (Note: "pointofsale" is your password. Feel to create a more secure password if you want.) Type:

CREATE DATABASE ospos;
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'pointofsale';
GRANT ALL PRIVILEGES ON ospos.* TO 'admin'@'localhost';
 
quit

This will log you out of MySQL. Now we want to import the OSPOS database.sql file. Type:

cd /var/www/html/database
mysql -u admin -p ospos < database.sql

Enter your password when you're prompted ("pointofsale" if you used the SQL code above).

Now you want to edit your configuration files. Type:

cd ../application/config

If you used different database credentials, type:

nano database.php

Scroll down, and update the database connection. Look for some code that says $db['default']. Replace the username, password, and database with your credentials.

Press Ctrl-x to exit. Make sure you save your changes.

Now you want to add your encryption key. You can generate a CodeIgniter encryption key automatically using the Random Key Generator website. Type:

nano config.php

Find the code that says $config['encryption_key'] and add your key between the empty quotes. Then press Ctrl-x to exit, making sure you save your changes.

Finally, type:

cd /var/www/html

Then change the owner of the files by typing:

chown -R www-data:www-data .

(Make sure you include the little dot at the end.)

Now you can visit your IP address in your browser. When you do, you'll see a login form.

Login Screen v3.3.1

Login using these credentials:

Username: admin
Password: pointofsale

If you get kicked out after the database migration, just sign in again.