How to install and configure PrestaShop on Ubuntu 14.04

How to install and configure PrestaShop on Ubuntu 14.04

Version 1.0

This document describes how to install and configure PrestaShop on Ubuntu 14.04.  PrestaShop is a free, open source e-commerce solution. It supports payment gateways such as DirecPay, Google Checkout, Authorize.Net, Skrill, PayPal, PayPal Payments Pro (Direct) and EBANX Checkout via their respective APIs. Further payment modules are offered commercially.

PrestaShop is available under the Open Software License and officially launched in August 2007. The software, which is written in PHP and based on the Smarty template engine, is currently used by 165,000 shops worldwide. MySQL is the default database engine. PrestaShop is the winner of the 2010 and 2011 Best Open-source Business Application awards.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

This tutorial is based on Ubuntu 14.04 server, so you should set up a basic Ubuntu 14.04 server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname.  You must have a LAMP server installed in Ubuntu 14.04 as mentioned in the tutorial to continue further.

2 Download

Download the package PrestaShop

cd /tmp
wget http://www.prestashop.com/download/old/prestashop_1.6.0.9.zip

apt-get install unzip

Extract the file in the /var/www/html folder

unzip prestashop_1.6.0.9.zip -d /var/www/html/

Appropriate permissions for PrestaShop needs to be done, as follows:

chown -R www-data:www-data /var/www/html/prestashop/

3 Database initialization

We need a database for PrestaShop, I will create  the database for the PrestaShop as follows:

mysql -u root -p

Here we are adding database=prestashopdb user=prestashopuser and password=prestashoppassword:

CREATE DATABASE prestashopdb;
CREATE USER prestashopuser@localhost IDENTIFIED BY ‘prestashoppassword’;
GRANT ALL PRIVILEGES on prestashopdb.* to prestashopuser@localhost

Further moving ahead:

FLUSH PRIVILEGES;
exit

Restart services

service apache2 restart
service mysql restart

3 Web installation of PrestaShop

Now we will proceed with the PrestaShop web-installation. Open a browser of your choice and open the link http:192.168.0.100/prestashop/install

Select your language and press Next:

Select the check-box for accepting terms and conditions. Press Next:

Here setup will check your system-requirements for the PrestaShop, Press Next:

 

Now fill the entries as per your choice, as in my case I am using:

Shop name  :  Test-prestashop (Any name of your choice)
Main Activity  :  Computer and hardware ( As per your choice and requirement)
Country  :  Germany (Any value as per your choice)
First Name  :  Srijan (Any value as per your choice)
Last Name  :  Kishore (Any value as per your choice)
Shop password  :  howtoforge (Any value as per your choice)

Next we need to give the entries for the database to be used by PrestaShop, give the values as per the database created at your system. In m y case I will be using these values:

Database server address  :  localhost
Database name  :  prestashopdb
Database login  :  prestashopuser
Database password  :  prestashoppassword
Table prefix  :  ps_  or and value of your choice

After giving the values press Press your database connection now:

It will check the connectivity, after successful connection press Next:

It will initiate the installation.

The above screenshot shows the successful PrestaShop installation.

Next we need to remove the installation folder to proceed further, as follows:

rm -r /var/www/html/prestashop/install/

4 PrestaShop optimization

We can access the backend admin page of PrestaShop at URL http://192.168.0.100/prestashop/admin3403/index.php:

Put the credentials as selected at the time of installation. In my case it was admin@example.com and howtoforge.

It will be your default welcome screen.

Next Goto ADVANCED PARAMETERS, press Clear cache and  within CACHING select Use cache YES and press Save:

Now we are ready for the frontend, we can access it at http://192.168.0.100/prestashop/index.php:

Congratulations! You now we have a fully functional PrestaShop instance on our Ubuntu 14.04 🙂

5 Links

How to create a jailed ssh user with Jailkit on Debian Wheezy

How to create a jailed ssh user with Jailkit on Debian Wheezy

 

This document describes how to install and configure Jailkit in Debian Wheezy Server.  Jailkit is a set of utilities to limit user accounts to specific files using chroot() and or specific commands. Setting up a chroot shell, a shell limited to some specific command, or a daemon inside a chroot jail is a lot easier and can be automated using these utilities.

Jailkit is known to be used in network security appliances from several leading IT security firms, internet servers from several large enterprise organizations, internet servers from internet service providers, as well as many smaller companies and private users that need to secure cvs, sftp, shell or daemon processes.

1 Preliminary Note

This tutorial is based on Debian 7.6 server, so you should set up a basic Debian 7.6 server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname.

2 Install Jailkit

We will first download and install the Jailkit. At present time of writing this guide the latest available version of Jailkit is 2.17. I will download it and install it as follows:

cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.17.tar.gz
tar xvfz jailkit-2.17.tar.gz
cd jailkit-2.17

Jailkit requires some packages before its installation, we will install them as follows:

apt-get install build-essential autoconf automake1.9 libtool flex bison debhelper binutils-gold python

Now our system is ready to install the Jailkit, install it as follows:

./debian/rules binary
cd ..
dpkg -i jailkit_2.17-1_amd64.deb

It will install the Jailkit in Debian Server, we can remove the extra packages from /tmp:

rm -rf /tmp/jailkit*

3 Jailing a user

Now we will create  a user which will be jailed using Jailkit as:

adduser srijan

root@server1:~#adduser srijan
Adding user `srijan’ …
Adding new group `srijan’ (1001) …
Adding new user `srijan’ (1001) with group `srijan’ …
Creating home directory `/home/srijan’ …
Copying files from `/etc/skel’ …
Enter new UNIX password: –password
Retype new UNIX password:–password
passwd: password updated successfully
Changing the user information for srijan
Enter the new value, or press ENTER for the default
Full Name []: –ENTER
Room Number []:–ENTER
Work Phone []:–ENTER
Home Phone []:–ENTER
Other []:–ENTER
Is the information correct? [Y/n] –Y
root@server1:~#

In my case I am creating the user srijan, you can use any name.

Next we will check the information about user srijan in /etc/passwd as:

egrep srijan /etc/passwd

root@server1:/tmp# egrep srijan /etc/passwd
srijan:x:1001:1001:,,,:/home/srijan:/bin/bash
root@server1:/tmp#

Next we will jail the created user. Create a directory /jail for Jail environment:

mkdir /jail

Now we will provide the Jail with some of the default programs environment as:

jk_init -v /opt/jail netutils basicshell jk_lsh openvpn ssh sftp

We can give other values also, the complete list of the Jail environment can be checked in the file

nano /etc/jailkit/jk_init.ini

Now Jail is ready, just add the user inside the environment:

jk_jailuser -m -j /jail/ srijan

Again check the values in /etc/passwd for user srijan:

egrep srijan /etc/passwd

root@server1:/tmp# egrep srijan /etc/passwd
srijan:x:1001:1001:,,,:/jail/./home/srijan:/usr/sbin/jk_chrootsh
root@server1:/tmp#

Now our user have been added in the Jailed environment. I will connect the Debian server with bash terminal with its IP 192.168.0.100:

ssh srijan@192.168.0.100

root@server1:~$ ssh srijan@192.168.0.100
The authenticity of host ‘192.168.0.100 (192.168.0.100)’ can’t be established.
ECDSA key fingerprint is 3d:ca:91:67:96:39:15:b4:0f:6e:c8:2c:92:ef:25:d7.
Are you sure you want to continue connecting (yes/no)? yes
srijan@192.168.0.100’s password:
Linux server1 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Connection to 192.168.0.100 closed.
root@server1:~$

Connection is getting closed as the user don’t have logging shell, lets add it in the configuration file for Jail:

nano /jail/etc/passwd

root:x:0:0:root:/root:/bin/bash
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
#srijan:x:1001:1001:,,,:/home/srijan:/usr/sbin/jk_lsh
srijan:x:1001:1001:,,,:/home/srijan:/bin/bash

It will add the bash prompt for the jailed user srijan.  Now again try the ssh login with srijan user and you will be able to login:

ssh srijan@192.168.0.100

Now check the root directory content, you will notice that it have contents like this:

ls /

srijan@server1:~$ ls /
bin  dev  etc  home  lib  lib64  usr
srijan@server1:~$

4 Running services and commands in Jailed environment

Jail can be used to run services in Jailed environment. Suppose we want to run any service in Jailed environment then we will use jk_chrootlaunch command for that:

jk_chrootlaunch -j /jail -u srijan -x ‘service apache2 start’

Here I am starting the service of Apache, similarly you can run any service or daemon with it in Jailed environment.

Suppose we want to run a particular command in Jail environment then we will use jk_cp. Lets test it in Jailed environment when we will run cal then it shows as follows:

cal

srijan@server1:~$ cal
bash: cal: command not found
srijan@server1:~$

It means Jail environment don’t knows the cal command, now I will add it in Debian Server as follows:

jk_cp  -v -j /jail/ /usr/bin/cal

root@server1:~# jk_cp  -v -j /jail/ /usr/bin/cal
Creating symlink /jail/usr/bin/cal to ncal
Copying /usr/bin/ncal to /jail/usr/bin/ncal
Creating symlink /jail/lib/x86_64-linux-gnu/libncurses.so.5 to libncurses.so.5.9
Copying /lib/x86_64-linux-gnu/libncurses.so.5.9 to /jail/lib/x86_64-linux-gnu/libncurses.so.5.9
/jail/lib/x86_64-linux-gnu/libtinfo.so.5 already exists, will not touch it
/jail/lib/x86_64-linux-gnu/libc.so.6 already exists, will not touch it
/jail/lib/x86_64-linux-gnu/libdl.so.2 already exists, will not touch it
/jail/lib64/ld-linux-x86-64.so.2 already exists, will not touch it
/jail/lib/x86_64-linux-gnu/libtinfo.so.5 already exists, will not touch it
/jail/lib/x86_64-linux-gnu/libc.so.6 already exists, will not touch it
/jail/lib/x86_64-linux-gnu/libdl.so.2 already exists, will not touch it
/jail/lib64/ld-linux-x86-64.so.2 already exists, will not touch it
root@server1:~#

Again run the cal command in Jailed environment:

cal

srijan@server1:~$ cal
September 2014
Su Mo Tu We Th Fr Sa
1  2  3  4  5  6
7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

srijan@server1:~$

So we have added the command for the Jailed environment. Congratulations! Now we have successfully configured Jail environment in Debian Wheezy 🙂

5 Links