Monday, December 27, 2010

Zencart, Prestashop, and LAMP (on Ubuntu Maverick Meerkat 10.10) ||WIP

|| WIP: add links, fill out zencart, format with code tags

Yay for adapting instructions from books that only explain how to do things on Windows!

Anyway, I hate any sort of reinventing the wheel, so here goes.

Also, I would like to note that Zencart is so much more responsive than Prestashop when I installed both on the localhost server on my netbook, it's not even funny (<1 second compared to 5+ seconds to load the homepage). Maybe it's because I installed the sample data for Prestashop but not Zencart, but it would make sense that software created back then is much less of a (database-calls?)-resource-hog than software made nowadays, unfortunately.

My system:
Ubuntu 10.10
apache2.2.16

Set up LAMP (localhost server)
sudo tasksel install lamp-server
Explanation: Ubuntu/Debian software comes in packages and tasks, which are collections of packages.
Useful commands:
sudo /etc/init.d/apache2 restart

sudo apt-get install phpmyadmin
IMPORTANT: Hit "enter" when you tab down to select apache2 (see * in pic below) Otherwise, it gets rather painful.


Google will tell you to make a symlink, ala sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin (http://ubuntuforums.org/archive/index.php/t-591952.html), but apparently that has security issues and the correct method is to 
sudo apt-get remove phpmyadmin
sudo apt-get install phpmyadmin
and hit Enter this time. 

Zencart






Prestashop

Explanation:
Apache2 looks for sites in /var/www by default (https://help.ubuntu.com/10.10/serverguide/C/httpd.html). This directory is root-access only, so we'll download the zip and unzip inside a regular directory so that they unzip with the right permissions (unzipping the the /var/www does NOT work, if I access any pages with my web browser I'll get "503 Permissions" errors).
 
Let the normal folder be ~/MyProjects/presta, and let the folder we'll want to install into be /var/www/pshop.
  1. cd ~/MyProjects/presta
    cat@cat-netbook:~/MyProjects/presta$
  2. Download zip of version you want:
    wget “http://www.prestashop.com/download/prestashop_1.4.0.5.zip"
  3. Unzip in normal nautilus:
    prestashop_1.4.0.5.zip
  4. LAMP-specific: Now move to the apache localhost server directory:
    sudo mv prestashop_1.4.0.5.zip /var/www/pshop
    (Explanation of /var/www: https://help.ubuntu.com/10.10/serverguide/C/httpd.html)
  5. http://localhost/pshop/install in a browser, finish the first step,
    and get to Step 2: System and Permissions.
    (This is more reliable than following http://www.prestashop.com/wiki/Installing_and_Updating_PrestaShop_software/#Install_PrestaShop which was apparently outdated list of files I need to chmod.
    1. Fix gd2:
      sudo vi /etc/php5/apache2/php.ini
      Add extension=php_gd2.dll in there anywhere
      (php-gd2 package was already installed when i checked in synaptic, otherwise we need to install it)
    2. Set appropriate file permissions: (Hint: Hit the "update" button on the page after you chmod, NOT the refresh button) 
      cd /var/www
      cat@cat-netbook:/var/www$
      sudo chmod 777 pshop
      cd pshop
      cat@cat-netbook:/var/www/pshop$
      1. Prestashop v.1.4 alpha 2 (aka 1.4.06):
        sudo chmod 777 config upload download tools/smarty/compile tools/smarty/cache/ sitemap.xml
        sudo chmod 777 -R img mails modules themes/prestashop/lang translations themes/prestashop/cache
      2. Prestashop v1.3.5:sudo chmod 777 config tools/smarty/compile sitemap.xml
        sudo chmod 777 -R img mails modules themes/prestashop/lang translations upload download
    3. If you want to check that your permissions are correct (and not hit bogus "503 permissions" or "you need javascript" errors):
      ls -l | grep js
      should output:
      drwxr-xr-x   5 root root   4096 2010-12-26 11:28 js
  6. Click Next to go to Step 3. Database Configuration.
    1. Create a database for our prestashop site.
      In another browser tab or window: go to http://localhost/phpmyadmin
      In the field [MySQL localhost > Create new database], type in “pshop” and hit [Create]
    2. In the tab with http://localhost/pshop/install, enter in your details
      Database Server: localhost
      Database Name: pshop
      ... your MySQL username and password (what you use to login to PHPMyAdmin] ...
      Hit [Verify Database] to make sure you entered everything correctly
    3. Pick "full" or "simple" install
  7. Click Next. Wait a few seconds (an animated bar will appear at the top of the screen)
    Step 4. Now we can visit our site @ http://localhost/pshop, yay!
    but if we visit our backend, http://localhost/pshop/admin, it will remind us to delete the install folder and rename the admin folder:
    sudo rm -r install
    sudo mv admin sekrit123
    sudo rm readme*.txt
  8. Now, login to admin @ http://localhost/pshop/sekrit123 (obviously, you should use something other than "sekrit123" for your folder)
  9. Screwed up Prestashop? No problem, just delete the folder and the database and repeat above steps again.
    1. cd /var/www/
      sudo rm -r pshop
    2. go to: http://localhost/phpmyadmin/index.php?db=pshop
      or, more flexibly, go to http://localhost/phpmyadmin and on the left-hand side click the name of the database you want to drop
    3. Click on the "Drop" tab in red. It warns you that you're DESTROYING a database, click okay (this always makes me feel like going "mwahaha!" ^^)
    4. Copy the prestashop folder you downloaded and unzipped over to /var/www again.

1 comment: