Monday, April 14, 2014

Install Joomla 3.2 on Turnkey Linux 13.1 (Debian 7) LAMP Appliance

Even though Joomla recommends that developers and designers choose Joomla 3.2 over 2.5, Turnkey Linux most likely won't publish a new virtual appliance before Joomla 3.5 is finalized. The solution? Set up Tunkey LAMP 13.1 and install Joomla yourself.



Disclaimer  
The following information is provided strictly as a guide for getting started with Joomla 3.2 on Turnkey Linux LAMP 13.1 and is by no means a complete solution. I make no claims as to the security or stability of the following configuration. In other words, (as always) you are responsible for the security and stability of your own servers/network/data. That said, I've made every effort to provide the best info I could scrape together from various blogs, how-tos, wikis, and personal experience. Please feel free to comment on anything that can be improved.


Why Turnkey Linux?
While the following should work fine on a vanilla Debian/Ubuntu install, with Turnkey Linux you can deploy straight to the AWS cloud via Turnkey Hub or to a VM on your preferred hypervisor. No matter your setup, backups and restores will work just fine, and you can move to any other platform very easily. There are also some great management features included, but backups and the Turnkey Hub (a slick AWS management frontend) are what really make Turnkey Linux appliances shine. Of course you can use other kinds of snapshots but TLKBAM creates daily, off-site, and truly platform independent backups which is hard to argue with.

Install Updates
Before you do anything else, install updates.
apt-get update
apt-get upgrade

Get PHP Ready for Joomla
We'll start by editing a few values in /etc/php5/apache2/php.ini.
nano /etc/php5/apache2/php.ini

Then we need to disable output buffering and set a temporary uploads directory. We'll choose one outside Apache's site folder for a little added security. As additional security measures we'll restrict the PHP to a few specified folders and disable functions we don't explicitly need by adding to the disable_functions list. Don't forget to scroll to the end of the long list of already disabled features using the end key. The extremely brief and approachable "Security Checklist/Hosting and Server Setup" in the Joomla Docs should be considered required reading if you care at all about the data on your site.
output_buffering = Off
upload_tmp_dir = /var/tmp
open_basedir = /var/www:/var/tmp/
disable_functions = show_source,system,shell_exec,passthru,exec,phpinfo,popen,proc_open,

Configure XCache
In-memory caching of php output can really speed up your site and help limit your server's storage I/O requirements. Turnkey LAMP 13.1 already includes XCache, which Joomla nativly supports. A few tweaks to /etc/php5/conf.d/20-xcache.ini and we're set. Before we can do that though, we need to generate an md5 hash for the XCache admin pages. We won't actually set them up, but XCache doesn't like to run without these configured.
echo -n “your_password_here” | md5sum

Now we'll paste the md5 hash of our password in the XCache ini, set up a username for the admin pages (which we won't actually install), and disable XCache's built-in authentication. Joomla requires this set to "off", (and paradoxically that it also have a username and password) to actually write to the cache.
nano /etc/php5/conf.d/20-xcache.ini

xcache.admin.enable_auth = Off
xcache.admin.user = "admin_or_whatever"
xcache.admin.pass = "your_md5_hash"

And let's set some sensible values for cache sizes. If your server has tons of RAM (and your site is fairly large) then feel free to try something larger. Memtop is your friend if you're struggling to find good values. Just be sure to click through quite a bit of content to help fill up XCache.
xcache.size = 64M
xcache.slots = 32K
xcache.var_size = 32M
xcache.var_count = 1
xcache.var_slots = 16K

Finally, we should restart apache2 to ensure all our changes to php.ini and 20-xcache.ini are in effect.
service apache2 restart

Create a MySQL Database for Joomla
While you could use the default database and user, a much less insane approach is to create a database and user for Joomla. This will allow us to set more granular permissions for the Joomla user, keep your Joomla database walled off from other data, and lets us have the option of creating additional databases and users for other applications down the road. First, we log into MySQL as root (remember to use your MySQL root password, not the one for Linux). If you screw up, Turnkey LAMP comes with phpMyAdmin (https://ipaddress_or_url:12322) which makes finding and removing bad data a breeze.
mysql -u root -p

Next, we create a database. For the sake of extension compatibility and to allow for a multi-language setup we will specify UTF-8 character encoding. Use whatever name you like. For a little security through obscurity I like to choose something silly and irrelevant.
CREATE DATABASE thenameyouwant CHARACTER SET utf8 COLLATE utf8_general_ci;

Now for Joomla's MySQL user:
CREATE USER 'someusername'@'localhost' IDENTIFIED BY 'Some_$tr0ng_Password-Here';

We need to give the Joomla user ALL PRIVILEGES on the Joomla database during the install. Afterward SELECT, INSERT, UPDATE, DELETE should be sufficient (though you may need CREATE, DROP, ALTER to install or update extensions as well as Joomla itself). For the love of $DEITY don't leave the Joomla user with ALL PRIVILEGES. The Joomla user's password is stored in plain text in your site's configuration.php and you can bet that's the first stop for anyone who has compromised your server.
GRANT ALL ON nameofyourdatabase.* TO 'thejoomlauser'@'localhost';

And now close the MySQL command line interface to get back to your linux shell.
quit;

Download and Unzip Joomla
Head to the Joomla download page and copy the latest download link address for Joomla 3.2. We'll cd into /var/www, paste that url into a wget request, and then unzip the resulting file.
cd /var/www

Let's clean up a bit first, Turnkey Linux includes some PHP pages to help you find various available tools. All that info is also available via their wiki so we'll remove it on the server to avoid confusion.
rm -rf css images js *.php

Now to download, unzip, and remove the zip file when we're done.
wget http://joomlacode.org/your-Joomla-3-version.zip (paste from joomla.org)

unzip your-Joomla-3-version.zip

rm your-Joomla-3-version.zip

Perform Joomla Install (mostly) Via Browser
If everything prior to this was set up correctly this should be the easy part. In your browser go to the Joomla install page (and let's use HTTPS, seeing as you're about to input your MySQL password whatnot).
https://ip_address-or-url/installatoin

Enter the required information (site name, Joomla administrator credentials,etc). When prompted for database info be sure to use the username, password, and database name you specified earlier. When asked, don't enable FTP. It's not 1998 and there are better ways to get files to/from your server (WinSCP for example).

On the last page before Joomla attempts to finalize your configuration you will see an error (toward the bottom of the page) stating you do not have write access to configuration.php. We actually need to create /var/www/configuration.php and set it as read/write/execute for all users.
touch /var/www/configuration.php

chmod 777 /var/www/configuration.php

Then click finish. You will be greeted by a page stating your install was successful and prompting you to delete the installation folder.

Delete Install Folder
You need to delete the Joomla install folder before you can proceed to the actual administrative pages. Due to our file permissions setup we need to do this manually.
rm -rf /var/www/installation

Now just click the "Administrator" button and log into your new Joomla 3 installation.

27 comments:

  1. The cloud hosting india preparation is the large amount commonly used among most of the clients, exactly where a large number of sites stock up their files and other source, in the same server. On which get note, let’s begin understanding concerning hosting.

    ReplyDelete
  2. This is something that would be useful for both learner and propelled clients. Figuring its upsides and downsides, you will just presumably wind up with a bigger number of favorable circumstances as opposed to its pitfalls. This could most likely be the motivation behind why Joomla is all around adored. Joomla Tutorials

    ReplyDelete
  3. Nice Post. Thanks for share with us. But if you want to Learn how to install Joomla in a Linux Server, CPanel Utility & GoDaddy, click that link and watch our video tutorial.

    ReplyDelete
  4. I am speechless this is really Mindblowing, This is an amazing superb article Keep Sharing this...
    Thanks thanks a lotttttttt!!!!

    USA VPS Hosting

    ReplyDelete
  5. One of the best blog posts I've read! Thanks a ton for sharing this! so if you interested visit this link UK VPS Hosting

    ReplyDelete
  6. Wohh I love it, I mean this blog is just awesome. I personally love this informative article… Keep posting such information… Keep Going!
    Brazil VPS Hosting

    ReplyDelete
  7. An awesomesauce blog post!!! this post is very much help full for all business startups and business growth. to keep it up this type of article posting. thanks for posting.
    Germany VPS Hosting

    ReplyDelete
  8. As you are providing the information about Install Joomla 3.2 on Turnkey Linux 13.1 (Debian 7) LAMP Appliance. You also providing the information about Why Turnkey Linux?. Basically, we want to say that your knowledge really impressive that should be spread to all over the world so that you should create website where you can provide the all information about it. So to do the website you need a perfect hosting solution. you can choose Hong kong VPS Hosting

    ReplyDelete
  9. Thank you for your great post and for helping others become more aware. I am really glad I found your blog. Your Post is very nice and very valuable for every user. Moreover, If you want the best and cheapest VPS Server, dedicated server hosting, and web hosting services with amazing features then choose Onlive Server web hosting company. Apart from that, your blog is awesome.
    France VPS Server

    ReplyDelete
  10. Thank you for sharing a great post. I liked your Information. Keep up the good work. I would like to tell you that If you want the best and cheapest VPS Server, dedicated server hosting, and web hosting services with amazing features then choose Onlive Server web hosting company. Apart from that, your blog is awesome.
    Finland VPS Server
    Thank You...

    ReplyDelete
  11. Thanks a lot!!! i get your valuable information it really very help full for everyone. keep it up........... helping us.
    Japan VPS server

    ReplyDelete
  12. This is very informative blog, writing skill is very creative. Thanks for sharing this kinda articles.
    South Korea VPS Hosting

    ReplyDelete
  13. Thank you for sharing your article. Great efforts put it to find the list of articles which is very useful to know Visit Germany VPS Hosting

    ReplyDelete
  14. As you are providing information that is extremely good for everyone. Basically, we want to say that your knowledge really impressive that should be spread all over the world. Basically, We are leading server hosting Company. There are lots of companies available in the market that provides the hosting solution. if you want any other information about server hosting Contact us without any hesitation. Onlive Server and Onlive Infotech here are available multiple types of server hosting solutions. for more information Click here - USA VPS Hosting.

    ReplyDelete
  15. Excellent blog sir was written by you sir!!!!
    I read your whole blog on "Tilting At Linux" you are providing good information it was very useful for me.
    I also want to share something about Dedicated Server Hosting and providing you the best South Korea Dedicated Server service for your website at a very cheap price.

    ReplyDelete
  16. Such a Mind-blowing Post that You have shared here, This is an amazing superb article Keep Sharing this. Really this is amazing informative blog post. Really Onlive Server provides Israel Dedicated Server Hosting at an affordable price.

    ReplyDelete
  17. You are spreading a good information regarding to "Install Joomla 3.2 on Turnkey Linux 13.1 (Debian 7) LAMP Appliance". Thanks for this. Also you can know about Japan Dedicated Server Hosting if you are interested to buy dedicated server hosting.

    ReplyDelete
  18. A very great thanks for you............to share this kind of article It is very helpful and impressive. You define in your article Install Joomla 3.2 on Turnkey Linux 13.1 (Debian 7) LAMP Appliance very carefully. If you want to know VPS Server hosting. You can choose UK Dedicated Server. It provides extensive backup, server, and network protection with unlimited bandwidth network connections.

    ReplyDelete
  19. This is a nice blog thanks for you..... to share nice information and it is very impressive.India Dedicated Server hosting agreeable blog

    ReplyDelete
  20. Excellent post this is very unique information for everyone. You are explain very well about "Tilting At Linux". If you want better and cheap web hosting now come on Dubai Dedicated Server Hosting

    ReplyDelete
  21. Thank you for your great post and for helping others become more aware. I am really glad I found your blog. If you want to get the best and cheapest dedicated server hosting! Go for Sweden Dedicated Server Hosting from Onlive Server.

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Nice Blog !!!!
    Firstly you are explain very well in this article. This type of article you are sharing is good for this generation and I surely share this article to my friends and near once. If you want to know about server hosting, I can help you. You must know about
    South Korea Dedicated Server and how this could be important for this modern world. Thanks once again.

    ReplyDelete
  24. Awesome informating, providing .This information really very helpful for all users. If you have a little interest in doing online business then Onlive Server one of the best platforms where you could book a domain name free of cost. Italy-Dedicated-Server-Hosting for more information.

    ReplyDelete
  25. Very nice Article.It is very helpful and impressive. You define in your article Install Joomla 3.2 on Turkey Linux 13.1.If you want to purchase France Dedicated Hosting the cheapest price
    France Dedicated Server Hosting

    ReplyDelete