Imagine a situation where you have a great product to sell and an already planned marketing campaign, but one thing is missing is an e-commerce website to sell your product. There are many types of online stores: Magento, OpenCart, CS Cart, Prestashop … where does the list end? While each is a great e-commerce solution that has its own standards, in this tutorial we will focus on installing a lightweight Open Source Commerce server (online store) on a Debian 8 VPS.
osCommerce is a complete online store solution that contains a frontend directory and an administration tool that can be easily installed and configured using the setup procedure.
It can be installed on any web server with PHP and MySQL, and it allows you to set up and maintain online stores very easily, almost effortlessly.
We will assume that you have already installed and configured on your server Apache, MySQL and PHP. If not, you can do it with our tutorial and install LAMP.
Login to your server via SSH
ssh [email protected]_ip
You can check if you have the correct Debian version installed on your server with the following command:
You should get this result:
Distributor ID: Debian Description: Debian GNU/Linux 8.3 (jessie) Release: 8.3 Codename: jessie
Update the system
Make sure your server is completely up to date with:
apt-get update && apt-get upgrade
Now create the database that will be needed to install the online store. Login to MySQL as root and run the following queries:
# mysql -u root -p mysql> CREATE DATABASE oscommerce; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES on oscommerce.* to [email protected] identified by 'your_password'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> quit; Bye
Change to the default document root in Apache ( / var / www / html / ) and download the latest version of the online store (at the time of this writing, the latest version is 2.3.4):
cd /var/www/html/ wget http://www.oscommerce.com/files/oscommerce-2.3.4.zip
Unpack the archive:
Rename the unpacked directory:
Give the appropriate permissions to the files below so your web server can save the installation settings. Run the following commands:
chmod 777 /var/www/html/oscommerce/catalog/includes/configure.php chmod 777 /var/www/html/oscommerce/catalog/admin/includes/configure.php
Now open your web browser and go to the following URL http: //your_IP_address/oscommerce/catalog/install/index.php. You will be greeted at the installation page of the online store, as shown in the picture:
Of course, PHP settings and required PHP extensions must be enabled / installed in order for you to proceed with the installation. If everything is ok, press Startto proceed with the installation. The next step is to configure the database. Enter your database credentials as shown in the image below:
Then a page will open where you can configure the storage settings. Fill in the fields according to your needs and complete the installation.
Your store will be available at: http: //your_server_IP/oscommerce/catalog/index.php and login to the online store admin panel at: http: //your_server_IP/oscommerce/catalog/admin/login.php.
Now you need to delete the directory installations, set the correct permissions for some files, and protect administration tools. Run the commands below:
rm -rf /var/www/html/oscommerce/catalog/install/ chmod 644 /var/www/html/oscommerce/catalog/includes/configure.php chmod 644 /var/www/html/oscommerce/catalog/admin/includes/configure.php
Now let’s password protect the online store administration panel using the Htpasswd utility. Let’s execute:
htpasswd -c /var/www/html/oscommerce/catalog/admin/.htpasswd your_user
You will now be prompted to enter your password twice. After entering the password, you can check if the credentials were entered as expected:
Now you need to configure the Apache web server to check the .htpasswd file. Open the default Apache config file with your editor. We are using nano:
Insert the following text in the VirtualHost directive:
<Directory "/var/www/html"> AuthType Basic AuthName "Restricted Content" AuthUserFile /var/www/html/oscommerce/catalog/admin/.htpasswd Require valid-user </Directory>
Save and close the file. Now restart Apache for the changes to take effect.
service apache2 restart
Now you can open the admin panel at http: //your_server_IP/oscommerce/catalog/admin/login.php, after which you will need to enter your username and password.
Congratulations, you have successfully installed online store on your Debian 8 VPS.