Installation

Open Source POS (OSPOS) is a web-based applicaton 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. Install Linux first, and then install Apache, MySQL, and PHP. You 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 $10 credit. We're going to assume for the rest of this tutorial that you've signed up for an account with DigitalOcean.

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 One click apps link.

One click apps link

Finally, click the LAMP on 16.04 app.

LAMP on Ubuntu 16.04

Scroll down, and choose a size. We recommend at least 1 GB, but 512 MB may work if your store is small enough.

Size - 1 GB

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

Datacenter region

Finally, you can choose a hostname.

Hostname

Now click the Create button to create your droplet.

Create 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.

You'll probably be disconnected. Try to connect again:

ssh root@104.236.75.129

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 php7.0-intl php7.0-mcrypt php7.0-bcmath php7.0-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 two files that are in there now.

rm index.html info.php

Now we want to download the latest released version of OSPOS (3.1.0). Type:

wget https://github.com/opensourcepos/opensourcepos/releases/download/3.1.1/opensourcepos.20170909085348.3.1.1.76a002.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.20170909085348.3.1.1.76a002.zip

Now we want to delete the zip file. Type:

rm opensourcepos.20170909085348.3.1.1.76a002.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 Nano. 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';
FLUSH PRIVILEGES;
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.

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. Then press Ctrl-x to exit, making sure you save your changes.

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

Login Form

Login using these credentials:

Username: admin
Password: pointofsale