Jump to content

Prestashop on Raspberry Pi (as testfield)


Recommended Posts

Hi everybody!

 

I would like to install prestashop on a low cost local server, namely a raspberry pi model B.

 

The idea behind this is to use it as fieldtest before going live on a virtual host.

 

I've been trying to install prestashop for several days but no luck so far :(

 

Basically it fails during the installation process at the last step, when creating tables in the database and populating them. Sometimes it fails at 24%, sometimes at 34%, etc... To be honest, I do not know how to troubleshoot the problem as I do not find any installation logs. The only thing I have been able to log is the activity in the database when prestashop is being installed, there I can see how the tables are created and populated but at some point, the installation shows the error at XX% and the activity in the database finishes.

 

 

So I wonder if someone can help me out with the troubleshooting... I would like to put together a tutorial with the working configuration so anybody with 0 knowledge can follow it and succeed in the installation process of prestashop on a raspberry pi.

 

 

Here you are what I have done so far:

 

Hardware:

     - Raspberry Pi, Model B

     - SD 8GB, power supply and connection to the internet.

     - I connect to raspberry by SSH from a desktop computer.

 

Software:

     - Debian Wheezy (2014-12-24-wheezy-raspbian.img).

     - Prestashop 1.6.0.11 (althought I've tried with 1.6.0.9 and 1.5.6.2).

 

Other details:

     - Hostname for raspberrry: prestashop

     - Raspberry login / password: pi / raspberry

     - Document root (Nginx): /usr/share/nginx/www

     - MySQL database: psdb

     - MySQL login / password: psadmin / mypassword

 

Installation process:

 

0) Connect to raspberry

 

0.1) From any SSH client (putty, MobaXterm, etc...)

> ssh prestashop

 

0.2) Login:

pi

raspberry

 

1) LEMP (Linux + Nginx + MySQL + PHP)

 

I've followed this guide (except the CGI/Perl Scripts part that I skipped it):

https://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ubuntu-12.10

 

 

2) Prestashop preparation
 
2.1) Download prestashop:
 
2.2) Install unzip:
> sudo apt-get install unzip
 
2.3) Unzip prestashop to document root:
> sudo unzip prestashop_1.6.0.11.zip -d /usr/share/nginx/www
 
2.4) Prepare document root:
> cd /usr/share/nginx/www
> sudo chown -R www-data:www-data /usr/share/nginx/www/*
> sudo mv -f /usr/share/nginx/www/prestashop/* /usr/share/nginx/www
> sudo rm -r /usr/share/nginx/www/prestashop
 
 
3) Nginx preparation
 
3.1) Create a virtual host configuration file:
> sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/prestashop
> sudo vi /etc/nginx/sites-available/prestashop
server {
listen   80; ## listen for ipv4; this line is default and implied
 
root /usr/share/nginx/www;
index index.php index.html index.htm;
 
# Make site accessible from http://localhost/
server_name prestashop;
 
if ($http_host != "prestashop") {
rewrite ^ http://prestashop$request_uri permanent;
}
 
location = /favicon.ico {
log_not_found off;
access_log off;
}
 
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
 
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
 
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
 
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
 
try_files $uri $uri/ /index.php$is_args$args;
error_page 404 /index.php?controller=404;
 
location ~* \.(gif)$ {
expires 2592000s;
}
location ~* \.(jpeg|jpg)$ {
expires 2592000s;
}
location ~* \.(png)$ {
expires 2592000s;
}
location ~* \.(css)$ {
expires 604800s;
}
location ~* \.(js|jsonp)$ {
expires 604800s;
}
location ~* \.(js)$ {
expires 604800s;
}
location ~* \.(ico)$ {
expires 31536000s;
}
 
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
 
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
 
fastcgi_split_path_info ^(.+\.php)(/.+)$;
 
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
 
3.2) Disable default virtual server:
> sudo rm /etc/nginx/sites-enabled/default
 
3.3) Enable virtual server for prestashop:
> sudo ln -s /etc/nginx/sites-available/prestashop /etc/nginx/sites-enabled/prestashop
 
3.4) Restart nginx configuration:
sudo /etc/init.d/nginx restart
 
 
4) MySQL preparation:
 
4.1) Create the database and user for prestashop:
> mysql -u root -p
CREATE DATABASE psdb;
USE psdb;
CREATE USER psadmin@localhost IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON psdb.* TO psadmin@localhost IDENTIFIED BY 'mypassword';
FLUSH PRIVILEGES;
quit;
 
 
5) PHP preparation:
 
5.1) Edit PHP configuration and append following 2 lines:
> sudo vi /etc/php5/fpm/pool.d/www.conf
php_admin_value[register_globals]=0
php_admin_value[magic_quotes_gpc]=0
 
5.2) Restart PHP:
> sudo /etc/init.d/php-fpm restart
 
 
6) Prestashop installation
 
6.0) From the web broweser of desktop computer:
 
6.1) Select language for installation:
Spanish
Next
 
6.2) License agreement:
Checked
Next
 
6.3) Prerequisite verification:
(Everything OK)
Next
 
6.4) Configure your shop:
(I input my data)
Country: Spain
Next
 
6.5) Database configuration:
DB Server Address: localhost
DB name: psdb
DB user: psadmin
DB password: mypassord
Table prefix: ps_
Check DB connection:  OK
Next
 
6.6) Installation
Fails at XX%, every time I retry the percentage changes, sometimes is 24%, sometimes 34%, once 54%...
 
If required I can provide additional info... 
 
Thanks in advance for any feedback you can provide!
Cheers!
Edited by maduenyo (see edit history)
Link to comment
Share on other sites

Yes, virtual box is another option but it requires a more expensive hardware, such a regular pc, which is noisy and power hungry in comparison with raspberry pi.

 

In other words, I'm looking for a test environment to be up and running 24/7, low power consumption is a must and high performance is not required.

 

Thanks anyway for your advice!!

 

PS: I've read someone got prestashop on raspberry but under Arch Linux instead of Debian, so I'm going to give it a try... Stay tuned!

Edited by maduenyo (see edit history)
Link to comment
Share on other sites

Hi folks!!!

 

Finally, I've managed to run PrestaShop 1.6.0.11 on Raspberry Pi Model B (512Mbyte) with Debian Wheezy. Although it isn't the best system setup, it's kind of slow when browsing the front / back office, it works. So as test field should be fine :)

 

I'm putting together all the information while it's still fresh to post here as a tutorial, so anyone interested can follow the instructions...

 

Cheers!!!

Link to comment
Share on other sites

Hi again!!

 

here you are the manual to install prestashop 1.6.0.21 on the Raspberry Pi (Mode B rev.2). Enjoy!!

 

 

# - PrestaShop on LAMP with Debian (Wheezy) -

 

# - --------------------------------------- -

# - LAMP

# - --------------------------------------- -

 

# - --------------------------------------- -

# Details:

Linux

     hostname: prestashop

     ip address: 192.168.1.41

     login: pi / raspberry

 

Apache

     document root: /var/www

 

MySQL

     Administrator login: root / mysql

     PrestaShop login: psadmin / psadmin

     PrestaShop DB: psdb

 

# - --------------------------------------- -

# Apache installation:

sudo apt-get install apache2

sudo su

echo "ServerName localhost" >> /etc/apache2/apache2.conf;

exit

 

# - --------------------------------------- -

# PHP installation:

sudo apt-get install php5 libapache2-mod-php5 php5-cli php5-mysql

printf "<?php\nphpinfo();\n?>" > info.php

sudo mv info.php /var/www

 

# Fine tune PHP configuration file:

sudo vi /etc/php5/apache2/php.ini

memory_limit = 350M

max_execution_time = 300

 

# - --------------------------------------- -

# MySQL

sudo apt-get install mysql-server

> Enter pasword for MySQL root user.

sudo apt-get install mysql-client libmysqlclient-dev

sudo apt-get install phpmyadmin

> Select with space bar web server just installed: apache2

> Select option for dbconfig-common installation:  NO

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

 

# - --------------------------------------- -

# Restart services

sudo service apache2 restart

 

# - --------------------------------------- -

# Check installation

http://prestashop -> Apache welcome page

http://prestashop/info.php -> PHP info page

http://prestashop/phpmyadmin -> PHPMyAdmin page (loging with root and MySQL password provided)

 

 

# - --------------------------------------- -

# - PrestaShop

# - --------------------------------------- -

 

# - --------------------------------------- -

# Download prestashop

cd


sudo apt-get install unzip

unzip prestashop_1.6.0.11.zip

 

# Copy to document root and set permissions:

sudo cp -rp ./prestashop/* /var/www

sudo chown -R www-data:www-data /var/www

sudo find /var/www -type d -exec chmod 755 {} \;

sudo find /var/www -type f -exec chmod 644 {} \;

 

# - --------------------------------------- -

# Create PrestaShop MySQL database and user:

mysql -u root -pmysql

CREATE DATABASE psdb;

USE psdb;

CREATE USER psadmin@localhost IDENTIFIED BY 'psadmin';

GRANT ALL PRIVILEGES ON psdb.* TO psadmin@localhost IDENTIFIED BY 'psadmin';

FLUSH PRIVILEGES;

quit;

 

# - --------------------------------------- -

# Start web installation


> Language:

 

> Shop details:

- Shop name.

- Location.

- Input administration user (email).

- Input administration password.

 

> Database connection:

- Connection to: localhost

- Database name: psdb

- User: psadmin

- Password: psadmin

- Verify connection.

 

> Installation will take some time...

- Be patient, it may take 10 to 20min.

- ...

- Once finished, remove installation directory:

sudo rm -r /var/www/install

- Click on Backoffice.

- PrestaShop /admin directory will automatically be renamed

 to something similar to admin693fr0og4.

 Get your admin directory name (needed to connect to Back Office):

sudo ls -l /var/www/ | grep admin | grep www-data | awk '{print($9)}'

 

> Start Front Office:


 

> Start Back Office (where adminXXX is your renamed admin directory):


 

# Final note: Raspberry Pi does not have too much horse power, be patient...

 

# - --------------------------------------- -

# In case you get white screen when browsing your Front / Back Office

# try enable debugging to see what fails.

# Set from false to true _PS_MODE_DEV_ variable:

sudo vi /var/www/config/defines.inc.php

define('_PS_MODE_DEV_', true);

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Nice!! I'm testing right now!!!   :rolleyes:

 

Update #1

 

I had to use the command to to install PHP

 

sudo apt-get update

 

 

Update #2

i can't edit text in the file

# Fine tune PHP configuration file:
sudo vi /etc/php5/apache2/php.ini
 
i can see the content but not make any changes ????
Edited by erik@e30 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...