Turnkey Linux Magento install with Redis

Magento CMS website logoFor a customer we need a fast webserver which we can completely configure to run Magento smoothly. We have chosen a Turnkeylinux Magento installlation with hosting provider YourHosting in the Netherlands. The unmanaged server is VPS4 with 4 GB ram. There are many dedicated Magento hosting parties available but we wanted to completely maintain the server ourselves. This is what we have done. 1) Installation Yourhosting account has options to install the desired server VNC module: make sure to use the ip-addres, not the url of your website for testing purposes Make sure Webadmin is up to date: Install these modules via the SSH console required to update webadmin

apt-get install apt-show-versions libapt-pkg-perl

Download the lates webadmin

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.690_all.deb

Install the webadmin module

dpkg --install webmin_1.690_all.deb

Set up the FTP server
We picked proftpd

  1. Login to webmin at http://xx.xx.xx.xx:12321 (Yourhosting specific)
  2. Go to Webmin > Webmin Configuration -> Webmin Modules
  3. Select Standard module from www.webmin.com
  4. Click the button on the right of that option and choose: proftpd or just type “proftpd” in the field
  5. Click “Install Module”
  6. Go back to Webmin Configuration
  7. On the bottom of the page click “Refresh Modules”
  8. The server is installed

Create a usergroup so you can force setting to a group of users

  1. Got to System > Users and Groups and click “Local groups” and then “Create a new group”
  2. Name -. for example ftpusers
  3. Password -> Select Normal Password
  4. Click Create

Create a user

  1. Got to System > Users and Groups and click “Create a new user”
  2. Provide a username for what is to be your FTP account
  3. Home directory -> Select a home directory for example “/var/www”
  4. Password -> Select Normal Password and provide a unique, complex password for the account
  5. Shell -> bin/sh: we will set shell in ftp configuration for all users.
  6. Usergroup -> select ftpuser group
  7. Click Create

Now it seems the server is running but it isn’t. It needs to be installed by webmin also together with inetd

  1. Goto Servers -> Proftpd server: it will indicate the server is not found and displays a message to install it.
  2. Click on the message and install the Proftpd server, it will also install other modules it needs, like Inetd

Update 2014-06-09

Since Webmin version 1.690 following error occurs:

Fatal: LoadModule: error loading module 'mod_vroot.c': Operation not permitted on line 74

Solution is to install following module

apt-get update
 apt-get install proftpd-mod-vroot

Make changes to proftpd.conf

  1. ServerName “example.com”
  2. Restart the server: service proftpd restart

Test FTP

  1. Create a site in your preferred ftp client and connect with the indicated details.

Install Sudo

Install sudo with following command and implement extra security for ssh users

apt-get update
 apt-get install sudo

Install redis Use the foll0wing commands to install redis (http://redis.io/download)

wget http://download.redis.io/releases/redis-2.8.4.tar.gz
tar xzf redis-2.8.4.tar.gz
cd redis-2.8.4

First error due to missing make

-bash: make: command not found

Used this SSH command to install make

apt-get install make

Second error due to missing gcc

make[3]: gcc: Command not found

Used this SSH command to install gcc

apt-get install build-essential

Third error due to missing jemalloc

zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"

Redis depends on Jemalloc and it is part of the redis download (http://download.redis.io/redis-stable/deps/). I Issued solution mentioned here (https://github.com/antirez/redis/issues/722).

cd deps
make hiredis lua jemalloc linenoise
cd ../

Run make test to verify installation

make test
Run make test to verify installation
make test

Error message in SSH

You need tcl 8.5 or newer in order to run the Redis test

Installed TCL 8.5 to run make test

apt-get install tcl8.5

Next step: check Magento installation and update

So far so good, the server is running with basic configuration. It needs further tweaking but we proceeded upgrading Magento version in the Turnkey Linyx from to 1.8.1.

Upgrading to Magento 1.8.1.

  1. Log in to your Magento backend
  2. Goto Magento Connect via System -> Magento Connect -> Magento Connect Manager
  3. I got error message:
    CONNECT ERROR: Please check for sufficient write file permissions.
    Your Magento folder does not have sufficient write permissions, which downloader requires.
  4. Correct write permissions with this SSH command (http://www.magentocommerce.com/wiki/groups/227/magento_connect)find . -type d -exec chmod 777 {} \;
  5. Test Magento Connect Manager by switching back to Admin and then login again. When message disappear you are ready to go.

Copy Magento website

We had a Magento website runnning on a managed VPS at yourhosting. Managed VPS is a great out-of-the-box solution and delegates support and upgrades to the hosting provider. In our case we needed additional support (particulairly for Redis) and access to the VPS so we switched to unmanaged VPS.

We could copy the Magento installation to the new VPS but we decided to do a clean install, thus making sure sourcecode is fresh and clean and unused extensions are left out. Our primairy goal was to increase speed.

I will not go into the whole process. But during installation we needed IonCube installed on the Turnkey Linux and this is what we did.

IonCube installation

  1. Check if Ioncube is installed via php file with this code in a php file <?php phpinfo() ?>
  2. Reference blogpost: https://www.digitalocean.com/community/articles/how-to-install-ioncube-loader
  3. Download the nessecary files from this page: http://www.ioncube.com/loaders.php
    1. You need Loader Wizard files to verify your installation from the frontend (http://www.ioncube.com/loader-wizard/loader-wizard.tgz)
    2. You need the linux files for your Turnkey Linux (x86 or x64)
  4. Copy the Loader Wizard the files to your server via FTP. (Make a folder “Ioncube” in the main Magento folder where the App folder is located)
  5. Copy the Linux files to the same folder and untar
    cd /var/www/magento/ioncube
    wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
    tar xvfz ioncube_loaders_lin_x86-64.tar.gz
  6. Start the loader Wizard via http://YOUR.URL/ioncube/loader-wizard.php
    1. Select “Dedicated or VPS” installation

3 things you have to do

  1. Save 20-ioncube.ini in correct folder
    1. Now you will be asked to save “20-ioncube.ini” file in /etc/php5/apache2/conf.d
      mv /var/www/magento/20-ioncube.ini /etc/php5/apache2/conf.d/20-ioncube.ini
  2. Save ioncube_loader_lin_5.x.so in correct folder
    1. The usr/var/magento/ioncube folder now contains a list with loaders:
    2. Copy the correct version to the PHP folder
      cd /var/www/magento/ioncube
      cp ioncube_loader_lin_5.3.so /usr/lib/php5/20090626/
      make additional folder
      mkdir 20090626+lfs
      copy files to that folder also
      cp /usr/lib/php5/20090626/ioncube_loader_lin_5.3.so /usr/lib/php5/20090626+lfs
    3. The ionCube Loader must be the first Zend extension listed in the configuration file xcache.ini
      open the file
      pico /etc/php5/apache2/conf.d/xcache.ini
      add following line as first line
      zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so
    4. You would have to copy it over into your PHP modules folder, which you can find with (the path will also be provided by Loader Wizard):
      php -i | grep extension_dir
      You will get the following output:
      extension_dir => /usr/lib/php5/20090626+lfs => /usr/lib/php5/20090626+lfs
      extension_dir => /usr/lib/php5/20090626 => /usr/lib/php5/20090626
  3. You would then have to restart Apache2 for module to be loaded:service apache2 restart
  4. mRefresh the webpage “http://YOUR.URL/ioncube/loader-wizard.php” and verify that Ioncube is installed

2014-06-09 Updated webmin versions

Leave a Reply

Your email address will not be published. Required fields are marked *