<?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>Johan&#039;s Blog &#187; Mac OS X</title>
	<atom:link href="http://blog.johan-mares.be/tag/mac-os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.johan-mares.be</link>
	<description>A personal blog</description>
	<lastBuildDate>Sun, 24 Oct 2010 15:08:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Put Some Zen Into Your Writing</title>
		<link>http://blog.johan-mares.be/ict/apple/mac-os-x-apple-ict/put-some-zen-into-your-writing/</link>
		<comments>http://blog.johan-mares.be/ict/apple/mac-os-x-apple-ict/put-some-zen-into-your-writing/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 20:40:21 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.johan-mares.be/?p=494</guid>
		<description><![CDATA[Do you know that feeling of being completely absorbed by what you are doing? Being on a roll, concentrating so hard that you are no longer aware of your surroundings. Then (part of) the job is done and you kind of wake up from this trance, becoming more aware of your surroundings, realizing that 3-4 hours have passed, and suddenly feeling the pressure in your bladder. Over the years, has it become easier or more difficult for you to enter this zone? Browsers with 5 open tabs, Twitter, Facebook, e-mail, word processor, spreadsheet, Skype, Google Talk, Yahoo! or Live messenger, ... When was the last time you have experienced this trance like productive state? I am experiencing it now.]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fapple%2Fmac-os-x-apple-ict%2Fput-some-zen-into-your-writing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fapple%2Fmac-os-x-apple-ict%2Fput-some-zen-into-your-writing%2F&amp;source=maresjohan&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Do you know that feeling of being completely absorbed by what you are doing? Being on a roll, concentrating so hard that you are no longer aware of your surroundings. Then (part of) the job is done and you kind of wake up from this trance, becoming more aware of your surroundings, realizing that 3-4 hours have passed, and suddenly feeling the pressure in your bladder. Over the years, has it become easier or more difficult for you to enter this zone? Browsers with 5 open tabs, Twitter, Facebook, e-mail, word processor, spreadsheet, Skype, Google Talk, Yahoo! or Live messenger, &#8230; When was the last time you have experienced this trance like productive state? I am experiencing it now.<span id="more-494"></span></p>
<h3>Ommwriter</h3>
<div id="attachment_500" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2010/02/ommwriter1.jpg"><img class="size-thumbnail wp-image-500" title="Ommwriter" src="http://blog.johan-mares.be/wp-content/uploads/2010/02/ommwriter1-150x150.jpg" alt="Ommwriter" width="150" height="150" /></a>
	<p class="wp-caption-text">Ommwriter</p>
</div>
<p>In the words of the creators: &#8220;Ommwriter is a humble attempt to recapture what technology has snatched away from us today: our capacity to concentrate.&#8221;<br />
<strong>Ommwriter</strong> is quite a unique text editor for Mac OS X in the way that it&#8217;s aim is at helping you to keep focused on your writing and getting things done. I would indeed file this text editor under <strong>GTD</strong> (Getting Things Done).</p>
<p>How does <strong>Ommwriter</strong> create this experience?</p>
<ul>
<li><strong>Full-screen text editing.</strong> Once activated, <strong>Ommwriter</strong> becomes the dominant application on your Mac: full-screen, blocking all other applications from view and blocking all notifications.</li>
<li><strong>Ambient instrumental music</strong> that tends to reduce other sounds to background noise, especially with your headphones on. In the current version 7 tunes are available, some with nature sounds like birdsong, crickets and waves. The music can be turned off.</li>
<li><strong>Keyboard sounds.</strong> There are 7 different keyboard sounds: pebbles, water drops, &#8230; The keyboard sounds can also be turned off.</li>
<li><strong>Background.</strong> There are 3 different backgrounds to choose from: white, some kind of fabric pattern, and the default one a misty, snow covered field with some lonely looking trees.</li>
<li><strong>Minimalistic.</strong> When you are typing the only thing you see is your text; no buttons, no menus, no toolbars, and no other windows.</li>
<li><strong>Focus on content.</strong> The only thing you can do with <strong>Ommwriter</strong> is create content. You cannot do any layout; no changing fonts or colors, no graphics, &#8230; No messing about, the layout is for later.</li>
</ul>
<div id="attachment_501" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2010/02/ommwriter3.jpg"><img class="size-thumbnail wp-image-501" title="Ommwriter menu" src="http://blog.johan-mares.be/wp-content/uploads/2010/02/ommwriter3-150x150.jpg" alt="Ommwriter menu" width="150" height="150" /></a>
	<p class="wp-caption-text">Ommwriter menu</p>
</div>
<p>When you move the mouse a minimalistic menu appears on the upper right corner where you can:</p>
<ul>
<li>switch fonts between serif, sans-serif and script</li>
<li>change the fontsize from default to large and larger</li>
<li>change the background</li>
<li>change the music</li>
<li>change the keyboard sounds</li>
<li>open and save files</li>
</ul>
<p>Moving the mouse also displays the word count. You can change the width and height of the text area. And that&#8217;s it.</p>
<h3>Drawbacks</h3>
<ul>
<li>It is (currently) only available for Mac OS X.</li>
<li>If you don&#8217;t like ambient, instrumental music this might not be your cup of tea, but you can turn the sound off.</li>
<li>If you are a multitasking adrenaline junkie, switching to <strong>Ommwriter</strong> might feel like going cold turkey.</li>
<li>If you are writing an article for which you still have to do research and you have a several other windows open (browser, email, PDF viewer, &#8230;) you are better of using another text editor. <strong>Ommwriter</strong> dominates your screen so you have to minimize and afterwards maximize it again every time you want to consult information in another window. A dual monitor setup provides a way around this limitation, because the program only blocks the main screen. You can scroll using the scroll-wheel in windows displayed on the second monitor, but as soon as you click <strong>Ommwriter</strong> gets minimized.</li>
</ul>
<h3>Conclusion</h3>
<p>If you own a Mac (Mac OS X 10.5 or higher) and you write a lot, whether you are a scriptwriter, blogger, journalist, or poet, you should definitely give <strong>Ommwriter</strong> a try. It provides a unique experience and maybe it will help for you getting things done.<br />
The difference between the common multitasking approach and using <strong>Ommwriter</strong> is that with the former you look productive and with the latter you are productive.<br />
Did I mention that it is free. No more excuses. Download it. Now.</p>
<h3>Resources</h3>
<ul>
<li><a title="Ommwriter" href="http://www.ommwriter.com/" target="_blank">Ommwriter</a></li>
<li><a title="YouTube video by 4nitsirk" href="http://www.youtube.com/watch?v=pQu-h7_ndMM" target="_blank">YouTube video by 4nitsirk</a></li>
</ul>
<p align="center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/pQu-h7_ndMM&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/pQu-h7_ndMM&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<table style="border: medium none; margin: 20px auto; height: 55px;" border="0" align="center">
<tbody>
<tr>
<td>Zen is not some kind of excitement,<br />
but concentration on our usual everyday routine</td>
</tr>
<tr>
<td align="right"><em>Shunryu Suzuk</em></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.johan-mares.be/ict/apple/mac-os-x-apple-ict/put-some-zen-into-your-writing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing a virtual Ubuntu LAMP-server on Mac OS X using VirtualBox</title>
		<link>http://blog.johan-mares.be/ict/linux/installing-a-virtual-ubuntu-lamp-server-on-mac-os-x-using-virtualbox/</link>
		<comments>http://blog.johan-mares.be/ict/linux/installing-a-virtual-ubuntu-lamp-server-on-mac-os-x-using-virtualbox/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 23:02:19 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://blog.johan-mares.be/?p=188</guid>
		<description><![CDATA[Virtualization is a hot topic in ICT. How can you put this to use at home and more specifically on your Mac ? You can use it to run Windows on your Mac, but also to try out different flavors of Linux or to run a LAMP (Linux Apache MySQL PHP) development server. If you have a spare recent pc you can install a baremetal hypervisor like XenServer5, but that's a different story. If you want to install a hypervisor or virtual machine monitor on your MacBook, Mac mini or iMac, there are a number of solutions available. To name a few: VMWare, Parallels, Q and VirtualBox.]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Flinux%2Finstalling-a-virtual-ubuntu-lamp-server-on-mac-os-x-using-virtualbox%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Flinux%2Finstalling-a-virtual-ubuntu-lamp-server-on-mac-os-x-using-virtualbox%2F&amp;source=maresjohan&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Virtualization is a hot topic in ICT. How can you put this to use at home and more specifically on your Mac ? You can use it to run Windows on your Mac, but also to try out different flavors of Linux or to run a LAMP (Linux Apache MySQL PHP) development server. If you have a spare recent pc you can install a baremetal <a title="hypervisor" href="http://en.wikipedia.org/wiki/Hypervisor" target="_blank">hypervisor</a> like XenServer5, but that&#8217;s a different story. If you want to install a hypervisor or virtual machine monitor on your MacBook, Mac mini or iMac, there are a number of solutions available. To name a few: VMWare, Parallels, Q and VirtualBox.<br />
First requirement: it has to be free, free as in made freely available by the software vendor, not as in a pirated or illegal copy. So skip VMWare (unless you stick with the VMWare Player) and Parallels.<br />
Second requirement: it must be a hypervisor project, preferably open source, with active development, user groups, forums and good documentation.<br />
So I chose <a title="VirtualBox" href="http://www.virtualbox.org/" target="_blank">VirtualBox</a>. For the cross-platformers among you, like myself, VirtualBox also runs on Windows, Linux and OpenSolaris and supports a large number of guest operating systems including Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris, OpenSolaris, and OpenBSD.<br />
But this post will be about installing a virtual Ubuntu LAMP or web server on Mac OS X using VirtualBox.<span id="more-188"></span></p>
<h3>
<div id="attachment_370" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-sharing.png"><img class="size-thumbnail wp-image-370" title="vbu-sharing" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-sharing-150x150.png" alt="Sharing" width="150" height="150" /></a>
	<p class="wp-caption-text">Sharing</p>
</div>
<p>Getting started</h3>
<p>For starters, you will need a Mac. I have a MacBook 2.16 GHz Intel Core Duo, with 2 GB RAM and 120 GB hard disk and Mac OS X Leopard (10.5.6) installed. My Mac is connected to a wireless router.<br />
Next, you will need to download <a title="Download VirtualBox" href="http://www.virtualbox.org/wiki/Downloads" target="_blank">VirtualBox</a> for Intel Macs (mine is version 2.1.0) and <a title="Download Ubuntu" href="http://www.ubuntu.com/getubuntu/download" target="_self">Ubuntu</a> server (I chose for the 8.04 <abbr title="Long Term Support">LTS</abbr> 32 bit version).<br />
You will also need enough diskspace to install one or more virtual machines, but that goes without saying &#8230; right ? 8 GB and up is recommended for a virtual machine, but since we will be using the server edition, <abbr title="Command Line Interface">CLI</abbr> only (no GNOME, no KDE, no Office suite, no games, &#8230;) 4-5 GB should be more than enough for a development webserver.</p>
<div id="attachment_371" class="wp-caption alignleft" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-tcpip.png"><img class="size-thumbnail wp-image-371" title="vbu-tcpip" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-tcpip-150x150.png" alt="IPv6" width="150" height="150" /></a>
	<p class="wp-caption-text">IPv6</p>
</div>
<p>The installation of VirtualBox is pretty straightforward, so I&#8217;ll skip this.<br />
However, you must change some settings of Mac OS X. First you must enable internet sharing. To do this, open &#8216;System Preferences&#8217; and in &#8216;Internet &amp; Network&#8217; click &#8216;Sharing&#8217;. Now you get the window you see in the picture &#8216;Sharing&#8217;, select &#8216;Internet Sharing&#8217;, for &#8216;Share your connection from:&#8217; select  &#8216;Airport&#8217; (when you use wireless) and select in &#8216;To computers using&#8217; the &#8216;Ethernet&#8217; option.<br />
Secondly, some sites mention that you should disable IPv6. I didn&#8217;t notice any difference between IPv6 status &#8216;Off&#8217; or &#8216;Automatically&#8217;. The information on those sites wasn&#8217;t very recent  and, if I recall correctly, referred to VirtualBox version 1.x. My IPv6 is configured to &#8216;Automatically&#8217;, but if you want to turn it off, here&#8217;s how to do it. Again open &#8216;System Preferences&#8217; and in &#8216;Internet &amp; Network&#8217; click &#8216;Network, next click the &#8216;Advanced&#8230;&#8217; button and the &#8216;TCP/IP&#8217; tab. Where it mentions &#8216;Configure IPv6&#8242; select &#8216;Off&#8217;.<br />
That should take care of the preparations. Let&#8217;s get down to business and install a virtual webserver.</p>
<h3>Create a virtual machine</h3>
<div id="attachment_372" class="wp-caption alignleft" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-main01.png"><img class="size-thumbnail wp-image-372" title="vbu-main01" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-main01-150x150.png" alt="VirtualBox" width="150" height="150" /></a>
	<p class="wp-caption-text">VirtualBox</p>
</div>
<p>Start VirtualBox. Before we go into the step by step creation process, I will explain some of the choices I made. For RAM I chose 256 MB, this is the minimum for an Ubuntu server, but as it is just for a virtual development or test server on my MacBook, this should be enough. Keep in mind that the memory you allocate to your virtual machine is no longer available for your real machine; 2 GB RAM minus 256 MB still leaves plenty of RAM available for my Mac, enough to run a second and even a third virtual machine if I want to, but if you only have 1 GB of RAM to start with, you will probably notice that everything slows down if you allocate 512 MB to your virtual machine. According to VirtualBox the recommended disk space for Ubuntu is 8 GB, but that is for the desktop version with Gnome and all the bells and whistles you don&#8217;t need in a server. I chose 5 GB to be on the safe side, but after installation I noticed that Ubuntu server needs less than 1 GB of disk space, so I guess 2 or 3 GB should be more than adequate. It depends of course on what kind of sites you&#8217;ll be developing. I chose for &#8216;Fixed-size storage&#8217; instead of &#8216;Dynamically expanding storage&#8217;, but both options work, so no worries here. In the case of &#8216;Dynamically expanding storage&#8217; you select the maximum disk space and that space will only be addressed when needed, so you save some space on your hard drive &#8230; at least for a while.</p>
<p>Create your virtual server:</p>
<ul>
<li>click on the &#8216;New&#8217; icon</li>
<li>click &#8216;Next&#8217; to go to &#8216;VM Name and OS Type&#8217;</li>
<li>choose a meaningful name</li>
<li>as &#8216;Operating System&#8217; select &#8216;Linux&#8217;</li>
<li>as &#8216;Version&#8217; select &#8216;Ubuntu&#8217; or &#8216;Linux 2.6&#8242;, both options work</li>
<li>click &#8216;Next&#8217; to go to &#8216;Memory&#8217;</li>
<li>select amount of RAM, I chose 256 MB</li>
<li>click &#8216;Next&#8217; to go to &#8216;Virtual Hard Disk&#8217;</li>
<li>leave &#8216;Boot Hard Disk&#8217; checked</li>
<li>click &#8216;New&#8230;&#8217;</li>
<li>click &#8216;Next&#8217; to go to &#8216;Hard Disk Storage Type&#8217;</li>
<li>I chose for &#8216;Fixed-size storage&#8217;</li>
<li>click &#8216;Next&#8217; to go to &#8216;Virtual Disk Location and Size&#8217;</li>
<li>I kept the default name and location</li>
<li>select amount of disk space, I chose 5 GB</li>
<li>click &#8216;Next&#8217; and &#8216;Finish&#8217;</li>
<li>for  &#8216;Fixed-size storage&#8217; this can take a couple of minutes</li>
<li>click &#8216;Next&#8217; and &#8216;Finish&#8217; (again)</li>
</ul>
<h3>Virtual machine settings</h3>
<div id="attachment_373" class="wp-caption alignleft" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-general01.png"><img class="size-thumbnail wp-image-373" title="vbu-general01" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-general01-150x150.png" alt="General tab" width="150" height="150" /></a>
	<p class="wp-caption-text">General tab</p>
</div>
<p>Before actually installing your virtual Ubuntu server, you must change some settings.</p>
<p>In the main VirtualBox window, select the virtual machine you&#8217;ve just created and go to &#8216;Settings&#8217; either by a right mouse click on the virtual machine or by clicking on the &#8216;General&#8217; link (in blue). Now click on the &#8216;Advanced&#8217; tab and check &#8216;Enable PAE/NX&#8217;, this is required to install an Ubuntu server, it is however not needed for an Ubuntu desktop or so I&#8217;ve read.</p>
<p>On top of this window you see a list of icons: &#8216;General&#8217;, &#8216;Storage&#8217;, &#8216;Audio&#8217;, &#8216;Network&#8217;, &#8216;Ports&#8217;, &#8230; Click on &#8216;Network&#8217;. Here several settings need to be changed.<br />
Change the &#8216;Adapter Type&#8217; to &#8216;Intel PRO/1000 T Server (&#8230;)&#8217;. This adapter is less demanding on your CPU.<br />
Change &#8216;Attached to&#8217; to &#8216;Host Interface&#8217;, &#8216;NAT&#8217; is fine when you only want an outgoing connection like for Ubuntu Desktop, but you want your Ubuntu Server to accept incoming connections (HTTP, FTP, SSH) too, otherwise your server is useless, so change it to &#8216;Host Interface&#8217;.</p>
<div id="attachment_374" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-network01.png"><img class="size-thumbnail wp-image-374 " title="vbu-network01" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-network01-150x150.png" alt="Network" width="150" height="150" /></a>
	<p class="wp-caption-text">Network</p>
</div>
<p>Which host interface to select in &#8216;Host Interfaces&#8217; ? I read another blog that mentions that you must select &#8216;en0: Ethernet&#8217; even if you only have a wireless connection. I believe this caused all the problems I encountered installing this virtual machine. At first it was a success, the installation went fine, the server got assigned an IP address in the 192.168.2.0 network although I have no idea where this network comes from (Mac or VirtualBox). The updating, upgrading, configuring, &#8230; everything went smooth. I could connect from my MacBook to the virtual machine via HTTP and SSH. Next day, no more connections from the virtual server to the internet or from my MacBook to the server (cannot allocate memory errors, see troubleshooting chapter at the bottom). I lost count on how many attempts I made to get it to work. I was convinced that the problem was either caused by the IPv6 setting or because I didn&#8217;t install the linux-virtual kernel and the &#8216;Guest Additions&#8217; right away. Google searches indicated these to be the most likely culprits. Once the problem occurred, the only solution was to delete the virtual machine and start all over again. It was only after I selected &#8216;en1: Airport&#8217; as &#8216;Host interfaces&#8217; that it kept working. I could see a lot benefits by using the rogue/alien/virtual/&#8230; 192.168.2.0 network: I would be able to connect to my webserver even when my Mac was offline or on a different wireless network, so I didn&#8217;t want to give it up so easily. By selecting &#8216;en1: Airport&#8217; my virtual machines now connect to my wireless router, which has a 192.168.1.0 network. And there are benefits for this solution too: your virtual machines can connect to other machines on your home network (you can use this to make backups) or let those other machines connect to the virtual servers on your Mac (e.g. a Windows pc to test a website with IE). Maybe I did something wrong, maybe the information on the other site was wrong, but 4 times in a row I installed servers with &#8216;en1: Airport&#8217; as host interface and they keep on working.</p>
<h3>Installing Ubuntu server</h3>
<p>Don&#8217;t close the &#8216;Settings&#8217; window yet. Click on &#8216;Storage&#8217; and select the tab &#8216;CD/DVD-ROM&#8217;. If you already closed the window you can click on the link &#8216;CD/DVD-ROM&#8217;. Here you can either mount your Ubuntu CD-ROM in your &#8216;Host CD/DVD Drive&#8217; or select the &#8216;ISO Image File&#8217; you downloaded on your computer. When you choose the &#8216;ISO Image File&#8217; option, click on the folder button on the right and in the new window &#8216;Virtual Media Manager&#8217;, click on the &#8216;Add&#8217; button and browse to the location of the ISO file. Don&#8217;t forget to unmount the CD- or DVD-ROM the first time you shut down after installing.<br />
From an economical and tree hugger point of view it is better to install from an ISO image <img src='http://blog.johan-mares.be/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  .<br />
Now you may hit the &#8216;Start&#8217; button after you&#8217;ve selected the virtual machine.</p>
<div id="attachment_375" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-ub.png"><img class="size-thumbnail wp-image-375" title="vbu-ub" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-ub-150x150.png" alt="Ubuntu" width="150" height="150" /></a>
	<p class="wp-caption-text">Ubuntu</p>
</div>
<p>I am going to walk you through the installation process, but very briefly.</p>
<ul>
<li>select language</li>
<li>select &#8216;Install Ubuntu server&#8217; or &#8216;Check CD for defects&#8217; first</li>
<li>select language, country and keyboard</li>
<li>let it configure your network with DHCP, you can change it later</li>
<li>choose a name for your webserver</li>
<li>as partitioning method I chose &#8216;Guided &#8211; use entire disk&#8217;</li>
<li>for the next step there was only 1 disk to select</li>
<li>agree to write the changes to disks</li>
<li>you can take a break now</li>
<li>set up a user and password</li>
<li>&#8216;HTTP proxy information&#8217;: leave it blank</li>
<li>you can take another short break now</li>
<li>select at least the following software to install: &#8216;LAMP server&#8217; and &#8216;OpenSSH server&#8217;</li>
<li>you will be asked to provide a password for the MySQL root user</li>
<li>after installation, let your virtual machine reboot and don&#8217;t worry about the CD-ROM or ISO image, it will be ignored, but unmount it when you shut your new server down</li>
</ul>
<div id="attachment_376" class="wp-caption alignright" style="width: 150px">
	<a href="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-selsoftware.png"><img class="size-thumbnail wp-image-376" title="vbu-selsoftware" src="http://blog.johan-mares.be/wp-content/uploads/2009/02/vbu-selsoftware-150x150.png" alt="Select software" width="150" height="150" /></a>
	<p class="wp-caption-text">Select software</p>
</div>
<p>There are several advantages for using ssh from a Mac OS X Terminal instead of the terminal or user interface provided by VirtualBox:</p>
<ul style="text-align: left;">
<li>more control over the layout: font, size, colors, background</li>
<li>better keyboard support (e.g. @ # ^ | `)</li>
<li>faster, more responsive &#8230; at least that is my impression</li>
</ul>
<p>Now you have installed a virtual Ubuntu LAMP or web server. It just needs some polishing and then you are ready to go. I believe it is best to continue and especially optimize your kernel for a <abbr title="Virtual Machine">VM</abbr> environment before calling it a day.</p>
<h3>Finishing off</h3>
<p>You do not have to do all of the following steps, for example the steps on how to configure the Apache webserver and vsftpd FTP-server, you can skip these or alter them to your liking, but I just want to leave you with a working webserver. Since it is supposed to be a virtual development server on your notebook or desktop I haven&#8217;t really bothered with security, creating virtual host, optimizations, &#8230;<br />
I recommend you do not skip the network configuration, the update and upgrade and the installation of the virtual kernel and guest additions.</p>
<p><strong>Network configuration</strong>: Currently your network configuration is based on <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>. This is not very useful for a server, you need a static IP address. In the user interface provided by VirtualBox, log in to your server. First check your current network configuration:</p>
<pre>johan@lamp:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:d4:b0:68
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fed4:b068/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1167 errors:0 dropped:0 overruns:0 frame:0
          TX packets:829 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:523485 (511.2 KB)  TX bytes:103126 (100.7 KB)
          Base address:0xc010 Memory:f0000000-f0020000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:600 (600.0 B)  TX bytes:600 (600.0 B)</pre>
<p>Obviously I am connected to the network provided by my wireless router, now edit your network configuration using the command:</p>
<pre>sudo vi /etc/network/interfaces</pre>
<p>For safety reasons it is best to make a copy of this file before editing. I will demonstrate the settings for my home network, they might be different for yours, but this example should help you to figure it out:</p>
<pre># This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.80
gateway 192.168.1.1
netmask 255.255.255.0</pre>
<p>Notice that I don&#8217;t need to specify a wireless-essid, wireless-key or wireless-channel, even though it is, indirectly, using a wireless connection, the settings are for a wired connection.<br />
Next restart the network using the command:</p>
<pre>sudo /etc/init.d/networking restart</pre>
<p>You can check the new configuration with the command <em>ifconfig</em>.</p>
<p><strong>Update/Upgrade</strong>: After an installation it is recommended to update and upgrade the installed software. On an Ubuntu server you do this via the following two commands, the second one can take a while:</p>
<pre>sudo apt-get update</pre>
<pre>sudo apt-get upgrade</pre>
<p><strong>Virtual kernel</strong>: You have to customize or optimize the kernel for a <abbr title="Virtual Machine">VM</abbr> environment:</p>
<pre>sudo apt-get install linux-virtual<strong>
</strong></pre>
<p><strong>Installing Guest Additions</strong>: To install the Guest Additions, click, with your virtual server running and in the active window, in the &#8216;Menu Bar&#8217; on &#8216;Devices&#8217; and &#8216;Installing Guest Additions&#8230;&#8217;. The ISO image containing those additions is now mounted to your virtual machine. By default a CD-ROM is not automatically mounted in Ubuntu server, so use the following commands to gain access to the additions:</p>
<pre>johan@lamp:/$ sudo mount /media/cdrom
mount: block device /dev/scd0 is write-protected, mounting read-only
johan@lamp:/$ cd /media/cdrom
johan@lamp:/media/cdrom$ ls
32Bit        VBoxLinuxAdditions-amd64.run  VBoxWindowsAdditions-amd64.exe
64Bit        VBoxLinuxAdditions-x86.run    VBoxWindowsAdditions.exe
AUTORUN.INF  VBoxSolarisAdditions.pkg      VBoxWindowsAdditions-x86.exe</pre>
<p>According to the VirtualBox manual, you must install <abbr title="Dynamic Kernel Module Support">DKMS</abbr> to be able to compile the kernel using the command (don&#8217;t do it, continue to read):</p>
<pre>sudo apt-get install dkms<strong>
</strong></pre>
<p>If you do that, and you execute &#8216;VBoxLinuxAdditions-x86.run&#8217; you will get the following output:</p>
<pre>johan@lamp:/media/cdrom$ sudo sh ./VBoxLinuxAdditions-x86.run
[sudo] password for johan:
Verifying archive integrity... All good.
Uncompressing VirtualBox 2.1.0 Guest Additions for Linux installation............
VirtualBox 2.1.0 Guest Additions installation
Please install GNU make.
Please install the build and header files for your current Linux kernel.
The current kernel version is 2.6.24-23-virtual
Please install the GNU compiler.
Problems were found which would prevent the Guest Additions from installing.
Please correct these problems and try again.</pre>
<p>As far as I can figure this out, installing DKMS doesn&#8217;t take into account that you have installed the linux kernel for virtualised hardware (linux-virtual). So instead install the headers for the right kernel and the necessary tools to be able to build.</p>
<pre>sudo apt-get install linux-headers-`uname -r` build-essential</pre>
<p>After that you can install the additions (make sure that you are in the CD-ROM directory):</p>
<pre>sudo sh ./VBoxLinuxAdditions-x86.run</pre>
<p>The VirtualBox manual recommends installing them, but I haven&#8217;t used them yet. This post is all about <em>installing</em> a virtual Ubuntu server on Mac OS X. It&#8217;s not an in-depth look at or the nuts and bolds of VirtualBox.</p>
<p><strong>Changing the configuration of the webserver</strong> to enable the per-user web directories. This means that every user can have his/her own website by creating a special directory in his/her home directory. First create a &#8216;public_html&#8217; directory in your home and change the group to &#8216;www-data&#8217; to give the Apache webserver the necessary permissions to process your webpages.</p>
<pre>cd $HOME</pre>
<pre>mkdir public_html</pre>
<pre>sudo chgrp www-data public_html/</pre>
<p>Enable the userdir module and restart or reload the Apache webserver.</p>
<pre>sudo a2enmod userdir</pre>
<pre>sudo /etc/init.d/apache2 force-reload</pre>
<p>Create a PHP test page info.php in your public_home directory with the following contents</p>
<pre>&lt;?php phpinfo(); ?&gt;</pre>
<p>and on your client computer enter the following URL in your browser (change the IP address and username)</p>
<pre>http://192.168.1.80/~johan/info.php</pre>
<p>and you should get the version information for your PHP installation.</p>
<p><strong>Installing an FTP-server</strong> to upload your websites. I am used to the &#8216;Very Secure FTPD&#8217; server, <a title="vsftpd" href="http://vsftpd.beasts.org/" target="_blank">vsftpd</a>, although I believe this is not the default one for Ubuntu. Anyway it is easy to install if you use the following commands to install and stop vsftpd and edit the config file.</p>
<pre>sudo apt-get install vsftpd</pre>
<pre>sudo /etc/init.d/vsftpd stop</pre>
<pre>sudo vi /etc/vsftpd.conf</pre>
<p>In the configuration file uncomment the following settings</p>
<pre>local_enable=YES</pre>
<pre>write_enable=YES</pre>
<pre>local_umask=022</pre>
<p>and change the &#8216;YES&#8217; to &#8216;NO&#8217; in</p>
<pre>anonymous_enable=NO</pre>
<p>and save. Restart.</p>
<pre>sudo /etc/init.d/vsftpd start</pre>
<p>Now you should be able to upload files to your virtual webserver using an FTP-client like <a title="FileZilla" href="http://filezilla-project.org/" target="_blank">FileZilla</a>. Enter the IP-address, your username and password, click &#8216;connect&#8217;. If all goes well, you will see the contents of your home directory on the webserver, including the public_html directory. Any files you upload to the public_html directory will become visible or at least accessible when you enter the following URL in your browser (change IP and username to match your settings):</p>
<pre>http://192.168.1.80/~johan/</pre>
<p><strong>Some extras</strong>: On a webserver I like to have phpMyAdmin and PHP <abbr title="Command Line Interface">CLI</abbr> available (when installing phpMyAdmin, select &#8216;apache2&#8242; when prompted):</p>
<pre>sudo apt-get install php5-cli</pre>
<pre>sudo apt-get install phpmyadmin</pre>
<p>The further configuration of your webserver, samba, &#8230; is beyond the scope of this post. Good luck.</p>
<h3>Troubleshooting</h3>
<p>I experienced a lot of problems at first. The installation went fine, the updating, upgrading and configuring too. Next day, the server could no longer connect to the internet and I could no longer access the server via HTTP, SSH or even ping to it. This happened enough times to exclude an accidental configuration error or a corrupt ISO image. The error messages I got were:</p>
<pre>ping: sendto: Cannot allocate memory</pre>
<pre>ssh: connect to host 192.168.2.22 port 22: Cannot allocate memory</pre>
<p>Once these occur just delete your virtual server and start all over again. They are either caused by IPv6 being turned on, not installing the for <abbr title="Virtual Machine">VM</abbr>&#8216;s optimized kernel or using the fictitious, virtual or whatever it is called 192.168.2.0 network. I have narrowed it down to the use of the 192.168.2.0 network. I do not know enough of virtualization to explain this, I only want a virtual webserver, in fact more than 1 server, running on my MacBook.</p>
<p>You can connect to your virtual server from other machines in your home. This works without hassle for Macs and Linux boxes, but for Windows XP you have to ping or connect via ssh to your virtual server first before you can browse to it (<abbr title="look this one up yourself, will ya">WTF</abbr>).</p>
<h3>PS</h3>
<p>I have no idea if this post is also useful for installing a virtual Ubuntu server on a Windows or Linux host.</p>
<table style="border: medium none; margin: 20px auto; width: auto;" border="0" align="center">
<tbody>
<tr>
<td>Windows users swear at their computers.<br />
Mac users swear by their computers.</td>
</tr>
<tr>
<td align="right"></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.johan-mares.be/ict/linux/installing-a-virtual-ubuntu-lamp-server-on-mac-os-x-using-virtualbox/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Running PHP CLI shell scripts</title>
		<link>http://blog.johan-mares.be/ict/php/running-php-shell-scripts/</link>
		<comments>http://blog.johan-mares.be/ict/php/running-php-shell-scripts/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 19:16:27 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[shebang]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.johan-mares.be/?p=71</guid>
		<description><![CDATA[I already knew how to run PHP scripts from the command line (CLI), although I never really used it. What was new to me was that there are 2 ways of doing this. The first one is by using the php command and the second, and new for me, is by adding a shebang on the first line of your script.]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fphp%2Frunning-php-shell-scripts%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fphp%2Frunning-php-shell-scripts%2F&amp;source=maresjohan&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I already knew how to run PHP scripts from the command line (CLI), although I never really used it. What was new to me was that there are 2 ways of doing this. The first one is by using the php command and the second, and new for me, is by adding a shebang on the first line of your script.</p>
<p>Why would you want to use PHP CLI ? Well you don&#8217;t have to learn another programming language like perl or bash to make shell scripts, you can run cron jobs in PHP and you can reuse code from a website for example in your shell script.<span id="more-71"></span></p>
<p>Before you read any further, the examples below will work for linux and Mac OS X, but not for Windows. I used Ubuntu 8.04 server and Mac OS X 10.5.6.</p>
<p>First you&#8217;ll have to make sure that PHP CLI is installed.</p>
<pre>johan@ubusrv:~$ php -v
PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 23 2008 06:44:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies</pre>
<p>If you see &#8216;cli&#8217; somewhere on the first line, you are ready to go, otherwise you will have to install it first. For example on Ubuntu:</p>
<pre>johan@ubusrv:~$ sudo apt-get install php5-cli</pre>
<p>It it also useful to know the full path to the PHP binary on your computer. There are several ways of finding out. For Ubuntu and Mac OS X the path is &#8216;/usr/bin/php&#8217;.</p>
<pre>johan@ubusrv:~$ which php
/usr/bin/php
johan@ubusrv:~/cli$ whereis php
php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz
johan@ubusrv:~/cli$ type -a php
php is /usr/bin/php</pre>
<p>For the <strong>first method</strong> we&#8217;ll use the following script:</p>
<pre>&lt;?php
        echo "First PHP CLI script\n";
        echo exec('ls -l\n') . "\n";
?&gt;</pre>
<p>You can either execute it by using the php command or by using the full path of the php binary. In this case it is not necessary to make the file exectuable.</p>
<pre>johan@ubusrv:~/cli$ php firstcli.php
First PHP CLI script
-rw-r--r-- 1 1000 1000 71 2009-01-01 19:39 firstcli.php
johan@ubusrv:~/cli$ /usr/bin/php firstcli.php
First PHP CLI script
-rw-r--r-- 1 1000 1000 71 2009-01-01 19:39 firstcli.php</pre>
<p>For the <strong>second method</strong> we&#8217;ll add a <a title="shebang" href="http://en.wikipedia.org/wiki/Shebang_(Unix)" target="_blank">shebang</a> to the first line of the script:</p>
<pre>#!/usr/bin/php -q
&lt;?php
        echo "First PHP CLI script\n";
        echo exec('ls -l\n') . "\n";
?&gt;</pre>
<p>I have added the &#8216;-q&#8217; in the shebang, because you will find a lot of examples like this, but you don&#8217;t need it. According to the <a title="PHP Manual" href="http://be.php.net/manual/en/features.commandline.php" target="_blank">PHP Manual</a> CLI is started up in quiet mode by default, though the <span class="option">-q</span> and <span class="option">&#8211;no-header</span> switches are kept for compatibility so      that you can use older CGI scripts.<br />
After you&#8217;ve made the file executable, you can now run it like any other shell script.</p>
<pre>johan@ubusrv:~/cli$ chmod +x firstcli.php
johan@ubusrv:~/cli$ ./firstcli.php
First PHP CLI script
-rwxr-xr-x 1 1000 1000 89 2009-01-01 19:56 firstcli.php
johan@ubusrv:~/cli$ /home/johan/cli/firstcli.php
First PHP CLI script
-rwxr-xr-x 1 1000 1000 89 2009-01-01 19:56 firstcli.php</pre>
<table style="border: medium none; margin: 20px auto; width: auto;" border="0" align="center">
<tbody>
<tr>
<td>My software never has bugs, it just develops random features</td>
</tr>
<tr>
<td align="right"></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.johan-mares.be/ict/php/running-php-shell-scripts/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 2/10 queries in 0.005 seconds using disk: basic
Object Caching 518/527 objects using disk: basic

Served from: blog.johan-mares.be @ 2012-02-06 06:09:50 -->
