{"id":376,"date":"2009-11-27T19:02:02","date_gmt":"2009-11-27T23:02:02","guid":{"rendered":"http:\/\/kellytehuna.com\/blog\/?p=376"},"modified":"2009-11-27T19:05:00","modified_gmt":"2009-11-27T23:05:00","slug":"a-virtualized-development-environment","status":"publish","type":"post","link":"http:\/\/kellytehuna.com\/blog\/2009\/11\/27\/a-virtualized-development-environment\/","title":{"rendered":"A virtualized development environment"},"content":{"rendered":"<p>For quite sometime now, I&#8217;ve been developing all the projects I&#8217;ve been working on directly on my machine. This is handy for a number of reasons, the most important of those reasons being that I don&#8217;t have to be online while I&#8217;m working and I don&#8217;t have to upload to any servers.<!--more--><\/p>\n<p>I recently read an article in a Sitepoint newsletter I&#8217;m subscribed to about using a virtual environment, hosted on your machine, as a development environment. For those that don&#8217;t know what I&#8217;m talking about, it basically means running another operating system, like Mac OS X or Linux, or even another copy of Windows, from within my native Windows installation. Why would you want to do this? Because the vast majority of web servers out there are NOT Windows servers. This is an important factor in all of this, because while most of the software that is used to run websites has been ported to the Windows environment, there are still subtle differences and quirks that occur between those versions. If I can develop within the environment that I&#8217;m likely to be deploying to, I will eliminate a good number of those quirks. This is a good thing, because there will be a smaller number of tests to go through when it comes time to deploy the site to the production environment.<\/p>\n<p>Ideally, I would have a completely separate machine to develop my applications on that would host an environment similar to the production environment natively. However, I don&#8217;t have the funds to do that, so a virtual environment is really the only \u00a0feasible option for me. A handy side effect of doing it this way, is I get to practice my server administration skills, which will inevitably come in handy later on.<!--nextpage--><\/p>\n<p>So, I got started by downloading and installing <a title=\"Sun VirtualBox\" href=\"http:\/\/www.virtualbox.org\/\">Sun VirtualBox<\/a>, which is a great virtualization solution provided by <a title=\"Sun Microsystem\" href=\"http:\/\/sun.com\">Sun Microsystems<\/a>. VirtualBox is both simple to install and simple to get running. In both cases, you just double click the appropriate icon on screen and you&#8217;re in business.<\/p>\n<p>Next, I downloaded <a title=\"Ubuntu Linux\" href=\"http:\/\/ubuntu.com\">Ubuntu Linux<\/a>. I decided to get both the Desktop and Server versions, because I&#8217;ve been seriously thinking about moving to a Linux development environment anyway. What better way to check out the software, than to have legitimate installations of it running on my computer without having to completely reformat my machine both times. Again the simplicity of VirtualBox was a breath of fresh when it came to creating virtual hard disks (VHD&#8217;s) and installing both versions of Linux. VirtualBox takes you through a simple wizard to specify how big you want the VHD to be, defaulting to 8GB, how much RAM you want to commit to the virtual installation, defaulting to 128MB and where you want to store the VHD. \u00a0After that, you simply mount the ISO\/CD image on the appropriate VHD, using a virtual CD tray, then fire up the appropriate virtual machine. \u00a0Now, I know the text explanation of this sounds rather confusing, especially with the numerous instances of the word &#8220;virtual&#8221;, but believe me, it took no more than 5 minutes to get the VHD setup and the installation process for Ubuntu Desktop 9.10 started.<\/p>\n<p>Now, installing Ubuntu was, yet another, breath of fresh air. They ask you a bunch of simple questions to get you set up (Language, host name, keyboard layout, etc.) then it just completes the installation and your done. Unmount the ISO, then restart the virtual machine and you&#8217;re now staring at a REAL, live working version of Ubuntu, right in your native OS.<\/p>\n<p>After playing around a little bit, I decided to install the Server version, which would be more appropriate for what I was setting out to do anyway. So, I repeated the steps I went through for the Desktop version and within 15 minutes, I was staring at fresh installation of Ubuntu Server 9.10. So, I logged in and began installing the various packages I wanted, such as <a title=\"Apache Web Server\" href=\"http:\/\/httpd.apache.org\">Apache<\/a>, <a title=\"PHP - PHP: Hypertext Preprocessing\" href=\"http:\/\/php.net\">PHP5<\/a>, <a href=\"http:\/\/mysql.com\">MySQL5<\/a>, <a title=\"Ruby - A programmers's best friend\" href=\"http:\/\/ruby-lang.org\">Ruby<\/a>, <a title=\"Ruby on Rails: Web development that doesn't hurt\" href=\"http:\/\/rubyonrails.org\/\">Rails<\/a> and <a title=\"Subversion - Version Control System\" href=\"http:\/\/subversion.tigris.org\/\">SVN<\/a>. I configured the virtual machine to redirect a small subset of ports to the appropriate ports on the virtual machine (eg. I have it set up to forward port 8888 on my native desktop to port 80 on the hosted environment, which is the default web server port setting!).<!--nextpage--><\/p>\n<p>Again, after just 20 minutes or so, I had everything installed and configured correctly. Thats not to say there weren&#8217;t any issues. The main motivation for doing all of this has been to start REALLY learning Ruby on Rails, which has really been making waves in the web development industry for the last three or four years, because the installation of Rails on Windows is far from simple and there are a number of problems with the MySQL module for Rails, which makes learning Rails a little difficult.<\/p>\n<p>I first heard about Rails while I was working at <a title=\"Black Sheep Creative, Hamilton, New Zealand\" href=\"http:\/\/blacksheepcreative.co.nz\">Black Sheep Creative<\/a> and took a really quick glance at it and decided it wasn&#8217;t worth the effort to learn it since Black Sheep was a PHP development house. If I had known then, that I would be moving to the US and working as a freelancer within two years, I might have got on the Rails train a little sooner. Unfortunately, after installing Ruby and Rails and verifying that both installations were working as I had expected, I attempted to install <a title=\"Phusion Passenger\" href=\"http:\/\/www.modrails.com\/\">Phusion Passenger<\/a>, also known as mod_rails, which is an Apache based Rails deployment solution. To my dismay, doing so removed all the PHP references and packages from my system, making it appear that, for moment at least, I can deploy PHP and Rails from the same Apache installation. At this time, I still have not found a solution for this particular problem. So, naturally, I simply uninstalled Passenger and reinstalled PHP and got it working again. At present, I have to start a the built in WEBrick server that comes with Rails by default to test any Rails development. Not the ideal, by a long shot, but it will do for now.<\/p>\n<p>The last thing I installed was Subversion (SVN). This was entirely painless. I simply ran the appropriate command to download and install SVN directly, then I followed a quick tutorial to allow access to SVN via Apache, which basically means I can access my repositories using http:\/\/ style paths. This took me all of 15 minutes to do and everything is now working perfectly.<!--nextpage--><\/p>\n<p>I have since pushed a couple of the projects I&#8217;ve worked on to that development environment and had no problems. Now, this by no means makes me a Linux administrator or guru, or anything like that, but it&#8217;s a significant step in the right direction, getting me a little closer to knowing everything I need to house and administer my own NATIVE Linux development environment. Until that time comes, which will hopefully be sooner than later, this is a very innocuous way of learning the minimum requirements to get me going.<\/p>\n<p>All in all, the experience was a good one. I don&#8217;t know that I will push all my projects to the virtual environment, even though I know I should, but there is still something to be said for the convenience of just editing a file, then refreshing a browser a browser, without having to push the file to a server. Having said that, if I can get the workflow down, this may be development setup of choice. Only time will tell.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For quite sometime now, I&#8217;ve been developing all the projects I&#8217;ve been working on directly on my machine. This is handy for a number of reasons, the most important of those reasons being that I don&#8217;t have to be online while I&#8217;m working and I don&#8217;t have to upload to any servers.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[25,11],"tags":[70,14,68,69,71,67],"class_list":["post-376","post","type-post","status-publish","format-standard","hentry","category-rantings","category-software","tag-linux","tag-mysql","tag-php","tag-ruby-on-rails","tag-subversion","tag-virtual-environment"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2FJaA-64","jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/posts\/376"}],"collection":[{"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/comments?post=376"}],"version-history":[{"count":6,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions"}],"predecessor-version":[{"id":382,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions\/382"}],"wp:attachment":[{"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/categories?post=376"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kellytehuna.com\/blog\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}