<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mFabrik - mobile sites, apps, HTML5 and CMS software development &#187; mysql</title>
	<atom:link href="http://blog.mfabrik.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mfabrik.com</link>
	<description>Freedom delivered.</description>
	<lastBuildDate>Wed, 03 Aug 2011 09:47:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>One-liner to copy remote MySQL database to local computer</title>
		<link>http://blog.mfabrik.com/2011/07/23/one-liner-to-copy-remote-mysql-database-to-local-computer/</link>
		<comments>http://blog.mfabrik.com/2011/07/23/one-liner-to-copy-remote-mysql-database-to-local-computer/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 16:20:58 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[grant]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1325</guid>
		<description><![CDATA[The following commands dump a MySQL database from a remote server and create a corresponding database on the local computer. The instructions have been tested on OSX and Linux (Ubuntu/Debian). On-line SSH compression is applied, so transferring SQL files, which are text content and compress well, should be around 6x faster than normal. (Well… actually [...]]]></description>
			<content:encoded><![CDATA[<div class="body">
<p>The following commands dump a MySQL database from a remote server and create a corresponding database on the local computer.</p>
<p>The instructions have been tested on OSX and Linux (Ubuntu/Debian). On-line SSH compression is applied, so transferring SQL files, which are text content and compress well, should be around 6x faster than normal.</p>
<p>(Well… actually the script is six lines, but because this is my blog I&#8217;ll decide it doesn&#8217;t count)</p>
<p>The script</p>
<ul class="simple">
<li>Remotely runs mysqldump and puts the result to a local file</li>
<li>Creates a MySQL database and corresponding user with full access to this database</li>
<li>Reads the content of mysqldump to the newly created database</li>
</ul>
<pre class="literal-block"> ssh user@dserver.com -C -o CompressionLevel=9 mysqldump -u YOURDATABASEUSER --password=YOURDATABASEPASSWORD --skip-lock-tables --add-drop-table YOURDATABASENAME &gt; YOURDATABASENAME.sql
mysql -uroot -p
create database YOURDATABASENAME;
connect YOURDATABASENAME;
source YOURDATABASENAME.sql
GRANT ALL ON YOURDATABASENAME.* TO 'YOURDATABASEUSER'@'localhost' identified by 'YOURDATABASEPASSWORD';</pre>
<p>Leave out <tt class="docutils literal">create database</tt> and <tt class="docutils literal">GRANT</tt> for the subsequent runs &#8211; all data on the local computer will be replaced.</p>
</div>
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/07/23/one-liner-to-copy-remote-mysql-database-to-local-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reducing MySQL memory usage on Ubuntu / Debian Linux</title>
		<link>http://blog.mfabrik.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/</link>
		<comments>http://blog.mfabrik.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 10:56:46 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[mtop]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[res]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[virt]]></category>
		<category><![CDATA[virtual memory]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1149</guid>
		<description><![CDATA[If you are running your services on a low end virtual hosting every byte of memory you can save is important. The memory is often the limiting factor of how many applications you can run on VPS: CPUs are shared, memory not, on the same physical host. Low-end VPS come with 512 MB memory or [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running your services on a low end virtual hosting every byte of memory you can save is important. The memory is often the limiting factor of how many applications you can run on VPS: CPUs are shared, memory not, on the same physical host.</p>
<ul>
<li>Low-end VPS come with 512 MB memory or less</li>
<li>Front front-end server Apache / Nginx / Varnish takes &gt; 100 MB +  min. 20 MB for each child process</li>
<li>Memecached takes its toll</li>
<li>MySQL takes 200 &#8211; 400 MB</li>
<li>Each Python / PHP process takes at least 15 MB and you need parallel processes for paraller HTTP requests (FCGI, pre-fork, others&#8230; )</li>
<li>Operating system processes need some memory (SSH, cron, sendmail)</li>
</ul>
<p>As you can see it gets very crowded in 512 MB.</p>
<p>It&#8217;s especially troublesome since the memory is allocated lazily and the memory usage builds up slowly. In some point caches are no longer caches, but swapped to a disk &#8211; virtual memory usage grows beyond available RAM. To keep the server response, everything time critical should fit to RAM once and if the processes themselves don&#8217;t know how to release memory in this situation you need to tune a memory cap for them.</p>
<h2>MySQL memory consumption</h2>
<p>MySQL can be a greedy bastard what comes to memory consumption. Here on this server MySQL seems to take 417M virtual memory which seems to be little excessive for just running two WordPress instances and one Django / Python application:</p>
<pre>1310 mysql     20   0  417M 21100  2776 S  0.0  1.2  0:00.00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/v</pre>
<p>After some tuning I was able to bring it down a bit</p>
<pre>3354 mysql     20   0  276m  19m 2848 S    0  1.2   3:41.19 mysqld</pre>
<p>A reduction of 130 MB, or 1/4 of the server total memory. Not bad.</p>
<p><a href="http://ubuntu-snippets.blogspot.com/2009/02/mtop-mysql-monitor.html">Use mtop to monitor running MySQL</a>, its querieries, etc. so you know what&#8217;s going on. As you can see this MySQL has very good cache rate meaning that basically it is keeping everything in memory. If the content of the sites is less than 10 MBytes total, 400 MB contains plenty of space to cache the content:</p>
<pre>load average: 0.05, 0.08, 0.16 mysqld 5.0.51a-3ubuntu5.8-log up 1 day(s), 19:47 hrs                                                             
2 threads: 1 running, 6 cached. Queries/slow: 187.1K/0 Cache Hit: 99.39%</pre>
<h2>What eats memory</h2>
<p>I am not an expert on MySQL, so I hope someone with more insight could post comments regarding how to tune MySQL for low memory situations and how it is expected to behave.</p>
<p>Some ideas I run through my head</p>
<ul>
<li>MySQL default cache settings are not too tight on Ubuntu/Debian, making it suitable for moderate loads, not low loads. If you don&#8217;t have much content, everything is just kept in memory (even if not needed)</li>
<li>MySQL uses round robin for connections and if there is 100 max connections it will allocate a thread stack for each connection (someone please confirm this &#8211; I found contracting infos).</li>
</ul>
<h2>Configuring MySQL</h2>
<p>Here are listed some methods how to reduce the memory usage. This is what I done on this little box</p>
<p>MySQL is mostly configured in <em>/etc/mysql/my.cnf</em> on Ubuntu / Debian.</p>
<ul>
<li>Let&#8217;s halve key_buffer from 16M to 8M. <a href="http://dev.mysql.com/doc/refman/5.0/en/myisam-key-cache.html">It is used by MyISAM table cache</a>.</li>
<li>Halve <a href="http://techgurulive.com/2010/10/20/query_cache_size-tuning-optimizing-my-cnf-file-for-mysql/">query_cache_size</a>. query_cache_size  = 8M. Also, decrease query_cache_limit to 512 K.</li>
<li><a href="http://www.mysqlperformanceblog.com/2006/05/17/mysql-server-memory-usage/">Each connection, even if idle, will have 256 KB buffer</a>. Decrease the number of max. connections. (XXX: not sure about this). Drop max connections from 100 -&gt; 30, as we do not have that many concurrent visitors on the site. Also, set less aggressive thread_stack size.</li>
</ul>
<p>The final adjustments</p>
<pre>key_buffer              = 8M
max_connections         = 30
query_cache_size        = 8M
query_cache_limit       = 512K
thread_stack            = 128K</pre>
<h2>More info</h2>
<ul>
<li><a href="http://www.zimbio.com/Linux/articles/692/Fine+Tuning+MYSQL+Reducing+Memory+Usage">Fine-tuning MySQL</a></li>
<li><a href="http://www.electrictoolbox.com/mysql-table-storage-engine/">Showing what database engine MySQL tables are using</a></li>
<li><a href="http://www.mysqlperformanceblog.com/2006/05/17/mysql-server-memory-usage/">MySQL server memory usage</a></li>
<li><a href="http://www.lowendbox.com/blog/reducing-mysql-memory-usage-for-low-end-boxes/">Reducing MySQL memory usage for low end boxes</a></li>
</ul>
<p>Send in more tips please! Is 32-bit better than 64-bit for low end VPS, how much this affects MySQL?
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/31/reducing-mysql-memory-usage-on-ubuntu-debian-linux/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Copy/move phpBB3 forum from a server to another computer (Ubuntu/Linux)</title>
		<link>http://blog.mfabrik.com/2011/03/30/copymove-phpbb3-forum-from-a-server-to-another-computer-ubuntulinux/</link>
		<comments>http://blog.mfabrik.com/2011/03/30/copymove-phpbb3-forum-from-a-server-to-another-computer-ubuntulinux/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 13:40:11 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2ctl]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[phpbb3]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1179</guid>
		<description><![CDATA[Here are short instructions what you need to do in order to move / copy phpBB3 forum. Prerequisites What you need in order to benefit from these instructions Basic UNIX command-line knowledge SSH access to the server MySQL access to the database LAMP stack ready on the new server These instructions have been tested on [...]]]></description>
			<content:encoded><![CDATA[<p>Here are short instructions what you need to do in order to move / copy phpBB3 forum.</p>
<h2>Prerequisites</h2>
<p>What you need in order to benefit from these instructions</p>
<ul>
<li>Basic UNIX command-line knowledge</li>
<li>SSH access to the server</li>
<li>MySQL access to the database</li>
<li>LAMP stack ready on the new server</li>
</ul>
<p>These instructions have been tested on Ubuntu/Debian/Linux but they should work in other environments too.</p>
<h2>Write down database access information</h2>
<p>Get password from config.php file on the old server:</p>
<pre>cd /var/www/phpBB3
cat config.php</pre>
<p>Write down database name, username and password.</p>
<h2>Copy files</h2>
<p>Use rsync to remotely copy forum files to a new computer. On new computer, in /var/www folder</p>
<pre>rsync -av --compress-level=9 user@oldserver.com:/var/www/phpBB3 .</pre>
<h2>Dump and copy database</h2>
<p>Execute the following command on the new server. It takes SSH connection to the old server and dumps phpBB3 database to the new server over the SSH connection.</p>
<pre>ssh user@oldserver.com -C -o CompressionLevel=9 mysqldump -u databaseuser --password=databasepassword --skip-lock-tables --add-drop-table databasename &gt; phpbb3.sql</pre>
<h2>Create a new database</h2>
<p>Use the old access information from config.php to create a database with identical access information on the new server. You need a MySQL root access to create new databases.</p>
<pre>mysql -uroot -p</pre>
<p>Create database and grant access to phpBB3 user for it.</p>
<pre>mysql&gt; create database databasename;</pre>
<pre>mysql&gt; GRANT ALL ON databasename.* TO 'databaseuser'@'localhost' identified by 'databasepassword';</pre>
<p>Load the database on the new server from the dump file:</p>
<pre>mysql&gt; connect databasename;</pre>
<pre>mysql&gt; source phpbb3.sql</pre>
<h2>Configure Apache virtualhost for the new server</h2>
<p>The last step is to set-up Apache virtual host on the new server, so you can access the phpBB3 using a domain name. Note that this doesn&#8217;t need to be a real domain name, but you can spoof the domain name using /etc/hosts file on your local workstation.</p>
<p>Add file <em>/etc/apache2/sites-enabled/phpbb3.conf</em> (or pick a filename based on forum name if you host multiple forums)</p>
<pre>&lt;VirtualHost *&gt;
 ServerName yourdomainname.com

 DocumentRoot /var/www/phpBB3
 &lt;Directory /&gt;
   Options FollowSymLinks
   AllowOverride None
 &lt;/Directory&gt;

&lt;/VirtualHost&gt;</pre>
<p>Note that &lt;virtualhost *&gt; may change depending on how Apache has been set up to listen IP addresses and ports. Also if you are using a shared hosting package or VPS you might need to use the server control panel (cPanel) to do this step.</p>
<p>Then check if your new config file is ok and restart Apache:</p>
<pre>apache2ctl configtest
apache2ctl graceful</pre>
<h2>Hosts spoofing trick</h2>
<p>If you are not having a DNS server of your own which you can use for the copy you can always use <a href="http://webandmobile.mfabrik.com/docs/web-and-mobile/user-manual/installation#modifying-your-local-hosts-file">/etc/hosts file trick </a>to spoof domain names. This way you can make Apache to serve the forum from the server even if the forum is not connected to any real domain name yet.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/30/copymove-phpbb3-forum-from-a-server-to-another-computer-ubuntulinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing MySQL-python connector on OSX</title>
		<link>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/</link>
		<comments>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 19:22:29 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[distribute]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[setuptools]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1042</guid>
		<description><![CDATA[Preconditions You are using MySQL installation from mysql.com (and not e.g. from Macports) You want to install MySQL-python egg using easy_install or buildout You&#8217;ll get an error Getting distribution for 'MySQL-python'. install_dir /Users/moo/project/eggs/tmp8-j13e sh: mysql_config: command not found Traceback (most recent call last): File "&#60;string&#62;", line 1, in ? File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1855, in main [...]]]></description>
			<content:encoded><![CDATA[<p>Preconditions</p>
<ul>
<li>You are using MySQL installation from mysql.com (and not e.g. from Macports)</li>
<li>You want to install <a href="http://pypi.python.org/pypi/MySQL-python/">MySQL-python egg</a> using easy_install or buildout</li>
</ul>
<p>You&#8217;ll get an error</p>
<pre>Getting distribution for 'MySQL-python'.
install_dir /Users/moo/project/eggs/tmp8-j13e
sh: mysql_config: command not found
Traceback (most recent call last):
 File "&lt;string&gt;", line 1, in ?
 File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1855, in main
 with_ei_usage(lambda:
 File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1836, in with_ei_usage
 return f()  
...

 31, in &lt;lambda&gt;
 {'__file__':setup_script, '__name__':'__main__'}
 File "setup.py", line 15, in ?
 File "/var/folders/O8/O8pt7q52F7Oi+P3O0pNqq++++TI/-Tmp-/easy_install-g5cvxl/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
 File "/var/folders/O8/O8pt7q52F7Oi+P3O0pNqq++++TI/-Tmp-/easy_install-g5cvxl/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
EnvironmentError: mysql_config not found
An error occured when trying to install MySQL-python 1.2.3.Look above this message for any errors thatwere output by easy_install.
While:
 Installing instance.
 Getting distribution for 'MySQL-python'.
Error: Couldn't install: MySQL-python 1.2.3</pre>
<p>The reason is that MySQL installer puts MySQL under /usr/local and does not expose MySQL utilites directly to path. MySQL-python expects to find utility <em>mysql_config</em> to configure compile time paths when building native bindings using GCC.</p>
<p>Workaround:</p>
<pre>sudo -i
cd /usr/bin
ln -s /usr/local/mysql-5.1.46-osx10.5-x86_64/bin/mysql_config .</pre>
<p>Then rerun installer.</p>
<p>Though it is a bit harsh solution to modify system folder, it gets the thing done in simple manner.
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Local XAMPP development and UNIX file permissions</title>
		<link>http://blog.mfabrik.com/2010/12/22/local-xampp-development-and-unix-file-permissions/</link>
		<comments>http://blog.mfabrik.com/2010/12/22/local-xampp-development-and-unix-file-permissions/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 17:13:30 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[chgrp]]></category>
		<category><![CDATA[chown]]></category>
		<category><![CDATA[documentroot]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[unix file permissions]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=888</guid>
		<description><![CDATA[If you are using XAMPP Apache+MySQL+PHP stack to develop web applications on your OSX or Linux computer you might want to fiddle with Apache settings to make your life easier. By default XAMPP users nobody user for running Apache. If you try to load any file created by your normal system user Apache will give [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> Apache+MySQL+PHP stack to develop web applications on your OSX or Linux computer you might want to fiddle with Apache settings to make your life easier.</p>
<p>By default XAMPP users nobody user for running Apache. If you try to load any file created by your normal system user Apache will give access denied error. This means that either you must make all PHP files readable for everyone, or change the file owner. This is painful if you need to repeat the process for every file.</p>
<p>Instead, it is easier to make XAMPP run under the permissions of your local user.</p>
<p>Edit<em> /Applications/XAMPP/etc/httpd.conf</em>:</p>
<pre>
<div id="_mcePaste">&lt;IfModule !mpm_winnt_module&gt;</div>
<div id="_mcePaste">&lt;IfModule !mpm_netware_module&gt;</div>
<div id="_mcePaste">User yourusername</div>
<div id="_mcePaste">Group staff</div>
<div id="_mcePaste">&lt;/IfModule&gt;</div>
<div id="_mcePaste">&lt;/IfModule&gt;</div>

&lt;IfModule !mpm_winnt_module&gt;&lt;IfModule !mpm_netware_module&gt;</pre>
<pre>DocumentRoot "/Users/yourusername/yoursiteroot"</pre>
<p>You also need to change the location of setting default folder execution rights htdocs location to your development location</p>
<pre>#
# This has been changed from /Applications/XAMPP/htdocs
#
&lt;Directory "/Users/moo/code/joomla/mobilejoomla_dev"&gt;
    Options Indexes FollowSymLinks ExecCGI Includes
   AllowOverride All</pre>
<pre>&lt;/Directory&gt;</pre>
<p>And now Apache will happily eat all files you create or edit.
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/12/22/local-xampp-development-and-unix-file-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating MySQL database and user from command line</title>
		<link>http://blog.mfabrik.com/2010/12/21/creating-mysql-database-and-user-from-command-line/</link>
		<comments>http://blog.mfabrik.com/2010/12/21/creating-mysql-database-and-user-from-command-line/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 22:00:48 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[grant]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=876</guid>
		<description><![CDATA[This serves as my own notes &#8211; I always forget the syntax. Prerequisitements How to deal with UNIX command line programs Use MySQL command to login to running MySQL instance. If this is on local host you can try mysql -uroot # no password or mysql -uroot -p # asks for password Use -H option [...]]]></description>
			<content:encoded><![CDATA[<p>This serves as my own notes &#8211; I always forget the syntax.</p>
<p><strong>Prerequisitements</strong></p>
<ul>
<li>How to deal with UNIX command line programs</li>
</ul>
<p>Use MySQL command to login to running MySQL instance. If this is on local host you can try</p>
<pre>mysql -uroot # no password</pre>
<p>or</p>
<pre>mysql -uroot -p # asks for password</pre>
<p>Use -H option to connect to external MySQL host (on shared hosting).</p>
<p>Then create a new database using CREATE DATABASE command. Here we create a database called <em>joomla</em>.</p>
<pre>
<div id="_mcePaste">mysql&gt; create database joomla;</div>
<div id="_mcePaste">Query OK, 1 row affected (0.00 sec)</div>
</pre>
<p>And then we create a MySQL user whose access is limited to this database only. In this case we create admin user with admin password. Note that MySQL accepts local connections only by default, so MySQL or this user is not exposed to Internet (and potential attacks).</p>
<p>Username is joomla and password is joomladbpassword.</p>
<pre>GRANT ALL ON joomla.* TO 'joomla'@'localhost' identified by 'joomladbpassword';</pre>
<p>&#8230; and now you can proceed to install Joomla.
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/12/21/creating-mysql-database-and-user-from-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating and backing up Joomla! site on Ubuntu Linux</title>
		<link>http://blog.mfabrik.com/2010/10/05/updating-and-backing-up-joomla-site-on-ubuntu-linux/</link>
		<comments>http://blog.mfabrik.com/2010/10/05/updating-and-backing-up-joomla-site-on-ubuntu-linux/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 09:29:46 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[joomla]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=823</guid>
		<description><![CDATA[Here are short instructions for advanced Linux users to update Joomla! sites on Ubuntu Linux servers. Little Joomla! experience is required, the instructions are written from the Linux sys-admin reader perspective. The instructions assume full control over the server, though the instructions might also work on the shared hosting. These instructions also consider minor security [...]]]></description>
			<content:encoded><![CDATA[<p>Here are short instructions for advanced Linux users to update Joomla! sites on Ubuntu Linux servers. Little Joomla! experience is required, the instructions are written from the Linux sys-admin reader perspective. The instructions assume full control over the server, though the instructions might also work on the shared hosting. These instructions also consider minor security updates only, not major updates like Joomla! 1.5 -&gt; 1.6.  For further instructions, <a href="http://docs.joomla.org/Upgrading_1.5_from_an_existing_1.5x_version">please refer to Joomla! update manual</a>. See also <a href="http://forum.joomla.org/viewforum.php?f=430">Joomla! update and migration forum</a>.  It is useful to subscribe to <a href="http://developer.joomla.org/security.html">Joomla! security announcements RSS </a>as Joomla!, being unsafe PHP software by its nature, requires security updates very often. Script kiddies can take down your site very fast unless you can keep up with the updates.</p>
<h2>Work as the site user</h2>
<p>The site can be installed locally (under /home) or globally (under /var/www). If the site is installed globally you might need to set your effective user.  You should perform the command as the same user who owns the site PHP files. You should not be using root use as the owner of the site files. If you run Joomla! site through Apache, the effective user is www-data. Use sudo command to switch to this user. Use ls -l command to figure out which user you are.</p>
<pre>sudo -i -u www-data</pre>
<h2>Back up code files</h2>
<p>Use tar command to pack the existing folder structure in the case the update will destroy critical files.</p>
<pre>cd /var/www/yoursite
tar -cjf yoursite.tar.bz2 *</pre>
<h2>Back up database</h2>
<div>Note that you can see the database password in <em>configuration.php</em> file if you do not remember it.</div>
<div>
<pre>mysqldump -umysql_user_name-p mysql_database_name &gt; mysql_database_name.sql</pre>
</div>
<h2>Check Joomla! version</h2>
<div>Login as administrator. The login URL is the site URL + /administrator</div>
<div>Choose Help -&gt; System info from the menu.</div>
<div>You’ll see Joomla! version line.</div>
<h2>Download version specific Joomla! update pack</h2>
<div>
<p>Each minor version requires its own update. You can have update packages between each version like 1.5.18 -&gt; 1.5.19, or update packs which leap versions like 1.5.18 -&gt; 1.5.20.  <a href="http://joomlacode.org/gf/project/joomla/frs/?action=FrsReleaseBrowse&amp;frs_package_id=5325">Go to Joomla! package listing</a>.  Pick-up the package which will update your current Joomla! version to the latest version.  Download the patch file to the server.</p>
<pre>wget http://joomlacode.org/gf/download/frsrelease/12611/53380/Joomla_1.5.18_to_1.5.20-Stable-Patch_Package.tar.gz</pre>
</div>
<div>
<p>Extract it</p>
<pre>tar -xvzf Joomla_1.5.18_to_1.5.20-Stable-Patch_Package.tar.gz</pre>
<p>This will replace the changed Joomla! files with newer versions.</p>
<h2>Check the update has been correctly applied</h2>
<div>Visit Help -&gt; System info again. See that the version number has been updated.</div>
<div>Check that all pages on your site are working.</div>
<div></div>
<div></div>
<div></div>
</div>
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/10/05/updating-and-backing-up-joomla-site-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Joomla! on your Ubuntu/Linux server with basic security</title>
		<link>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/</link>
		<comments>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/#comments</comments>
		<pubDate>Mon, 31 May 2010 09:13:36 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[email. chmod]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[virtualhost]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=540</guid>
		<description><![CDATA[This how to shorty explains how to set-up a Joomla! hosting on a shared hosting server you own to have basic security. This instructions apply for Debian/Ubuntu based systems, but can be generalized to any Linux based system like Fedora. In this how to we use the following software versions Joomla 1.5 Apache 2.2 MySQL [...]]]></description>
			<content:encoded><![CDATA[<div>This how to shorty explains how to set-up a Joomla! hosting on a shared hosting server you own to have basic security. This instructions apply for Debian/Ubuntu based systems, but can be generalized to any Linux based system like Fedora.</div>
<div>In this how to we use the following software versions</div>
<div>
<ul>
<li>Joomla 1.5</li>
<li>Apache 2.2</li>
<li>MySQL 5.1</li>
<li>Ubuntu 8.04 Hardy Heron server edition</li>
</ul>
</div>
<p>The instructions may apply for other versions too.</p>
<h2>Prerequisitements</h2>
<p>What you need to have in order to use this how to</p>
<ul>
<li>Basic UNIX file permissions knowledge</li>
<li>Basic UNIX shell knowledge</li>
<li>You have a Linux server (Ubuntu / Debian) for which you have root user access and you plan to use this server to host one or several Joomla! sites</li>
<li>Apache and MySQL instaleld on your server</li>
</ul>
<h2>User setup<br />
<span style="font-weight: normal; font-size: 13px;"> </span></h2>
<h2><span style="font-weight: normal; font-size: 13px;">Set-up an UNIX user on a dedicated server for Joomla! hosting. The user can SSH in the box and write to his home folder, /tmp and /var/www site folder.</span></h2>
<p><span style="font-weight: normal; font-size: 13px;">We create a user called &#8220;user&#8221; in this instructions. Replace it with the username you desire. We also use the example site name (www).yoursite.com.</span></p>
<div>Create new UNIX user and /home/user folder.</div>
<pre>sudo adduser user # Asks for the password and created /home/user</pre>
<div>Create corresponding /var/www/user folder.</div>
<pre>sudo mkdir /var/www/user
sudo chmod -R user:user /var/www/user # Only user has writing access to this folder</pre>
<h2>Setup MySQL user account</h2>
<p>Install MySQL as per Debian/Ubuntu instructions.</p>
<p>Login as MySQL admin user (may vary depending how your MySQL is configured). Note that first you will be asked for <em>sudo</em> password, then for MySQL administrative user password.</p>
<pre>sudo mysql -u admin -p</pre>
<div>Then create a new database with the same name as new as the UNIX user. Make sure that we use UTF-8 character encoding so we avoid irritating encoding problems in the future.</div>
<pre>CREATE DATABASE user DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;</pre>
<div>Create a MySQL user with the same name as the UNIX user. Use  a random password and give it all rights for the database. Note that this password should differ from the UNIX username password as this must be stored as plain-text in Joomla PHP files. Also MySQL differs users whether they came from localhost or other IP address. Here we use localhost so that the database is connectable only from the same server as  Apache is running.</div>
<pre>GRANT ALL ON user.* TO 'user'@'localhost' identified by 'zxc123zxc';<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></pre>
<h2>Extract Joomla! installation files</h2>
<p><span style="font-size: x-small;"><span style="font-size: small;"><span>Enter the folder which will contain web site PHP files.</span></span></span></p>
<pre>sudo -i -u user # pose yourself as UNIX user who runs the site</pre>
<pre>cd /var/www/user</pre>
<div>Load the latest Joomla! source code to the server using wget command. Check <a href="http://www.joomla.org/download.html">the download URL from joomla.org web site</a>.</div>
<pre>wget http://joomlacode.org/gf/download/frsrelease/12350/51111/Joomla_1.5.18-Stable-Full_Package.zip</pre>
<div>Unzip it.</div>
<div>
<pre>unzip Joomla_1.5.18-Stable-Full_Package.zip</pre>
<p>Exit posing yourself as user UNIX user.</p>
<pre>exit</pre>
</div>
<h2>Set file permission</h2>
<div>In order to secure your server</div>
<div>
<ul>
<li>Configuration files and upload directory must be writable by Apache user (www-data for Ubuntu/Debian, httpd for Fedora/Red Hat)</li>
<li>Other .php files should be read-only</li>
</ul>
</div>
<p>Note that during Joomla&#8217;s browser based installation Apache&#8217;s <em>www-data</em> must have write access to folder in order to create configuration.php file. We will later remove this access right.</p>
<p>We will set Joomla! files under UNIX group group www-data so that Apache can read them. Certain files are set to be writable. This must be done as root user.</p>
<pre>sudo chown -R user:www-data /var/www/user # Make user group to www-data</pre>
<pre>sudo chmod g+wrx /var/www/user # Read only access to www-data user. Write access for installation, will be later removed.</pre>
<p>Now <em>ls -l</em> command in /var/www/user should give you something like this for fil masks:</p>
<pre>drwxr-xr-x 11 user www-data    4096 2010-05-28 10:22 plugins
-rwxr--r--  1 user www-data     304 2010-05-28 10:21 robots.txt
drwxr-xr-x  6 user www-data    4096 2010-05-28 10:22 templates</pre>
<h2>Creating Apache configuration</h2>
<div>This allows serving Joomla! by Apache and starting the browser based configuration.</div>
<div>First create Apache configuration file under <em>/etc/apache2/sites-enabled</em> as root user. We assume <em>nano</em> terminal base text editor is installed on the server.</div>
<pre>sudo nano /etc/apache2/sites-enabled/yoursite.conf</pre>
<div>Below is a sample configuration file. You may need to match your server public IP in &lt;virtualhost, so that Apache knows for which IP address sites are served. We use virtual hosting: every site on the server is identified by incoming HTTP request.</div>
<div><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">&lt;VirtualHost *&gt;</span></div>
<pre>   ServerName yoursite.com
   ServerAlias www.yoursite.com
   ServerAdmin info@yourcompany.com

   LogFormat       combined
   TransferLog     /var/log/apache2/yoursite.log

   # Make sure this virtual host if capable of executing PHP5
   Options +ExecCGI
   AddType application/x-httpd-php .php .php5

   # Point to www folder where Joomla! is extracted
   DocumentRoot /var/www/yoursite

   # Do not give illusion of safety
   # as PHP safe_mode really is a crap
   # and only causes problems
   php_admin_flag safe_mode off

   #
   # This entry will redirect traffic www.yoursite.com -&gt; yoursite.com
   # Assume mod_rewrite is installed and enabled on Apache
   # 301 is HTTP Permanent Redirect code
   RewriteEngine On
   RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
   RewriteRule (.*) http://yoursite.com$1 [L,R=301]

&lt;/VirtualHost&gt;</pre>
<h2><span style="font-weight: normal;">Faking the DNS entry</span></h2>
<div>If you have not yet reserved a domain name for your site, but still want to get the virtual host working, you can add a DNS name entry into a <a href="http://en.wikipedia.org/wiki/Hosts_file">hosts</a> file on your local computer. The following assumes you are using Ubuntu desktop, but <em>hosts </em>file is available on Windows and OSX too.</div>
<pre>sudo gedit /etc/hosts</pre>
<div>Then add the lines like the example below. Do not forget to remove this from <em>hosts</em> file when the actual DNS has been set up.</div>
<pre># Force this hostname to go to your server public IP address from your local computer</pre>
<pre>123.123.123 yoursite.com www.yoursite.com</pre>
<h2>Start Joomla! browser based installation</h2>
<div>Then enter the URL of your site to the browser:</div>
<pre>http://yoursite.com</pre>
<div>Joomla! installation page should appear.</div>
<div>
<ul>
<li>Fill in MySQL database values as created before.</li>
<li>If you plan to use SSH for file transfer do not enable FTP layer (unsecure).</li>
<li>Use a random password as Joomla! administrator user and store it somewhere in safe.</li>
<li>When Joomla! browser based installation goes to the point it asks you to remove the installation directory follow the instructions below.</li>
</ul>
</div>
<h2 style="font-size: 1.5em;">Secure the configuration</h2>
<div>Now remove extra permissions from Apache&#8217;s www-data user so that in the case there is a PHP / Joomla security hole, your site files cannot get compromised.</div>
<div>Some folders must remain writable as Joomla! will upload or write files in them.</div>
<pre>sudo chmod -R g-w /var/www/user # Remote write permission
sudo rm -rf /var/www/user/installation # Remove installation directory
# Add write permission to folders which contain writable files
sudo chmod -R g+x /var/www/user/logs
sudo chmod -R g+x /var/www/user/images
sudo chmod -R g+x /var/www/user/tmp
sudo chmod -R g+x /var/www/user/images</pre>
<h2>Setting up htaccess files</h2>
<p>Joomla! comes with a sample htaccess file which has some security measurements by having RewriteRules to prevent malformed URL access.</p>
<p>To install this file do the following</p>
<pre>sudo -i
cd /var/www/user
cp htaccess.txt .htaccess
chmod user:www-data .htaccess # Set file permission to be readable by Apache and writable by the UNIX user</pre>
<p>Then we create a .htaccess file which we will place in all folders with Joomla! write access to prevent execution of PHP files in these folders. First we create htaccess.limited file which we use as a template.</p>
<pre>sudo -i
cd /var/www/user
nano htaccess.limited # Open text editor</pre>
<p>Use the following htaccess.limited content</p>
<pre># secure directory by disabling script execution
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI -Indexes</pre>
<p>And put the master template htaccess.limited  to proper places</p>
<pre>cp htaccess.limited media/.htaccess
chown -R user:www-data media/.htaccess 

cp htaccess.limited tmp/.htaccess
chown -R user:www-data tmp/.htaccess 

cp htaccess.limited logs/.htaccess
chown -R user:www-data logs/.htaccess

cp htaccess.limited images/.htaccess
chown -R user:www-data images/.htaccess</pre>
<h2>Start using the site</h2>
<div>Now go to your site with the browser again and Joomla! start page should come up.</div>
<div>Login as administration account you gave in Joomla! browser based installation.</div>
<div>Type URL <em>http://yoursite.com</em> in your browser.</div>
<h2>Setting outgoing email</h2>
<div>This is probably first thing you want to do as Joomla! administrator. You configure the SMTP server which will be used for outgoing email. The server  is usually provided by network operator who provides the internet connection for your server.</div>
<div>Login as Joomla! administrator user.</div>
<div>Go to Site  -&gt; Global Configuration -&gt; Server.</div>
<div>Choose SMTP mail mode.</div>
<div>Enter SMTP details.</div>
<h3>Test outgoing email</h3>
<div>Create a new user with an email address you control The user should receive <em>New User Details</em> email message from the site on the moment the user is created.</div>
<h2>Maintaining file permission</h2>
<div>If you modify or create any files (e.g. upload a new theme) to your server you need to set file permissions for it.</div>
<div>
<ul>
<li>UNIX  user: <em>user (</em>your site username)</li>
<li>UNIX group: <em>www-data</em></li>
</ul>
</div>
<div>To make it possible to set the group ownership with user user you first need to add it to www-data group.</div>
<div>
<pre>sudo usermod -a -G www-data user # Add user to www-data group so that it can set group permissions</pre>
</div>
<div>Then you can fix the permissions for uploaded files (templates and libraries folders assumed)</div>
<pre>sudo -i -u user # Login as your UNIX user
chgrp -R www-data templates libraries # Fix group ownership
chmod -R g+rx libraries templates # Set read access for the group</pre>
<div>This way secure file permissions are fixed after files have been changed. Alternatively, if your secure SFTP program supports setting permissions during the file upload, you can use that option</div>
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>MySQL bind_address workaround</title>
		<link>http://blog.mfabrik.com/2008/09/25/mysql-bind_address-workaround/</link>
		<comments>http://blog.mfabrik.com/2008/09/25/mysql-bind_address-workaround/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 10:34:44 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[3306]]></category>
		<category><![CDATA[bind_address]]></category>
		<category><![CDATA[dnat]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqld]]></category>
		<category><![CDATA[port forward]]></category>
		<category><![CDATA[prerouting]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/?p=121</guid>
		<description><![CDATA[MySQL has an ugly design fault preventing it to listen more than one interface in its bind_address my.conf directive. Thus, you usually cannot connect to the same MySQL instance using localhost and external IP sources. Here is a workaround based on xinetd daemon. These are sample commands for Ubuntu/Debian. Go to root sudo -i Install [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL has an ugly design fault preventing it to listen more than one interface in its bind_address my.conf directive. Thus, you usually cannot connect to the same MySQL instance using localhost and external IP sources.</p>
<p>Here is a workaround based on xinetd daemon. These are sample commands for Ubuntu/Debian.</p>
<p>Go to root</p>
<pre>sudo -i</pre>
<p>Install xinetd</p>
<pre>apt-get install xinetd</pre>
<p>Add a new xinetd mapping</p>
<pre>pico /etc/xinetd.d/mysql

service mysql
{
    only_from	   = localhost mansikki.redinnovation.com 80.75.108.108 server213-171-218-5.livedns.org.uk 213.171.218.5
    flags          = REUSE
    socket_type    = stream
    wait           = no
    user           = root
    redirect       = 127.0.0.1 3306
    log_on_failure += USERID
    interface 	   = 84.34.147.68
}</pre>
<p>Restart xinetd</p>
<pre>/etc/init.d/xinetd restart</pre>
<p>To debug xinetd:</p>
<pre>/etc/init.d/xinetd stop</pre>
<pre>xinetd -d</pre>
<p>xinetd only_from directive also gives an access control by allowed source IP addresses. This protects your MySQL against bots and brute force attacks.</p>
<p>Note that iptables DNAT translation doesn&#8217;t work (easily). Localhost packets don&#8217;t travel PREROUTING and POSTROUTING chains.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/09/25/mysql-bind_address-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

