Adrian Moya's picture

 

If you're thinking on launching an online store, Magento is one of the most popular options out there. This TKLPatch will convert turnkey core into a complete, feature-rich ecommerce platform ready to begin working on your online store! 
 

Features

Latest version of Magento (1.4.1.1)
http and https access configured (admin areas uses https)
setupdomain script to easily set up your domain once you are ready to go live. (Convenience)
Default user: admin 
Default password: turnkey123
 
To change default settings used during installation, once you got your appliance running, just go to https://your-ip/admin. Log in and you can change the settings in:
 
System->My Account (User and password)
System->Configuration->General->Locale options (For locale options)
System->Configuration->Currency Setup->Currency Options (For default currency)
 

What it does

 
1. Sets Hostname to magento
HOSTNAME=magento
echo "$HOSTNAME" > /etc/hostname
sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts
hostname magento
2.Update package information
apt-get update
 
3. Install required packages
install apache2 php5 mysql-server php5-curl php5-gd php5-mcrypt php5-mysql php-apc postfix php5-cli
 
4. Extract magento from the previously overlayed tar.gz. (I couldn't find a direct download url for this one). Move it to /var/www
cd /usr/local/src/
tar xzf magento-1.4.1.1.tar.gz 
mv magento/ /var/www
5. Create database and user
mysqladmin -u root create magento
mysql -u root <<-END_PRIVS
GRANT ALL PRIVILEGES ON magento.* TO magento@localhost IDENTIFIED BY "magento";
flush privileges;
END_PRIVS
6. Set some permissions required for installation
chmod 777 /var/www/magento/app/etc/
chmod 777 /var/www/magento/var/
chmod -R 777 /var/www/magento/media/
 
7. Sets cron job required for some magento features. 
echo "*/5 * * * *  root /usr/bin/php /var/www/magento/cron.php > /dev/null 2>&1" > /etc/cron.d/magento
 
8. Configure apache sites and modules
a2dissite default default-ssl
a2ensite magento magento-ssl
a2enmod rewrite ssl
 
9. Stop services
service apache2 stop
service mysql stop
 

So, when is magento installed?

On firstboot, the server will run a script that installs magento. This is done this way because we leave the installation to generate an encryption key that is used to encrypt passwords and credit card information. So it's important that each installation has it's unique key. If you later need to migrate this installation to other server, you'll need to copy this key to the other server. See magento's documentation for details. To know what's your generated key, just log via ssh and issue the following command:
 
cat /var/www/magento/app/etc/local.xml | grep key
 

setupdomain script

The setupdomain script is a script that sets the domain on apache's virtual hosts files so that your installation start working using a FQDN. It also updates the required settings in the magento database. The following is the content of the script:
 
#!/bin/bash
# Script to setup site domain for magento
# By Adrian Moya

if [ $# != 1 ]; then
  echo "Usage: setupdomain DOMAINNAME"
  echo "Example: setupdomain www.example.com"
else
DOMAIN="http://$1/"
SDOMAIN="https://$1/"
sed -r -i "s|ServerName .*|ServerName $1|" /etc/apache2/sites-available/magento
sed -r -i "s|ServerName .*|ServerName $1|" /etc/apache2/sites-available/magento-ssl
mysql -u root -e "UPDATE core_config_data SET value='$DOMAIN' WHERE path='web/unsecure/base_url';" magento
mysql -u root -e "UPDATE core_config_data SET value='$SDOMAIN' WHERE path='web/secure/base_url';" magento
service apache2 reload
echo "Done!"
fi

Known issues:

There seems to be a know issue in magento's admin panel that prevents you from loggin with some browsers. It only happened once in my tests, and the workaround was use firefox to log in. Then I was able to login with chromium (which is my default browser). If you get into this issue, please comment your experience. 
 
Enjoy!
 

Download Link

 
Forum: 
Tags: 
Dan Robertson's picture

If you want a direct download, you could use their svn repository:

svn checkout http://svn.magentocommerce.com/source/branches/1.4

I am not that familiar with SVN though, so I'm not sure if you would want to do anything after that.

Adrian Moya's picture

 

As a checkout leaves undesired .svn directories in each directory. But this method is not recommended as they can commit changes to the repo that can break the patch. Also, they can have some settings targeting the development environment. So its preferably a release file as we can be sure that it won't be changing. But they have some annoying javascript in place preventing to get a direct download url. 

L. Arnold's picture

I am guessing this needs to be installed over a LAMP appliance.  There is a Complete Zend Install also on Magento.

It woulid seem ideal to buiild a Appliance or a Script anyway that takes a configured appliance,

then Installs  Magento-Zend Install

Then Upgrades Magento to current build.

I don't know much about Zend but I understand there is a Zend underlayer in Magento.

How to proceeed?

thank you,

 

Adrian Moya's picture

You can apply it to turnkey-core-lucid-11rc and is in the process of being converted to an official appliance. Soon there should be a beta of this appliance ready, so if you're not in a hurry, you can simply wait for the official appliance. Else, grab turnkey-core 11RC and apply the patch following the instructions available in the documentation. 

If you need any help, you can ask here in the forums. 

Adrian Moya's picture

You need to first download turnkey-core-11rc image and then apply the patch attached here with the following procedure:

http://www.turnkeylinux.org/docs/tklpatch/apply

Sorry is not very easy and straight forward to apply a patch, but as I said before, the patch will soon end up in an official image so that you don't need to do all these steps. 

Review the documentation. Inside the patch there's a overlay directory which is going to be applied automatically when you apply the patch. 

L. Arnold's picture

In the tutorial it states:

"TurnKey allows you to install tklpatch via the package management system:"

but on the "install packages" page of Webmin there are about 5 Input lines where the following could be applied...

apt-get update
apt-get install tklpatch

I realize this is a more "central" issue than the Magento patch, but it is the current focus.

any help is helpful.

thank you,

Adrian Moya's picture

But if you prefer to use webmin, use the Package from APT option. I've never used webmin, I hope it's easy and get the job done. Then try to follow the instructions, yo can also access shellinabox via http://IP:12322 and run the commands there.

Adrian Moya's picture

To transfer the files to/from the appliance. You'll need to upload the turnkey core iso and later download the patched-iso. 

When you have the pieces in place (the iso and the patch) and you have installed tklpatch, I suggest you log in shell in a box and run the command for patching there. So you can follow what's happening. 

Adrian Moya's picture

You'll have to:

1.Install Core-Lucid.

2.SSH to the server.

3. apt-get update && apt-get install tklpatch

4. scp a copy of the core iso image to the appliance. OR download one with wget http://url/of/core/appliance

5. wget http://url/of/the/magento/patch

6. tklpatch turnkey-core-lucid.iso magento.tar.gz

7. copy the resulting turnkey-core-lucid-patched.iso to your main system. 

8. Install on a VM to test it. 

There's currently no easier way to do this. Unless you wait to the final release of the appliance. For detailed steps follow the link to the docs. For ways to copy in/copy out the images from the vm, use scp, if you're in windows look for winscp. 

In which step are you in the previous mentioned ones?

L. Arnold's picture

7: I will be able to put the new ISO in my Datastore (yestrdays breakthrough on my side).

8:  When I run the New VM install from ISO my only worry (from yesterdays experience) is what version of partitioning etc to specify.  I thought I messed it all up, but when I restarted I got the new system to load anyway.

As all my "get updates" will not be in this new system I expect this should be done again at some poiint.  Will let you know more shortly.

Patch went well for Core.  Joomla is churning away.


Joomla patch failed with the following sequence of events:

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
+cd /usr/local/src/
+tar xzf magento-1.4.1.1.tar.gz
mv magento/ /var/www
+mysqladmin _u root create magento
mysqladmin: connect to server at 'localhost' failed
error: "Can't connect to local MySQL server through socket '/var/run/mysqld/myswld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Removing 'local diversion of /sbin/initctl to /sbin/initctl.distrib"

I will work on the Core Patch that has worked for now.

thanks again!

Landis

Needing to delete in Source the each time I post here ir I get infinite loop giberish posting

 

L. Arnold's picture

I will do a double test of this, not that I have the ISO going in.  WEBMIN is the reason I have been following Turnkey as I am completely new to Linux and just need things to work.

One with Core rc11

One with Joomla rc11

Joomla as I have a tie between my Joomla and Magento systems, and if I this I can use on Extended Validation SSL Cert for both (paid already)

The Patch is applying now! Thank you,

Adrian Moya's picture

Just to be sure everything went ok. The patch should be named magento.tar.gz so be sure you download it correctly. I suggest you first download it to your PC and the upload it via the file manager to the same folder as the iso. I forgot that it's on rapidshare, so it won't be possible to download it using wget. Sorry about that, this is the only patch that due to it's size (it contains a complete version of magento inside) I had to put on an external repo. 

L. Arnold's picture

they wouldn't let me use their "slow" method.

Bigger file:  11mb.  applying the patch now.

Downloaded in windows.  Uploaded in Webmin FileManager,  Applying patch in Webmin SSH.

thanks for the update..  will keep on this one.

Thanks also for the help.

Adrian Moya's picture

That would be the correct size of the file. For joomla you won't need a patch, simply install the turnkey-joomla-11.0RC and you are ready to go. 

L. Arnold's picture

I am using MageBridge to link the two and will save an IP and likely also an SSL cert if I can get them linked.

Not todays prioirity.  Going with the Core patched version next.

thanks again.

L. Arnold's picture

Hi Adrian,

Some of the scripting seemingly did not go as planned.

Got the VM turned on, can access through Webmin.  Did a TKLBam backup.

Took a static IP from another server so I coulid have a working Named URL quick (Magento Wants that).

Unfortunately, no Skin shows up on the shop side or the Admin side.

In Admin, once I log in, I get redirected to a URL without the original URL (http://index.php/Admin)

Finally, I don't see MySQL anywhere accessible so I can get in there and move some settings around.

So..  Not sure how to proceed.  It might be helpful if I show you what is going on.

I know it is a lot of work and appreciate what you have done on this.  I know it is close.

Adrian Moya's picture

L.Arnold, I included an script to make the change of domain (and ip) a breeze. Just log in to the console and run

setupdomain MYIPORDOMAINNAME

That should update the magento settings and make it work correctly. 

I hope you don't mind that I'm cleaning this forum thread to remove the messages that are not helpfull for other community members that come to the thread. 

L. Arnold's picture

Hi Adrian,

I wanted to do the same along the way but did not know a method to take the discussion of fthe side.

I expect the MyIporDomainName will work...  I think I will try again over the "Lamp" stack as I like to have some more Apache Control and MySQL Admin built into Webmin.  I am definitely not a "black screen" command line guy yet.  Thanks for all the work you have done on this.  I am going to explore the "dev" back side to see if I can help "or at least be a test bed".

thanks again,

Landis A.

Adrian Moya's picture

You'll have to do it from the black screen, but it's easy. Log in via ssh. then run:

apt-get update && apt-get install webmin-mysql webmin-apache

That way you'll add those modules to webmin. They should take the default configuration. After that, log in via webmin, and check for the modules. That way you can log into the database through webmin using magento/magento as user/pass.

L. Arnold's picture

The && means "new line" I believe, anyway did install well w/ 2 lines.

Got that in.  Now I am hoping this version of webmin-mysql will do InnoDB engine on MySql.  The Joomla build does not as far as I can find out.  (won't reboot when I set the value).

..........    now I have set InnoDB as default and it took. Will try to follow the same in my Joomla setup.  This is a great move. Put it in the Patch if you can.

thanks,

L. Arnold's picture

I did two things, one to make it work, and one to allow me parrallel tests. Rename /app/etc/local.xml to local.xml.bak (this forces new install).  Also I had to make my whole cache folder 777 writable.

The problem I had is that I wanted to use a new Database but somewhere I could not get the system to shoot at my "root" password. (I used your default/default setup on your Magento Database). I need to change that. I am trying to run a /mag folder reinstall of my old Data. If I can work through the password issue it "may" work but I am not sure it will yet.

Your Install is "Up" and I can get to front and back ends of Magento. Thank you!

L. Arnold's picture

I typed setupdomain MYIPDOMAINNAME  (and once I installed Apache in WebMin I found that it was thinking that is the domain name for the site.

 

 

L. Arnold's picture

Adrian,

I got to the admin login after running the script, but then get redirected to a URL with no domain or IP  (similar to last time).

IS PHPMYADMIN accessible or the APACHE setup?

All I can get to is generic Webmin without these items.

SSH is a black screen for me (meaning I am not very capable with it).  I don't know how to edit Mysql from there.

unfortunately my own LAMP effort is befuddled by some different issues.  working on a restore just now in fact.

Maybe I could show you some details.  Do you use Skype - could do a screen share.

sky nm: (landis.a)

Jeremy Davis's picture

But did you run the script from the prompt accessable with SSH? (ie typed the command suggested by Adrian into the 'black screen'?) It should be obvious if it works. If it doesn't, tell us what error it throws up. I'm assuming that you understood that you needed to replace "MYIPORDOMAINNAME" with your actual IP address or domain name. eg:

setupdomain example.com

I'm not 100% sure that Adrian included phpMyAdmin with this device (sorry haven't got time to read the full thread either to find out). If he did, I'd assume that he used the default TKL setup which is to have phphMyAdmin available at https://<ip-address>:12322 (just like Webmin but port 12322 instead of Webmin's 12321). This is where you should find it in the LAMP setup. From memory though, you mention Zend server. In my limited experience with Zend (see my KnowledgeTree patch) it is not currently compatible with phpMyAdmin under Ubuntu (not by default anyway).

If I were you, I'd probably just try to get this running properly on the recommended base (ie TKL Core v11.0RC) and then once you have that all working as expected, then play and tweak etc (eg try patching LAMP, getting phpMyAdmin working, etc). You have a much better chance of working out your problems one-by-one that way and understanding what may be the problem and how to fix it.

Good luck.

L. Arnold's picture

Adrian set me up with the Webmin version of MySQL which gets me to the data.  It woulid be nice for editing to have phpMyAdmin also there  (a little better interface).

My experience is that WebMin MySQL is the way to do "bigger imports" via the Excecute SQL setup which is right there.  but for little Edits, PhpMyAdmin is better.

The Zend install acted like it was working, but a few hours later nothing was working.  I will "delete from inventory"... which is too bad given recomendations I have heard.

I struggle a bit with Apache control but the "setupdomain" command seems to really help.

Now wanting to get Joomla tied into the same system w/ Magento (acting as the root - but residing in a parallel folder).  I am not sure how to do this just now but I am sure it is possible.  Maybe a simple redirect off of index.php (index.html) which I have there now.  Magento is one folder downstream.

all for now.  I need to see if I can move my data.  Our Webhost who had Magento and other things dissappeared about a week ago and all I have is Cpanel access to everything.

L. Arnold's picture

Install has worked. I got the system to think it was migrating my old data but nothing there yet. I will work on a summary of what I did to get the install working. Ideally a migration path should also be outlined.

L. Arnold's picture

Adrian,

I can't get InnoDB (engine for MySQL) working in a Joomla build.  It is working in your Magento patch.

I read here that Ubuntu committee are not yet porting it through the plugin lists.?? 

https://bugs.launchpad.net/ubuntu/lucid/+source/mysql-dfsg-5.1/+bug/594932

How do I actually read the MySQL version that is installed?  Is it "updateable"?

Sorry to bring this up.

Adrian Moya's picture

I installed mysql-server from the repos. The bug you post says is for the InnoDB plugin but not the default InnoDB. Anyway, check in the support forums, I think there has been reported an issue regarding InnoDB in the new appliances that maybe could help. 

L. Arnold's picture

Hi Adrian,

I wanted to let you know I also have gotten our full old site migrated over to a parrallel Magento folder (Mag) and it appears to be working well.  This was the ultimate goal and the performance so far is really remarkable in comparison to the old hosted set up we had.  (Both folders are on the layer above the base www (which is basically empty right now)

I did this by moving the full file structures (with the 5 or 6 extensions), clearing the magento cache and session folders, and renaming the local.xml file to local.xml.bak (app/etc).   I also made www. point to www instead of Magento in Apache (webmin).

The trick was in not moving the actual Data until a "install" process takes place (thus rename local.xml so Magento doesn't go looking).  The reason for this is to be sure the original DATA file is built properly.  Importantly, the Datafile should be different than the Patch Magento file (can be specified at install time).

Having done this, I was able to excecute SQL by dropping in a full export from the Hosted SQL File.

It took a little cleaning, and I had to install phpMyAdmin to debug a few SSL and Domain name issues.  I wouild like to have phpMyAdmin show up on the default port of: 12322 but that is later when I learn more about handling hosts and folder specific settings.

I need to learn this (host control) in order to to put Joomla in a parrallel folder to these, but have Joomla work as the Root Folder www.mydomain.com/  (pointing to Joomla) but magento pointing to the www.mydomain.com/mag/  .  I can do this now by putting Joomla in Root, but it is messy (was like this in our old install).  I do this so the two work together to present the data through Joomla.  Just want a clean folder and host structure.

Always learning to do.

Thank you Very Much for your help getting the Patch put in place!

all the best,

L. Arnold

L. Arnold's picture

I am getting an error when I go to "magento connect" from Magento.

Seems like the other option is running "pear" scripts.  I am trying to do this, but striking out some.

I ran, and got to install

apt-get install php-pear

, but then no reaction to a line like this as ".pear" is not recongnized as a command

./pear help

this link outlines the subject (see bottom for Pear discussion when connect not available)

http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/m...

Any help is appreciated.

Jeremy Davis's picture

My reading of the documentation you link to states that to use Magento Connect the preferred way is to temporarily change the permissions on the Magento root folder. The easiest way to do that is to change it to 777 but be aware that while the permissions are set like that anyone who can log into the server can do anything (security risk) - make sure you change it back straight afterwards! You can set file permissions via Filezilla (if you are using it, I imagine WinSCP should be able to do that too) or via Webmin File Manager, or via the commandline like this:

chmod 777 -R /path/to/magento/root/

As stated in the documentation, after you have done your installation/update/whatever you need to return them to '655':

chmod 655 -R /path/to/magento/root/

If you want to go the other route using pear:

I assume that the ./pear referred to in the documentation is a specific version of pear installed with Magento (so I'd guess you didn't need to install pear separately). Probaly best to use the version included with Magento rather than the version you've installed (there are probably different versions and may result in strange things happening).

You need to make sure you are running in the root Magento folder. I suspect you were trying to run the command from the /root folder? (hence not found). Try this:

cd /path/to/magento/root
./pear help

[Edit - hope you don't mind I deleted your other post to tidy up a little]

L. Arnold's picture

I have been trying to get filezilla to work on TKL boxes.  What enables FTP to allow it?  Would definitely be faster than File Manager in Webmin.

Jeremy Davis's picture

It's available form the drop down in the right hand pane of the account manager (or whatever its called - window that comes up when you click the button on the far left of the toolbar).

L. Arnold's picture

(I wish I could clean it up so easily actually, but this is edited)

I was also looking at how I would make a "Pear Channel" as an alternative way to upgrade: ie: how to get a Magento Channel to work:

Seems it might cause less security risk.

The other problem is that /media and /var  (maybe a few others) need 777 after 655 is reset. 

That said, your kind commands might be the quickest..  It would be nice to eliminate the security risk which really seems a Magento issue (and of course mine).

Jeremy Davis's picture

Just don't forget to change them back!

As for your other folders, if possible try to locate the exact files/folders that need access rather than set the whole folder to 777. Also it may be possible to change the ownership to the webserver account (www-data) instead of 777. If you plan on leaving them that way permanently then that would be preferable to 777.

chown www-data:www-data -R /path/to/folder/

This is assuming that Magento runs under the www-data user account (which I'd suspect it does).

L. Arnold's picture

I should be able to run these commands after resetting the full folder to 655

chmod 777 /var/www/magento/app/etc/
chmod 777 /var/www/magento/var/
chmod -R 777 /var/www/magento/media/

Jeremy Davis's picture

If that's what Adrian did in the initial patch, then do that. He is far more knowledgable than me in these things and I would trust his judgement on whether something is an acceptable risk or not.

Also if this is something that is likely to be wanted from time-to-time then it could be worth making it into a script so the process to 'reset' permissions after upgrading/installing could be a single command. May be worthy of addition to the appliance even?

L. Arnold's picture

anyway.

It would be nice in the patch to script into and out of "upgrade mode" 

Also it would be nice to have a little more "guidance" on Apache setups and SSL.  Magento is very very finnicky about "rewrites" and I have basically tied one of my boxes in a knot -- and trying to untie it I can't get to the bottom of the apache/ssl/mysql layer cake.

(Current subject of chmod's  is around a a new build though).

Looks like I need to get the pear updates to work from here...  tommorrow though.

L. Arnold's picture

This might be better aimed at Magento Forums, , but one can get lost there also.  I expect people will be moving Magento to TKL in considerable numbers and the following should take some of the pain and risk out of the process.

I described (in bits and pieces) earlier in this thread moving Magento above which all worked except for the "downloader" aspects.  For quite a while I was not able to update the various pear files and correct "serializations" and "paths" to get a working "updatable" install.  There are several people providing advice for how to do this with various scripts but this seems a persistant problem.

The answer however lay in making a list of "Magento Connect" additions that are in the old site (and also in the crossloaded Downloader folder).  Renaming the Downloader Folder to "Downloader-Bak".  Taking a Fresh install of of the Downloader folder (with no additions in the system) then going to Magento Connect and re-installing the additions right over the old additions.

I can concieve that there is some danger in this method - ie if a installer is checking for previous install versions that need to be upgraded, vis a vis them doing a simple fresh install.  On the surface of it, this did work.  One problem install I am having with one system may be rectified, now, by doing a "uninstall" of the addition, then reinstalling a second time fresh.  This seemed impossible to do with the old downloader files (I could at least see what had been installed) - or the "fixed" files where they system went blank before the list showed itself.  You can't "uninstall" off the old "downloader" maps because they are pointing to your old folder structure (in my case a web host) and are serialized XML that preface every entry with a "charachter count".  I manually tried to reset this twice.  Also ran what seemed to be good scripts (not made by me) but always the same result.  Clearing Cache and Sessions would not help.

The New Downloader folder and fresh installs got the system going again.

A word of warning:  do not want to do an "update" to a misdirected "Downloader" file.  I did get a "Mage Core" update going that unfortunately ground to a halt once it hit the "attached" downloader sections.

TKLBam backup is a good thing.  Run it before any serious upgrade!

L. Arnold's picture

If just running the TKL Patch, install it as described.

Open UP SSH:12320, run

setupdomain YOURDOMAINNAME.com

Then Start Magento on the Web.

Alternatively, you can go through the "install script" by renaming the /app/etc/local.xml file to, for instance: /app/etc/local.xml-bak.

This would give you a bit more security by setting your own special MYSQL Password and SQL FileName - both in webmin-mysql and the magento install script.

Before engaging Magento though, again run

setupdomain YOURDOMAINNAME.com in SSH.

Alon Swartz's picture

We've already created the official TurnKey Magento appliance, and it will be released along with "part I" of TurnKey 11.0. The images have already been uploaded and are awaiting release, so it should be available for download really really soon.

I'd love to get your feedback on the new appliance as it seems you've got some experience working with the system.

Eric Rosol's picture

 i've been working with magento and virtualbox for awhile but i'm new to turnkey. so this is awesome.

Alon Swartz's picture

The appliance has already been released and is available for download, though we have yet to create the appliance page for it.

Eric Rosol's picture

Downloaded it this morning... very slick. SOO much better than the VBox, WinXP, WAMP mess I was screwing around with previously. the time this will be saving me is unmeasurable. many thanks

L. Arnold's picture

I look forward to the final release product.  I think this will be compelling.  I haven't seen much talk about Joomla (1.6 is about to ship) but give it some attention as well.

Happy holidays,

Liraz Siri's picture

TurnKey Magento was included in TurnKey Linux 11 release (part one), based on Adrian's TKLPatch.

Add new comment