<?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>Nathan Bridgewater &#187; linux</title>
	<atom:link href="http://www.integratedwebsystems.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.integratedwebsystems.com</link>
	<description>My Little .NET Sandbox</description>
	<lastBuildDate>Thu, 19 Jan 2012 20:37:02 +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>Get Started with Amazon EC2, Run Your .NET MVC3 (Razor) Site in the Cloud with Linux Mono</title>
		<link>http://www.integratedwebsystems.com/2011/12/get-started-with-amazon-ec2-run-your-net-mvc3-razor-site-in-the-cloud-with-linux-mono-2/</link>
		<comments>http://www.integratedwebsystems.com/2011/12/get-started-with-amazon-ec2-run-your-net-mvc3-razor-site-in-the-cloud-with-linux-mono-2/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 21:30:00 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[MVC 3]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MVC3]]></category>

		<guid isPermaLink="false">http://www.integratedwebsystems.com/?p=1325</guid>
		<description><![CDATA[I’ve recently been getting pretty excited about Amazon EC2 once I realized...]]></description>
			<content:encoded><![CDATA[<p>I’ve recently been getting pretty excited about <a href="http://aws.amazon.com/ec2">Amazon EC2</a> once I realized you can setup a micro linux server for free to learn and test out their services. I know, a couple years behind the curve right? I’ve just never really looked into it. Now that I’m familiarizing myself with the whole cloud concept with Amazon, it’s really cool to think of small business growth potential in the web market without the restraint of building a heavy infrastructure upfront. I realize after reading some other articles that in the long run, it is probably more expensive than hosting your own solution. But as a startup, it still seems to me that it’s a pretty good deal at least for short term events or just taking their infrastructure out for a spin to test some ideas. Pay for what you use; that’s Amazon’s big pitch with their <a href="http://aws.amazon.com">Amazon Web Services (AWS)</a>. </p>
<p>So if you want to play around with <a href="http://aws.amazon.com/free">AWS for free</a>, you have to roll Linux. If you want to host ASP.NET MVC3 on AWS Linux, there’s a few steps you need to take. For this post, I’ll talk about some of the AWS services that can get you started along with how to install and configure your environment for hosting ASP.NET MVC3 applications with Linux and Mono.</p>
<p><span id="more-1325"></span><br />
<h2>Disclaimer:</h2>
<p>Before you try any of this, carefully read all the terms and conditions regarding <a href="http://aws.amazon.com">Amazon Web Services</a>. Review their pricing structure for every service you plan to use and the qualifying restrictions for the <a href="http://aws.amazon.com/free">free tier</a>. While their pricing structure is very competitive, it’s also very complicated. Be sure to fully understand what services you enable before doing it. Payment information is required to setup your AWS account, but you will only be charged when you use services that are not free. I am not responsible for any fees you may incur while using AWS services.</p>
<p>&#160;</p>
<h2>Conventions Used in This Article</h2>
<h3>Intended Audience</h3>
<p>I’m writing this post for people who are mostly familiar with Windows environments and maybe have some experience with Linux. I may over-explain a few concepts like using SSH or tab completion, which mainly target the Windows folks who may have never seen this before. Otherwise, this post can be used as a reference guide to AWS and using Mono Web hosting in general. We will be using the default MVC 3 application as our sample, which might be interesting if you haven’t worked with it yet. If you’ve never worked with Mono web hosting before, always start with something simple and familiar. I wouldn’t recommend trying to take your massive, enterprise, e-commerce solution and running it straight up on Mono without expecting a few hiccups.&#160; The <a href="http://mono-framework.com/MoMA">MoMA tool</a> will be useful for migrating assemblies since it identifies functionality not yet supported by Mono in your assemblies.</p>
<h3>Keystrokes</h3>
<p>There are a few conventions used throughout this tutorial. I’ll indicate keystrokes with {} characters, like in the example: {Ctrl} for a Control keystroke. I’ll hyphenate key combos like {Ctrl-D} for Control and D pressed simultaneously. And I’ll separate them for consecutive keystrokes: {Ctrl}{D} for Control then D.</p>
<h3>Tab Completion</h3>
<p>Another useful tip I’ll sometimes mention is when using the bash shell, you can type a segment of a directory or file name and press {TAB} to complete it. It will complete to the next unique segment. So if there are two files with similar names, it will complete the statement for the common portions of the names and wait for input. You can add the next unique character and press {TAB} again to make it go further. This is very useful when entering long paths or filenames from the command line. For example to script named install_mono-2.10.5.sh you can simply type:</p>
<p>./in{TAB}</p>
<p>Wait for the completion, then if it’s correct, {ENTER} to execute it.&#160; Sometimes you’ll have to add a few extra characters to help it out.&#160; Any path or git branch argument (and probably many other things) in Linux use this functionality.</p>
<h3>Linux Command Line</h3>
<p>As always with Linux command line, if you want to know how a specific command works, you can always check its manual pages by entering: “man &lt;command&gt;”&#160;&#160; For example to see the manual for ssh, you can enter “man ssh”.&#160; To exit the manual, just hit {Q}.</p>
<p>&#160;</p>
<h2>Amazon Web Services</h2>
<p>Amazon Web Services (AWS) is a lot like an Ad-hoc enterprise infrastructure. You pick and choose the components you want and put them together in the arrangement of your choice. Every service comes with a cost, so you weigh how you design your infrastructure based on your needs. The main two services we’ll use to get started include <a href="http://aws.amazon.com/ec2">EC2 (Elastic Cloud Computing)</a> using <a href="http://aws.amazon.com/ebs/">EBS (Elastic Block Storage)</a> for its local file system and <a href="http://aws.amazon.com/s3">S3 Storage Service</a> as our static content storage (and delivery).</p>
<h3><a href="http://aws.amazon.com/ec2">Elastic Cloud Computing (EC2)</a></h3>
<p>EC2 is simply server that and provide any service we want. It’s computing on demand and you pay by the hour. For smaller environments (like this walkthrough), we’ll fire up one micro instance for both database and web server; while in larger environments, you might setup a pool of database servers, a pool of application servers with horizontal scaling in mind. With EC2 you have the option of using the built-in instance storage (usually about 160GB for paid servers) or using the <a href="http://aws.amazon.com/ebs/">Elastic Block Storage (EBS)</a> service. EBS allows for a persistent (shared) storage for your instances. You can clone them into new servers or snapshot instances on existing servers.</p>
<h3><a href="http://aws.amazon.com/s3/">Amazon Simple Storage Service (S3)</a> &amp; <a href="http://aws.amazon.com/cloudfront">CloudFront</a></h3>
<p>The S3 service provides centralized storage for all your applications. S3 is accessible from outside the Amazon network and the price is pretty competitive starting roughly around <a href="http://aws.amazon.com/s3/#pricing">$0.14 USD/GB/month</a>. Using this service is not required, but if you have an application with a lot of local assets, this is a pretty good option to keep them on the AWS network. You can also expose your files in S3 to the public essentially turning it into a static file web server. If you need a more responsive edge network, then S3 will serve as a data source for the CloudFront service and deploy your assets to edge locations around the world.</p>
<p>&#160;</p>
<h2>Tools</h2>
<p>In order to use AWS on Linux, you’ll need an interactive SSH client and some common Linux utilities like tar, gzip, etc. For those of you Linux/Mac users, these tools are likely already setup on your machines. However, those of you Windows folks (like me) will need to install a few things.</p>
<p><a href="http://code.google.com/p/msysgit/downloads/list">MsysGit</a> comes with all these utilities nicely packaged. <a href="http://www.mingw.org/wiki/MSYS">Msys</a> is a set of recompiled GNU utilities for Windows. It enables a nearly identical bash command line shell for Windows as Linux, and they run natively. It also comes with openSSH and SCP which come in extremely useful when connecting to servers or moving files around between Windows and Linux.</p>
<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Putty</a> is another great interactive SSH utility, and <a href="http://filezilla-project.org/download.php">FileZilla</a> is a great graphical file transfer client, which works with SSH. I commonly bounce between all these tools in my environments. If you want to use Putty with your AWS server, you’ll also need the PuttyGen utility available on Putty’s website. This will create a private key that wraps your openSSH based key for use with Putty and FileZilla.</p>
<p>Finally, if you want to use AWS services programmatically, you of course will need to download the <a href="http://aws.amazon.com/sdkfornet/">AWS SDK</a>.&#160; Mac/Linux users can scroll to the bottom of the screen and download the “DLLs and Samples” version that is packaged in a ZIP for Mono.</p>
<h4>Required Windows tools for this walk-through:</h4>
<ul>
<li><a href="http://code.google.com/p/msysgit/downloads/list">MsysGit installer</a>&#160; &#8211; During install, make sure you <strong>enable</strong> the Windows Explorer shell context menu for<strong> Git Bash Here</strong>. </li>
</ul>
<p>&#160;</p>
<h2>Setup EC2 Instance</h2>
<p>Before you get started setting up a new EC2 instance, you need to register an AWS account. This will require a credit card. If you’re a new customer or comply with their terms and conditions for the <a href="http://aws.amazon.com/free">free tier</a>, then you don’t need to worry about being charged fees for usage. Registration takes a little while. Eventually, you’ll receive an email stating your account is active and ready to go.</p>
<h3>Launch New Instance</h3>
<p>Sign into your AWS Management Console and enter the EC2 section.&#160; When creating a new EC2 instance, we’re first going to find the Amazon Machine Image (AMI) that we want to use for our new server. Canonical provides a few pre-built ones for different versions of Ubuntu and they occasionally release updated AMI’s as updates are released.&#160; I chose to use the most recent (at the time of this post) Lucid (10.04 LTS) build.</p>
<p>To get started, click Launch New Instance in the top left. First, choose the Community AMI’s tab and then search for <em>ami-61be7908</em>.&#160; Also, watch for the star that indicates &quot;free tier” server. Make sure you choose a free tier AMI!</p>
<p>Step through the setup wizard for your new AMI. I used mostly defaults to ensure the free tier shown here. Click each image for an enlarged screenshot.</p>
<div class="gallery"><a title="Setup EC2 Step 1 - Choose an AMI from the Community AMI&#39;s tab. Ensure selected AMI is Free Tier indicated by star." href="http://assets.integratedwebsystems.com/1.png"><img alt="Setup EC2 Step 1" src="http://assets.integratedwebsystems.com/thumbs/1.png" /></a> <a title="Setup EC2 Step 2 part 1" href="http://assets.integratedwebsystems.com/2a.png"><img alt="Setup EC2 Step 2 part 1" src="http://assets.integratedwebsystems.com/thumbs/2a.png" /></a> <a title="Setup EC2 Step 2 part 2" href="http://assets.integratedwebsystems.com/2b.png"><img alt="Setup EC2 Step 2 part 2" src="http://assets.integratedwebsystems.com/thumbs/2b.png" /></a> <a title="Setup EC2 Step 2 part 3 - Enter a name for your instance. This will be shown in the EC2 instance list." href="http://assets.integratedwebsystems.com/2c.png"><img alt="Setup EC2 Step 2 part 3" src="http://assets.integratedwebsystems.com/thumbs/2c.png" /></a> <a title="Setup EC2 Step 3 - Setup your public key authentication. Don&#39;t forget to download the key." href="http://assets.integratedwebsystems.com/3.png"><img alt="Setup EC2 Step 3" src="http://assets.integratedwebsystems.com/thumbs/3.png" /></a> <a title="Setup EC2 Step 4 - Configure your firewall. Enable 80 and 22. WHen using Security Groups, you can re-use these permission sets on other instances." href="http://assets.integratedwebsystems.com/4.png"><img alt="Setup EC2 Step 4" src="http://assets.integratedwebsystems.com/thumbs/4.png" /></a> <a title="Setup EC2 Step 5 - Review and launch your new instance." href="http://assets.integratedwebsystems.com/5.png"><img alt="Setup EC2 Step 5" src="http://assets.integratedwebsystems.com/thumbs/5.png" /></a></div>
<p>&#160;</p>
<p>The important thing here is that we’re choosing a micro (free tier instance). Starting out, I would open up just your web ports 80 and 22. When you finish the wizard, your instance will automatically start up.</p>
<p>During step three, you will create a new key pair if you haven’t already created one. You will need to download the key file to your local machine and place it somewhere easily accessible for you to use from a command line. (In my case, I saved to the ~/.ssh folder which translates to <em>C:\Users\&lt;username&gt;\.ssh </em>in Windows 7.</p>
<h3>Setup an Elastic IP</h3>
<p>Before we connect to the new server, we also need to setup an Elastic IP.&#160; Elastic IPs act similar to static IPs except when you’re done using them, Amazon will release it back into the pool for someone else to use.&#160; This will allow you to shutdown your server or reboot your server and still maintain the same IP. Using this service is free as long as you have a running instance associated with it; otherwise, Amazon will charge for its use to discourage wasting unused IP allocations on their network.</p>
<p>Since we have a new EC2 instance available and running, go ahead and allocate an Elastic IP. To do this, make sure you’re still in the EC2 section of AWS dashboard and click the Elastic IPs link under the left navigation labeled: Network &amp; Security.&#160; Click the button on the to, “Allocation New Address”. Select the EC2 option and click “Yes, Allocate.”&#160; You will now have a dedicated IP in your list. Select the row and then click “Associate Address.” Choose the instance we just setup, and you’re done! One caveat to take note of is that shutting down the server will disassociate the address. So when you boot it back up, you will need to re-associate the address.&#160; Rebooting the server will not disassociate the address.</p>
<p><img title="Setup elastic IP step 1" alt="Setup elastic IP step 1" src="http://assets.integratedwebsystems.com/elasticIP-1.png" /></p>
<p><img title="Setup elastic IP step 1" alt="Setup elastic IP step 2" src="http://assets.integratedwebsystems.com/elasticIP-2.png" /></p>
<p>&#160;<img title="Setup elastic IP step 1" alt="Setup elastic IP step 3" src="http://assets.integratedwebsystems.com/elasticIP-3.png" /></p>
<p>&#160;</p>
<h2>Connect to Your Server</h2>
<p>Now that you’ve setup your new EC2 instance and you’ve configured your Elastic IP to route to your instance, you can now make a connection to your new server.</p>
<p><em>NOTE: Typically you can setup a DNS host record to resolve to your Elastic IP simplifying communication with your server. Naturally, this is what you would do when setting it up as a web server.&#160; In this case since we’re just experimenting, you can setup an easy unknown name like test.yourdomain.com just so you don’t have to continually refer to your IP address in command line. </em></p>
<p>SSH in the Linux world is like the Swiss army knife for admins.&#160; You can use SSH to connect to an interactive terminal, transfer files, or even tunnel traffic through its connection. It’s also encrypted with a public/private key pair (typically RSA). When you created the key on Amazon, you essentially generated the public/private key pair and you downloaded the public key.&#160; SSH will use that public to authenticate your connection against a pre-setup user account on the server.</p>
<p>Have your key file handy. Earlier I suggested you place this in your home .ssh directory ~/.ssh or on Windows 7, C:\Users\&lt;username&gt;\.ssh\.&#160; Right click on any directory with Windows Explorer and open an Git Bash. Then go to your .ssh directory by entering: “<em>cd ~/.ssh”</em>.<em>&#160; </em>This should place you in the same directory that we stored the key file for AWS making it very easy to refer to during this walkthrough. In the sample below, we called this file “mykey.pem”. Call it whatever you want.</p>
<p>Enter:</p>
<pre class="brush: bash; gutter: false;">ssh aws.yourdns.com –l ubuntu -i mykey.pem</pre>
<p>&#160;</p>
<p><em>NOTE: Don’t forget the tab completion here. A shortcut for this is to enter the command below. (Of course this is assuming you’re in the same directory as the mykey.pem file.&#160; </em></p>
<pre class="brush: bash; gutter: false;">ssh aws.yourdns.com –l ubuntu -i my{TAB}</pre>
<p>&#160;</p>
<p>You should see a busy welcome screen informing you about some basic info about your server. It will also let you know if you’re running the most recent AMI.&#160; Having the most recent AMI is not very important. With the built-in aptitude package manager, your server can easily stay current even running an older AMI.</p>
<pre class="brush: bash; gutter: false;">Linux domU- 2.6.32-318-ec2 #38-Ubuntu SMP Thu Sep 1 17:54:33 UTC 2011 i686 GNU/Linux
Ubuntu 10.04.3 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Nov  8 19:48:48 UTC 2011

  System load:  0.0               Processes:           68
  Usage of /:   37.6% of 7.87GB   Users logged in:     0
  Memory usage: 41%               IP address for eth0: 10.208.195.158
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/
---------------------------------------------------------------------
At the moment, only the core of the system is installed. To tune the
system to your needs, you can choose to install one or more
predefined collections of software by running the following
command:

   sudo tasksel --section server
---------------------------------------------------------------------

8 packages can be updated.
7 updates are security updates.

A newer build of the Ubuntu lucid server image is available.
It is named 'release' and has build serial '20110930'.
Last login: Mon Nov  7 21:31:53 2011 from 75.81.113.113</pre>
<p>&#160;</p>
<p>As you can see, I have a few packages that are available for update. So the first thing I like to do is immediately update the server. Do that with two commands. Apt-get update and apt-get upgrade. Update will re-sync the package cache for the local repositories. Upgrade will actually download and install the updated packages onto your system. Dist-Upgrade, another form of upgrade, will force update all new packages regardless of dependencies. This is typically something you’ll use when you start with a fresh server. After that, the normal “upgrade” should work fine. You can combine these commands into one by concatenating them with “&amp;&amp;”.</p>
<pre class="brush: bash; gutter: false;">sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade -y</pre>
<p>&#160;</p>
<p>This will update the repositories; and if successful, will continue to the upgrade command and install the updates.&#160; The option “-y” simply instructs the upgrade to automatically answer yes to installing package updates.&#160; We’re running the command with sudo to temporarily enable root privileges. We’re “su” “doing” the command.</p>
<p>&#160;</p>
<h2>Install Mono &amp; Apache</h2>
<p>Now that we’ve updated the system we can continue to install all the necessary packages for the web server. I’m choosing to use Badgerports for the Mono install. Optionally, you can compile and install your own (sometimes more recent) version of Mono, but Badgerports is very convenient and easy to use.&#160; At the same time, we’ll install Apache.&#160; Enter these commands sequentially (one per line)</p>
<pre class="brush: bash; gutter: false;">wget http://badgerports.org/directhex.ppa.asc
sudo apt-key add directhex.ppa.asc
sudo apt-get install python-software-properties
sudo add-apt-repository 'deb http://ppa.launchpad.net/directhex/ppa/ubuntu lucid main'
sudo apt-get update
sudo apt-get install mono-apache-server4 mono-devel libapache2-mod-mono </pre>
<h3>&#160;</h3>
<h3>Setup Web Folder</h3>
<p>Now configure the directory where we’ll place the web files. Enter the following commands to create the directory and set its ownership and permissions.</p>
<pre class="brush: bash; gutter: false;">cd /srv
sudo mkdir www
cd www
sudo mkdir default
sudo chown www-data:www-data default
sudo chmod 755 default</pre>
<p>&#160;</p>
<h3>Configure Apache &amp; Virtual Host</h3>
<p>Finally, setup the apache virtual host to run our website.&#160; We’ll start by creating our virtual host configuration file that enables the 4.0 mono server for the web directory we just setup. We’ll than set it up nicely with the debian/ubuntu environment so we can easily disable and enable it.&#160; For this sample, I used mono-project’s <a href="http://go-mono.com/config-mod-mono/">mod_mono configuration tool</a> as a starting point. I then switched its server command to mod-mono-server4 (for 4.0 runtime), and I also changed its DocumentRoot to use the directory we setup.</p>
<p>&#160;</p>
<pre class="brush: xml;">&lt;VirtualHost *:80&gt;
  ServerName my-mono-server.somewhere.com
  ServerAdmin web-admin@my-mono-server.somewhere.com
  DocumentRoot /srv/www/default
  MonoServerPath my-mono-server.somewhere.com &quot;/usr/bin/mod-mono-server4&quot;
  MonoDebug my-mono-server.somewhere.com true
  MonoSetEnv my-mono-server.somewhere.com MONO_IOMAP=all
  MonoApplications my-mono-server.somewhere.com &quot;/:/srv/www/default&quot;

  &lt;Location &quot;/&quot;&gt;
    Allow from all
    Order allow,deny
    MonoSetServerAlias my-mono-server.somewhere.com
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI &quot;\.(?:gif|jpe?g|png)$&quot; no-gzip dont-vary
  &lt;/Location&gt;
  &lt;IfModule mod_deflate.c&gt;
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
  &lt;/IfModule&gt;
&lt;/VirtualHost&gt;</pre>
<p>&#160;</p>
<p>We’re going to use the local clipboard to copy and paste the contents into VIM through the msys window. With the default MSysGit client, it uses a Windows “cmd” shell so you can right click, “Paste” or enable quick edit mode to paste into the window.&#160; While working in VIM, if you have an problems with keystrokes, just hit {Esc} a couple times and you should be able to re-enable insert mode by pressing {i} once. Enter the following to open a new file in VIM.</p>
<pre class="brush: bash; gutter: false;">cd /etc/apache2/sites-available
sudo vi mono-default

#copy the contents above and paste them into the new file
{i}{Then paste - right click the window and select paste}
{Esc}:wq{Enter}</pre>
<p>Now we can create a symbolic link to this file from the enabled directory.</p>
<pre class="brush: bash; gutter: false;">cd /etc/apache2/sites-enabled
sudo rm 000-default
sudo ln -s /etc/apache2/sites-available/mono-default 000-mono</pre>
<p>&#160;</p>
<h3>Install Trusted Certificate Authorities</h3>
<p>If we want to use the AWS tools in our application, we’ll need to first install the trusted keys. We’ll use the mozroots tool to do that. We’ll use “sudo –u www-data” to run mozroots as the www-data user.</p>
<p>Enter:</p>
<pre class="brush: bash; gutter: false;">sudo –u www-data mozroots --import –sync </pre>
<p>&#160;</p>
<p>As a simple test to ensure the basic configuration is working, we can move the normal default web page into our new directory and then make a request against it.</p>
<pre class="brush: bash; gutter: false;">sudo mv /var/www/index.html /srv/www/default
sudo vi /srv/www/default/index.html 

# arrow down a couple lines to content
# press {i} then enter something. just to make it a little different
{Esc}:wq{enter}

# restart the web server sudo service apache2 restart </pre>
<p>If the web server restart reported “OK” then make a request against your server (from your local machine) to test the web server configuration. Open a browser and browse to <em>http://&lt;your-host-name/index.html</em>.&#160; You should see your slightly modified default page. Now we can continue on to building out the default MVC3 web application and test that.</p>
<p>If the web server did not restart okay, read the messages that were reported. Also, if you’re not seeing anything there you can always refer back to the apache logs located at: /var/log/apache2/error.log.&#160; If anything goes wrong throughout this entire process, always check the end of that file.</p>
<p>&#160;</p>
<h2>Deploy your first site</h2>
<h3>Create and Publish a New MVC 3 Project</h3>
<p>Finally… We’re ready to deploy a real .NET MVC3 application on Linux. We’re going to be doing a typical BIN deployment of MVC 3. I have detailed this out in another blog post and covered some of the potential issues you could run into while <a href="http://www.integratedwebsystems.com/2011/06/get-mvc3-razor-running-on-mono/">BIN deploying an MVC 3 project to Mono</a>.&#160; Feel free to refer to that post if you having any problems. Lets get started here by creating a new project.</p>
<p>Open Visual Studio and create a new Project. Choose .NET Framework 4, then ASP.NET MVC 3 Web Application. Choose Internet Application template. Then select the Razor view engine and optionally the HTML5 semantic markup.&#160; We’re just going to roll this application as-is. You do not need to create the unit test project.</p>
<p><img style="display: inline; float: right" align="right" src="http://assets.integratedwebsystems.com/publish.png" /></p>
<p>Under the Solution Explorer, expand the References node. We need to enable Copy Local on a few necessary assemblies for this to work in Mono. Go to properties of the following assemblies and set their <strong>Copy Local</strong> option to <strong>True</strong>: System.Web.Helpers, System.Web.Mvc, System.Web.Routing, and System.Web.WebPages.</p>
<p>Now publish the project. Select the Build menu, then Publish AWSMonoSample.Web. Choose Publish Method: File System and select a local directory for copying the published files. I also typically select “Delete all existing files prior to publish” to ensure a clean publish directory.&#160; Then click Publish. (In my sample, I’m publishing to C:\temp\AWSMonoSample.Web).</p>
<p>To deploy an MVC 3 site, we’ll also need to collect a few more MVC 3 and Razor dependencies. Browse to: Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies directory and grab System.Web.WebPages.Deployment.dll, System.Web.WebPages.Razor.dll, and System.Web.Razor.dll. DO NOT grab any other assemblies. Place all these assemblies in your published folder’s bin directory.&#160; You should only have to do this once, but it’s always a caveat of deploying MVC 3 to Mono on a new server.</p>
<p>&#160;</p>
<h3>Deploy Published Files to Your Server</h3>
<p>Now we can upload the files.&#160; Since AWS by default is public key authenticated, we’re going to use the manual command-line method. Once you understand public key authentication a little better, tools like FileZilla or WinSCP will work a little easier (if you like the GUI interface thing).</p>
<p>So to start, open My Computer / Windows Explorer and browse to your published directory (C:\temp\AWSMonoSample.Web for this example). Then right click on that directory and select Git Bash Here from the context menu. You should now be looking at a local BASH command line with your working directory being the deployment folder we just setup.</p>
<p>For this deployment, we’re going to first package the files into a gzipped tarball, then we’re going to “scp” upload it to our server. From that point, we’ll ssh back into our server and extract the files in the web directory we setup earlier.</p>
<p>So enter:</p>
<pre class="brush: bash; gutter: false;">$ tar -zcvf aws.tar.gz *
$ scp aws.tar.gz ubuntu@your-aws-hostname: -i ~/.ssh/mykey.pem</pre>
<p>&#160;</p>
<p><em>NOTE: Replace the hostname with the one you have setup for your AWS EC2 instance. Also replace your keyfile path with the one you have setup locally for AWS. </em></p>
<p>You should see a successful transfer. Now you can connect to your server and extract the files in place. Open a new (or use an existing SSH connection if you still have one open). Start from your home directory with the command: “cd ~/”.</p>
<pre class="brush: bash; gutter: false;">ssh ubuntu@your-aws-hostname -i ~/.ssh/mykey.pem
mv aws.tar.gz /srv/www/default
rm index.html   #remove test from earlier
tar -zxvf aws.tar.gz
rm aws.tar.gz   #optional cleanup

sudo service apache2 restart      #for a fresh start</pre>
<p>&#160;</p>
<p>That’s it! Now make a request against your server, and you should see the new MVC 3 sample website displayed! Keep in mind the membership is not wired up and the registration form may blow up on you (as it also would in Windows); but otherwise, the basic MVC stuff works including model validation.</p>
<p>&#160;</p>
<h2>Useful Links</h2>
<ul>
<li><a href="http://aws.amazon.com">Amazon Web Services</a> </li>
<li><a href="http://mono-project.com">Mono Project</a> </li>
<li><a href="http://go-mono.com/config-mod-mono/">Mono Configuration Tool</a> </li>
<li><a href="http://code.google.com/p/msysgit/">MsysGit</a> </li>
<li><a href="http://www.hanselman.com/blog/BINDeployingASPNETMVC3WithRazorToAWindowsServerWithoutMVCInstalled.aspx">Hanselman’s BIN Deploy MVC3 post</a> </li>
<li><a href="http://badgerports.org/">Badgerports</a> </li>
<li><a href="http://ubuntu.com">Ubuntu</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.integratedwebsystems.com/2011/12/get-started-with-amazon-ec2-run-your-net-mvc3-razor-site-in-the-cloud-with-linux-mono-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MVC2 on Mono &#8211; Tips and Tricks for Windows Developers</title>
		<link>http://www.integratedwebsystems.com/2010/07/mvc2-on-mono-tips-and-tricks/</link>
		<comments>http://www.integratedwebsystems.com/2010/07/mvc2-on-mono-tips-and-tricks/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 17:00:00 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MVC2]]></category>

		<guid isPermaLink="false">http://www.integratedwebsystems.com/?p=886</guid>
		<description><![CDATA[So lately, I&#8217;ve been pretty wrapped up with kids and family so...]]></description>
			<content:encoded><![CDATA[<p>So lately, I&rsquo;ve been pretty wrapped up with kids and family so I haven&rsquo;t had much time to post anything new.&nbsp; However, I did start a new project, which I&rsquo;ll detail out more as I go. It&rsquo;s been quite the experience so far since I decided to build this one from the ground up using MySql and Linux/Mono.&nbsp; I&rsquo;ve never designed apps like that before. For one, I&rsquo;ve had to learn a new set of design tools for MySql as opposed to my comfortable Sql Management Studio. And I&rsquo;ve also had to very incrementally test different programming technologies and methods that were questionably supported in Linux/Mono.&nbsp; The beauty of this is that no matter what I do to make it work for Mono, the app will always work on Windows, and there&rsquo;s little development time lost if I have to fall back to its native platform.</p>
<p><span id="more-886"></span></p>
<p>So about this project&hellip;&nbsp; Well it&rsquo;s a simple project really: web based, MVC2 with a MySql database. So here&rsquo;s a few technical issues I ran into while building the beginnings of this application.</p>
<h3>Choosing a Data Framework</h3>
<p>I know some of you purists would say stick to vanilla ADO.NET; it works every time, and you have no conversion problems. Well, that&rsquo;s right, but I&rsquo;m a lazy typist, and I really dig LINQ. So I tested several LINQ data frameworks on mono and found that <a href="http://code.google.com/p/dblinq2007/">Dblinq</a>&nbsp;and <a href="http://www.subsonicproject.com/">SubSonic3</a>&nbsp;were the most functionally supported frameworks. I tested it with Linq to NHibernate, but it&nbsp;didn&#39;t work. SubSonic3, after a recent bug fix, now does work in Mono!&nbsp;</p>
<h3>MVC2 Works on Mono?</h3>
<p>Yeah it does! Well mostly and only if you pull from the trunk code or the daily tarballs. <strike>Unfortunately, it does not work with the latest public release 2.6.4 and definitely not 2.4.4 which is the latest deployed version on Ubuntu 10.04.</strike>&nbsp;MVC2 now is officially supported by the Mono 2.8 release. MVC1 does work out of the box on older versions of Mono (2.6). So what do you have to do to get it working? &nbsp;Until Mono 2.8 gets pushed into the packaging system, you&#39;ll need to learn a little bit about compiling Mono on your own and installing it, which sounds more painful that it really is. I wrote a script that works (most of the time) on Ubuntu.&nbsp; There&rsquo;s no guarantee that it will work for you of course. <img src='http://www.integratedwebsystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Checkout one of my recent posts about manually getting&nbsp;<a href="/2010/10/mono-2-8-install-script-for-ubuntu-fedora/">Mono 2.8 installed</a>.</p>
<p>Using MVC2 is the easy part. Just setup a new MVC2 project and ensure your reference options for the System.Web.Mvc and System.Web.Routing assemblies are set to Copy Local. Data annotations will not work, so you&rsquo;ll need to rip out the model validation in the default MVC2 project; otherwise, the rest of it works like a charm.</p>
<h3>xUnit and Dependency injection with Unity works too!</h3>
<p>Yup, believe it or not, some of the components in the Enterprise Library do work in Mono including <a href="http://unity.codeplex.com/">Unity</a>, which works great for swapping out mock classes in test projects. I chose to use <a href="http://xunit.codeplex.com/">xUnit</a> as my testing framework since it seemed to work pretty nicely in the <a href="http://www.subsonicproject.com">SubSonic project</a>. I also found a real nice <a href="http://xunit.codeplex.com/wikipage?title=Comparisons&amp;referringTitle=Home">breakdown</a> of how they compare to other testing frameworks. The xunit command line runs on vanilla Ubuntu 10.04 (mono 2.4.4). However, my preferred method of running some of these tests is using the <a href="http://www.testdriven.net/">TestDriven.net runner</a> on Windows/VS.</p>
<h3>System Agnostic Gotchas</h3>
<p>I&rsquo;ve built and tested most of it on Windows. Which sometimes creates problems when deploying to non-Windows servers. Especially when it comes to I/O pathing.&nbsp; As you go through and design it, you always have to build it in a platform agnostic manner. Duh right?&nbsp; This includes simple things like case senstive paths, using the correct directory separators, etc. Typically as lazy Windows programmers (not all of us) <img src='http://www.integratedwebsystems.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &nbsp; we would rather hard code the path separator like this.&nbsp;&nbsp; string.Format(@&ldquo;..\files\{0}&rdquo;, filename);&nbsp;&nbsp;&nbsp; But unfortunately that breaks Linux pathing. So by using Path.DirectorySeparator, it will automatically decide which is the correct character to use on either platform.<br />
	<em>string.Format(&ldquo;..{0}files{0}{1}&rdquo;, Path.DirectorySeparator, filename);</em></p>
<p>The later versions of windows also support both slashes, so you could get away with using forward slashes in windows I/O on Vista and 7.</p>
<p>It can be advantageous (if working with a web application) to use <em>System.Web.HttpContext.Current.Server.MapPath</em> or <em>System.Web.Hosting.HostingEnvironment.MapPath</em> to get your native local path from a virtual one. So store your paths as virtual ones and let the framework convert it to a native/local one.</p>
<h3>Image Rendering</h3>
<p>Well, I haven&rsquo;t completely dug into this, but I have briefly tested simple things like resizing images and writing them back out with Jpeg encoding. I have to say that the Mono built-in implementation of the GDI works just fine.&nbsp; I even tested some other things like rendering speed as far as resizing a jpeg and writing it out. It seems using the System.Drawing as opposed to Mono&rsquo;s GDK/Cairo actually works faster (only by observation; nothing official). I&rsquo;ll have more detailed results on this as I get to that piece.</p>
<h3>Wrap-Up</h3>
<p>So if you&rsquo;re interested in starting a new Mono project, I hope some of these tips will keep you out of trouble. Good Luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.integratedwebsystems.com/2010/07/mvc2-on-mono-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Installing OpenSuse 11.2 with Mono 2.6.1 and Apache Using Text Mode Configuration &#8211; Porting to Mono Part 1 of 3</title>
		<link>http://www.integratedwebsystems.com/2010/01/installing-opensuse-11-2-with-mono-2-6-1-and-apache-using-text-mode-configuration-porting-to-mono-part-1-of-3/</link>
		<comments>http://www.integratedwebsystems.com/2010/01/installing-opensuse-11-2-with-mono-2-6-1-and-apache-using-text-mode-configuration-porting-to-mono-part-1-of-3/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 13:30:00 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Mono]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[installing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mod_mono]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[openSuse]]></category>

		<guid isPermaLink="false">http://www.integratedwebsystems.com/?p=441</guid>
		<description><![CDATA[I’ve always kept an eye on the Mono project, mostly out of...]]></description>
			<content:encoded><![CDATA[<p>I’ve always kept an eye on the Mono project, mostly out of curiosity and intrigue. The last time I played around with Mono it was at version 2.0, and at the time I didn’t really spend a lot of time on it because it didn’t support some of the things I was using.&#160; Well recently, I regained interest in Mono when I saw it now supports MVC and some of Dblinq. And since I’ve been buzzing on the whole MVC thing for awhile, I decided to check Mono out for myself and start a fun little porting project. So this is the first part of a three part series describing everything I did to get a server up and running and one of my Asp.Net MVC applications ported to Mono.</p>
<p>This first part will cover installing and configuring an OpenSuse 11.2 server with Apache/Mono and SSH. <a href="http://www.integratedwebsystems.com/2010/02/how-to-setup-and-configure-mysql-membership-provider-6-2-2-porting-to-mono-part-2-of-3/">The second part</a> will talk about how to setup a MySql Membership provider (with mono and Windows), and the third part is a walkthrough showing how to port a simple Asp.Net MVC site to mono and MySql. I’m also targeting those of you who use virtual hosting where you might only have SSH (after install) to configure your server, so I will be using text based tools: SSH, vi, and yast for all my installations and configuration after getting the base system installed.</p>
<p> <span id="more-441"></span>
<p><script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">
		google.load("jquery", "1.4.1");
		google.load("jqueryui", "1.7.2");
	</script><script type="text/javascript" src="/js/jquery.lightbox-0.5.pack.js"></script>
<link rel="stylesheet" type="text/css" href="/css/jquery.lightbox-0.5.css" media="screen" /><script type="text/javascript" src="/tools/js/p441.js"></script></p>
<p sizcache="0" sizset="0">First off, let me just say that I’m a Windows .NET programmer; not a Linux programmer. I know enough about Linux to dig my way around most of the basic stuff, so if anything seems incorrect in this post, feel free to correct me. <img src='http://www.integratedwebsystems.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &#160; I’m extremely intrigued by Linux and its open source philosophy. I use it for a handful of useful, rock solid services like <a href="http://subversion.tigris.org/" target="_blank">Subversion</a>, <a href="http://www.postfix.org/" target="_blank">Postfix</a>, <a href="http://www.samba.org/" target="_blank">Samba</a> file servers and <a href="http://www.mysql.com/" target="_blank">MySql</a>. I also share an interest with many small web shops in finding more affordable hosting solutions for smaller Asp.Net apps. And in light of Mono being able to run MVC apps, it’s very exciting to think of what we can do with it.</p>
<h3>Index</h3>
<ul sizcache="0" sizset="4">
<li sizcache="0" sizset="4"><a href="#BeforeYouBegin">Before You Begin</a>&#160; </li>
<li sizcache="0" sizset="5"><a href="#InstallingLinuxPart1">Installing Linux Graphical (part 1)</a> </li>
<li sizcache="0" sizset="6"><a href="#InstallingLinuxPart2">Configuring Linux During Install (part 2)</a> </li>
<li sizcache="0" sizset="7"><a href="#ConfiguringLinuxAfterInstall">Configuring Linux After Install</a> </li>
<li sizcache="0" sizset="8"><a href="#UpdatingSoftware">Updating Software</a> </li>
<li sizcache="0" sizset="9"><a href="#InstallMonoAndApache">Install Mono, Apache, and MySql</a> </li>
<li sizcache="0" sizset="10"><a href="#ConfigureApache">Configure a Virtual Host &amp; Web Directory</a> </li>
<li sizcache="0" sizset="11"><a href="#RunningMVC">Running the Default Visual Studio MVC Website</a> </li>
<li sizcache="0" sizset="12"><a href="#UsefulLinks">Useful Links</a> </li>
</ul>
<p sizcache="0" sizset="11">&#160;</p>
<h3 sizcache="0" sizset="13"><a name="BeforeYouBegin">Before you Begin</a></h3>
<p sizcache="0" sizset="14">There are a few things you need to download before you get started.&#160; First of all, you’ll need an SSH client for file transfer and console access. I’m using <a href="http://filezilla-project.org/download.php" target="_blank">FileZilla</a> and <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">Putty</a> as my SSH clients. If you’ve never used it before, think of SSH like telnet and FTP wrapped into one.</p>
<p>Here’s a few tips on navigating the text mode installer screens. Use the Tab Key to cycle through fields or change focus between sections on the screen. Use the Spacebar or Enter to select an option. Esc can back out of a dropdown option. You can use the arrow keys to cycle options in a section.</p>
<p sizcache="0" sizset="16">Download one of the <a href="http://software.opensuse.org/112/en" target="_blank">installers on OpenSuse’s website.</a> Burn or mount the ISO and boot your machine from it to begin.</p>
<p><em>Note: while I was doing this on a test virtual machine, I could only get the Network install to work with Virtual PC 2007 on my hardware. All the versions worked fine when installing it to a physical machine. If you choose the network install, you may need to configure your DHCP settings before the GUI installer starts. (with Virtual PC, make sure the correct external network card is exposed to the virtual machine). </em></p>
<h3 sizcache="0" sizset="17"><a name="InstallingLinuxPart1">Installing Linux Graphical (part 1)</a></h3>
<p>In sequence, here are (most) of the screens you’ll see during the first part of installing OpenSuse 11.2.</p>
<div class="gallery" sizcache="0" sizset="18">
<table border="0" cellpadding="5" sizcache="0" sizset="18">
<tbody sizcache="0" sizset="18">
<tr sizcache="0" sizset="18">
<td width="269" sizcache="0" sizset="18"><a title="OpenSuse 11.2 boot screen" href="/resources/p441/install/1.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="OpenSuse Boot Screen" border="0" alt="OpenSuse Boot Screen" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/1.jpg" width="244" height="184" /></a></td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="19">
<td width="269" sizcache="0" sizset="19"><a title="Language selection" href="/resources/p441/install/2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Language selection" border="0" alt="Language selection" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/22.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Language selection</p>
</td>
</tr>
<tr sizcache="0" sizset="20">
<td width="269" sizcache="0" sizset="20"><a title="New install. Disable Auto-configuration" href="/resources/p441/install/3.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="New install. Disable auto-configuration." border="0" alt="New install. Disable auto-configuration." src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/3.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Uncheck<strong> </strong><em>Use Automatic Configuration</em></p>
</td>
</tr>
<tr sizcache="0" sizset="21">
<td width="269" sizcache="0" sizset="21"><a title="Choose your time zone" href="/resources/p441/install/4.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Choose your time zone" border="0" alt="Choose your time zone" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/41.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Choose your time zone.</p>
</td>
</tr>
<tr sizcache="0" sizset="22">
<td width="269" sizcache="0" sizset="22"><a title="Desktop selection. See options." href="/resources/p441/install/5.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Desktop selection" border="0" alt="Desktop selection" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/51.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>I chose minimal server.</p>
<p><strong>Optional:</strong> You may choose a desktop if you wish to use remote VNC to remotely admin your server with a GUI.&#160; VNC is kind of like using Remote Desktop. To do that, choose your desktop here, and we’ll configure it to still boot to text mode later at the summary screen.</p>
</td>
</tr>
<tr sizcache="0" sizset="23">
<td width="269" sizcache="0" sizset="23"><a title="Partition selection. I used defaults." href="/resources/p441/install/6.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Partition selection" border="0" alt="Partition selection" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/61.jpg" width="244" height="199" /></a></td>
<td width="375">Partition selection. I used defaults.</td>
</tr>
<tr sizcache="0" sizset="24">
<td width="269" sizcache="0" sizset="24"><a title="Setting up the first user. Uncheck Automatic Login." href="/resources/p441/install/7.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Setting up the first user" border="0" alt="Setting up the first user" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/71.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Enter your username. Uncheck automatic login.</p>
<p><strong>Optional:</strong> You may choose a different password for the root user.&#160; This is good if you have a public server sitting in the cloud in case someone gets the password to your normal user account.</p>
</td>
</tr>
<tr sizcache="0" sizset="25">
<td width="269" sizcache="0" sizset="25"><a title="Summary. Enable SSH." href="/resources/p441/install/8.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Summary" border="0" alt="Summary" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/81.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Summary screen. Scroll to the bottom.<strong> Click “enable and open” for Firewall and SSH</strong>. We’ll use SSH to remotely admin the server.</p>
<p><strong>Optional: </strong>If you chose a desktop earlier, change the <em>Default Runlevel </em>to 3 (Full multiuser with network). This will cause the server to boot to normal text mode by default.</p>
</td>
</tr>
<tr sizcache="0" sizset="26">
<td width="269" sizcache="0" sizset="26"><a title="Confirm Installation" href="/resources/p441/install/9.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Confirm Installation" border="0" alt="Confirm Installation" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/91.jpg" width="244" height="199" /></a></td>
<td width="375">
<p>Click Install to continue.</p>
</td>
</tr>
<tr sizcache="0" sizset="27">
<td width="269" sizcache="0" sizset="27"><a title="Progress" href="/resources/p441/install/12.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Installation Progress" border="0" alt="Installation Progress" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/121.jpg" width="244" height="199" /></a></td>
<td width="375">&#160;</td>
</tr>
</tbody>
</table></div>
<h3 sizcache="0" sizset="28"><a name="InstallingLinuxPart2">Configuring Linux During Install (part 2)</a></h3>
<p>After the first phase, your computer will reboot and begin the manual configuration phase. As I mentioned earlier, these screens are pretty easy to navigate. Use tab to cycle through the fields or change focus to different sections. Use space or enter to make a selection. Also, the highlighted letters in words are hotkeys you can use in combination with the Alt key.&#160; Each section will continue when you select the NEXT option in the bottom right corner.</p>
<div class="gallery" sizcache="0" sizset="29">
<table border="0" cellpadding="5" sizcache="0" sizset="29">
<tbody sizcache="0" sizset="29">
<tr sizcache="0" sizset="29">
<td valign="top" width="269" sizcache="0" sizset="29"><a title="First configuration screen. Enter your hostname" href="/resources/p441/config/1.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="First configuration screen. Enter your hostname" border="0" alt="First configuration screen. Enter your hostname" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/11.jpg" width="244" height="184" /></a> </td>
<td width="375">
<p>This is the first configuration screen. Enter your new machine hostname (or leave it default).</p>
</td>
</tr>
<tr sizcache="0" sizset="30">
<td valign="top" width="269" sizcache="0" sizset="30"><a title="Progress after choosing hostname." href="/resources/p441/config/2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Progress screen" border="0" alt="Progress screen" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/21.jpg" width="244" height="184" /></a> </td>
<td width="375">
<p>Showing hostname configuration progress.</p>
</td>
</tr>
<tr sizcache="0" sizset="31">
<td valign="top" width="269" sizcache="0" sizset="31"><a title="Configuration screen. Choose Network Interfaces" href="/resources/p441/config/3.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Main configuration screen. Choose netowrk interface" border="0" alt="Main configuration screen. Choose netowrk interface" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/31.jpg" width="244" height="183" /></a> </td>
<td width="375">
<p>This is the main configuration screen. You will set your network configuration here. Tab until you see the bounding box around the gray area light up. Then down arrow to Network Interfaces. Press enter to select it.</p>
</td>
</tr>
<tr sizcache="0" sizset="32">
<td valign="top" width="269" sizcache="0" sizset="32"><a title="Network Interface screen." href="/resources/p441/config/4.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Network interfaces screen" border="0" alt="Network interfaces screen" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/4.jpg" width="244" height="183" /></a> </td>
<td width="375">
<p><strong>Overview Screen</strong></p>
<p>This is the first Network Interfaces screen. There are three focus areas. The first is the top tab area: Overview, Hostname/DNS, and Routing.</p>
<p>Tab to the interface list and select your interface card for your main Internet connection. Then press Alt-i to view its details</p>
</td>
</tr>
<tr sizcache="0" sizset="33">
<td valign="top" width="269" sizcache="0" sizset="33"><a title="Shows ethernet settings. Leave as DHCP or set to static." href="/resources/p441/config/5.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Ethernet NIC settings" border="0" alt="Ethernet NIC settings" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/5.jpg" width="244" height="184" /></a> </td>
<td width="375">
<p>Shows Ethernet details. If you choose to use static IP, this is where to set that information. Set the IP address, subnet, etc. You may leave this as DHCP if you wish.&#160; When you’re done tab and select Next.</p>
</td>
</tr>
<tr sizcache="0" sizset="34">
<td valign="top" width="269" sizcache="0" sizset="34"><a title="Set hostname/DNS" href="/resources/p441/config/7.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Set hostname and DNS" border="0" alt="Set hostname and DNS" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/7.jpg" width="244" height="184" /></a> </td>
<td width="375">
<p>From the Overview screen (bolded above), move to the Hostname/DNS section. Set your hostname and your DNS servers (if you chose static IP in the previous step).</p>
</td>
</tr>
<tr sizcache="0" sizset="35">
<td valign="top" width="269" sizcache="0" sizset="35"><a title="Routing configuration" href="/resources/p441/config/8.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Routing configuration" border="0" alt="Routing configuration" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/8.jpg" width="244" height="183" /></a> </td>
<td width="375">
<p>If you chose a static IP, tab from the Overview Screen to Routing. Set your default gateway and associate it with the correct device.</p>
</td>
</tr>
<tr sizcache="0" sizset="36">
<td valign="top" width="269" sizcache="0" sizset="36"><a title="Writing network configuration." href="/resources/p441/config/9.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Writing network configuration" border="0" alt="Writing network configuration" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/9.jpg" width="244" height="183" /></a> </td>
<td width="375">After clicking Next from the Overview Screen, the configuration changes will be written to disk. </td>
</tr>
<tr sizcache="0" sizset="37">
<td valign="top" width="269" sizcache="0" sizset="37"><a title="Test Internet Connection" href="/resources/p441/config/10.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Test Internet" border="0" alt="Test Internet" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/10.jpg" width="244" height="185" /></a> </td>
<td width="375">This step will test your Internet connection. If successful, it will check for updates. </td>
</tr>
<tr sizcache="0" sizset="38">
<td valign="top" width="269" sizcache="0" sizset="38"><a title="Successful connection" href="/resources/p441/config/11.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Successful connection" border="0" alt="Successful connection" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/111.jpg" width="244" height="184" /></a> </td>
<td width="375">Successful connection</td>
</tr>
<tr sizcache="0" sizset="39">
<td valign="top" width="269" sizcache="0" sizset="39"><a title="Updating packages" href="/resources/p441/config/12.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Updating packages" border="0" alt="Updating packages" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/12.jpg" width="244" height="184" /></a> </td>
<td width="375">Updating packages</td>
</tr>
<tr sizcache="0" sizset="40">
<td valign="top" width="269" sizcache="0" sizset="40"><a title="Updating packages" href="/resources/p441/config/13.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Updating packages" border="0" alt="Updating packages" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/13.jpg" width="244" height="183" /></a> </td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="41">
<td valign="top" width="269" sizcache="0" sizset="41"><a title="Run updates" href="/resources/p441/config/14.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Run updates" border="0" alt="Run updates" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/14.jpg" width="244" height="184" /></a> </td>
<td width="375">Run updates</td>
</tr>
<tr sizcache="0" sizset="42">
<td valign="top" width="269" sizcache="0" sizset="42"><a title="Package updates" href="/resources/p441/config/15.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Package updates" border="0" alt="Package updates" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/15.jpg" width="244" height="184" /></a> </td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="43">
<td valign="top" width="269" sizcache="0" sizset="43"><a title="Downloading updates" href="/resources/p441/config/16.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Downloading updates" border="0" alt="Downloading updates" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/16.jpg" width="244" height="183" /></a> </td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="44">
<td valign="top" width="269" sizcache="0" sizset="44"><a title="Installing updates" href="/resources/p441/config/17.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Installing updates" border="0" alt="Installing updates" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/17.jpg" width="244" height="184" /></a> </td>
<td width="375">Will reboot after this step. You may need to click Next after it finishes.</td>
</tr>
<tr sizcache="0" sizset="45">
<td valign="top" width="269" sizcache="0" sizset="45"><a title="After reboot, next config screen." href="/resources/p441/config/18.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="After reboot, next config screen." border="0" alt="After reboot, next config screen." src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/18.jpg" width="244" height="183" /></a> </td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="46">
<td valign="top" width="269" sizcache="0" sizset="46"><a href="/resources/p441/config/19.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="" border="0" alt="" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/19.jpg" width="244" height="184" /></a> </td>
<td width="375">&#160;</td>
</tr>
<tr sizcache="0" sizset="47">
<td valign="top" width="269" sizcache="0" sizset="47"><a title="Printer setup" href="/resources/p441/config/20.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Printer setup" border="0" alt="Printer setup" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/20.jpg" width="244" height="183" /></a> </td>
<td width="375">I used defaults here. </td>
</tr>
<tr sizcache="0" sizset="48">
<td valign="top" width="269" sizcache="0" sizset="48"><a title="Finally!" href="/resources/p441/config/21.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Finally!" border="0" alt="Finally!" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/211.jpg" width="244" height="184" /></a> </td>
<td width="375">Finally done! </td>
</tr>
<tr sizcache="0" sizset="49">
<td valign="top" width="269" sizcache="0" sizset="49"><a title="Console after installation" href="/resources/p441/config/22.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Console after installation" border="0" alt="Console after installation" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/221.jpg" width="244" height="183" /></a> </td>
<td width="375">The installation drops you to a console.&#160; </td>
</tr>
</tbody>
</table></div>
<p>&#160;</p>
<h3 sizcache="0" sizset="50"><a name="ConfiguringLinuxAfterInstall">Configuring Linux After Install</a></h3>
<div class="gallery" sizcache="0" sizset="51">
<p sizcache="0" sizset="51"><a title="Putty, open a connection to your new server." href="/resources/p441/post_install/1.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Putty, open connection" border="0" alt="Putty, open connection" align="right" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/113.jpg" width="244" height="234" /></a> At this point, your operating system is installed and accessible online via SSH. (If you purchased a VM, this is where you’ll usually begin). To connect to your new server, open Putty and enter your static IP or hostname for your new server. Select SSH connection type. Then click Open. You will be prompted to trust the certificate. Click YES, and login to your new server using the account you setup during install.</p>
<p sizcache="0" sizset="47"><em>NOTE: (You may optionally save these connection settings by typing a name and clicking Save. </em></p>
</p></div>
<p><strong>Root Access      <br /></strong>You’ll need root access to perform most of the tasks we’re doing, so enter: <strong>su</strong><em>, </em>then type the root password you configured during install. The command prompt will change color to <strong><font color="#ff0000">red</font></strong>.</p>
<h3 sizcache="0" sizset="52"><a name="UpdatingSoftware">Updating Software</a></h3>
<p>One of the really cool things about most Linux distributions is their package management. It’s a one-stop-shop for installing, updating, and removing software on your system. Fedora has <em>yum</em>, Debian has <em>apt-get</em>, OpenSuse has<em> </em><em>zypper</em>. Using these utilities is very straight forward. So if you didn’t update your system during install, you can do it now by entering:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">zypper update</pre>
<p>You can run this command occasionally to update your system. To see more details about how to use it. Enter: man zypper</p>
<p>&#160;</p>
<h3 sizcache="0" sizset="53"><a name="InstallMonoAndApache">Install Mono, Apache, and MySql</a></h3>
<p sizcache="0" sizset="49"><strong>Installing Mono and Apache</strong></p>
<p sizcache="0" sizset="49">With zypper, we can cheat a little to install mono, apache, and all dependencies. First we need to add the mono repositories so zypper knows how to find it.</p>
<p sizcache="0" sizset="49">Enter the following lines separately:</p>
<pre class="brush: bash; gutter: false;">zypper addrepo http://ftp.novell.com/pub/mono/download-stable/openSUSE_11.2 mono-stable
zypper refresh --repo mono-stable
zypper dist-upgrade --repo mono-stable</pre>
<p sizcache="0" sizset="49">Our cheat is going to be installing Mod_Mono, which is the mono plugin for Apache. This will force it to install apache, mono, xsp and everything we need to get started.</p>
<pre class="brush: bash; gutter: false; toolbar: false;">zypper install mod_mono</pre>
<p><strong>Autostart Apache</strong></p>
<p>To make apache start when the system reboots, enter this command:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">chkconfig --add apache2</pre>
<p><strong>Installing MySql Server</strong></p>
<p>To download and install mysql server and client, enter this command:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">zypper install mysql</pre>
<p>Add MySql to your startup and start it:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">chkconfig --add mysql

service mysql start</pre>
<p>Then configure the server with:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">mysql_secure_installation</pre>
<p>Follow the instructions and setup your server. The first question will be to enter your root password; the first time you run this, just press enter with a blank password, then choose <strong>Y</strong> to enter a new root password. You’ll also want to disable remote root access, the anonymous user, and test database.</p>
<p><strong>Optional:</strong></p>
<p>Now setup your user account so you can remotely access the server. This also requires you to expose your MySql server over the Internet if you’re running a hosted server. Users in MySql are username &amp; host based. Both parts make up a unique user.</p>
<p><strong>To add a user:</strong></p>
<p>Connect to your database server using your new root password. Enter: <strong>mysql -p</strong></p>
<p>Here is an example of a user you would typically use for a specific application running on the local machine. This statement grants all privileges on a database called test_database and all its tables to a username ‘my_new_username’ who can only connect from localhost.</p>
<pre class="brush: sql; gutter: false;">grant all privileges on test_database.* to 'my_new_username'@'localhost' identified by 'new_password' with grant option;</pre>
<p>An admin user with access to everything from any location would have a statement similar to this:</p>
<pre class="brush: sql; gutter: false;">grant all privileges on *.* to 'super_user'@'%' identified by 'super_secret_pw' with grant option;</pre>
<p>Enter <strong>quit</strong> to exit the MySql client.</p>
<p><strong>Firewall </strong></p>
<p>This is actually much simpler than it looks. I’m showing all these screens just for reference. Basically, just use yast as the tool configure the firewall. It has a nice little interface similar to the post-install configuration. For what we’re doing, add your network device to the External Zone, then add Secure Shell Server and HTTP Web Server to the allowed services. Then just enable and turn on your firewall (if it isn’t already on)</p>
<div class="gallery" sizcache="0" sizset="54">
<table border="0" cellpadding="5" sizcache="0" sizset="54">
<tbody sizcache="0" sizset="54">
<tr sizcache="0" sizset="54">
<td valign="top" width="269" sizcache="0" sizset="54"><a title="Start yast." href="/resources/p441/post_install/6.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Start Yast" border="0" alt="Start Yast" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/6.jpg" width="244" height="154" /></a> </td>
<td width="375">Enter: <strong>yast</strong></td>
</tr>
<tr sizcache="0" sizset="55">
<td valign="top" width="269" sizcache="0" sizset="55"><a title="Go to interface configuration" href="/resources/p441/post_install/7.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Interface configuration" border="0" alt="Interface configuration" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/72.jpg" width="244" height="154" /></a> </td>
<td width="375">Navigate to Interfaces, set your network device to be in the External Zone. </td>
</tr>
<tr sizcache="0" sizset="56">
<td valign="top" width="269" sizcache="0" sizset="56"><a title="Add allowed sevices" href="/resources/p441/post_install/8.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Allowed Services" border="0" alt="Allowed Services" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/82.jpg" width="244" height="155" /></a> </td>
<td width="375">Navigate to Allowed Services, select External Zone, then select Secure Shell Server. </td>
</tr>
<tr sizcache="0" sizset="57">
<td valign="top" width="269" sizcache="0" sizset="57"><a title="Add each service individually" href="/resources/p441/post_install/9.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Add each service individually" border="0" alt="Add each service individually" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/92.jpg" width="244" height="155" /></a> </td>
<td width="375">
<p>Use the Add link to add the selected service to the list.</p>
<p><strong>Repeat this for HTTP server</strong>.</p>
<p><strong>Optional:</strong> Add MySql server if you want to expose it to the Internet and access it remotely with your tools.</p>
</td>
</tr>
<tr sizcache="0" sizset="58">
<td valign="top" width="269" sizcache="0" sizset="58"><a title="Enable and start the firewall" href="/resources/p441/post_install/10.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Enable and start the firewall" border="0" alt="Enable and start the firewall" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/101.jpg" width="244" height="155" /></a> </td>
<td width="375">Enable and Start your firewall from the Start Up screen. </td>
</tr>
<tr sizcache="0" sizset="59">
<td valign="top" width="269" sizcache="0" sizset="59"><a title="Finish" href="/resources/p441/post_install/11.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Finish" border="0" alt="Finish" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/114.jpg" width="244" height="155" /></a> </td>
<td width="375">Finish</td>
</tr>
</tbody>
</table>
</div>
<p><strong></strong></p>
<p>&#160;</p>
<h3 sizcache="0" sizset="60"><a name="ConfigureApache">Configure a Virtual Host &amp; Web Directory</a></h3>
<p sizcache="0" sizset="61">I used the <a href="http://go-mono.com/config-mod-mono/" target="_blank">Mod_Mono configuration tool</a> on the Mono website, which built the following configuration file. It looks big, but most of it’s comments. The key notes here are that it runs .Net 2.0, it’s root directory and that it handles all requests through Mono (good for MVC). It also does some nice things like compress the output on certain files as well as the Mono output.</p>
<div class="gallery" sizcache="0" sizset="62">
<p sizcache="0" sizset="62"><a title="Using the Mod_Mono configuration tool." href="/resources/p441/post_install/14.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Using the Mod_Mono configuration tool" border="0" alt="Using the Mod_Mono configuration tool" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/141.jpg" width="216" height="244" /></a></p>
</div>
<p sizcache="0" sizset="61">&#160;</p>
<pre class="brush: xml; gutter: false; toolbar: false;">&lt;VirtualHost *:80&gt;
  ServerName odin.integratedwebsystems.int
  ServerAdmin web-admin@odin.integratedwebsystems.int
  DocumentRoot /srv/www/odin.integratedwebsystems.int
  # MonoServerPath can be changed to specify which version of ASP.NET is hosted
  # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
  # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
  # MonoServerPath odin.integratedwebsystems.int &quot;/opt/novell/mono/bin/mod-mono-server2&quot;
  # For Mono on openSUSE, uncomment the line below instead:
  MonoServerPath odin.integratedwebsystems.int &quot;/usr/bin/mod-mono-server2&quot;

  # To obtain line numbers in stack traces you need to do two things:
  # 1) Enable Debug code generation in your page by using the Debug=&quot;true&quot;
  #    page directive, or by setting &lt;compilation debug=&quot;true&quot; /&gt; in the
  #    application's Web.config
  # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
  MonoDebug odin.integratedwebsystems.int true

  # The MONO_IOMAP environment variable can be configured to provide platform abstraction
  # for file access in Linux.  Valid values for MONO_IOMAP are:
  #    case
  #    drive
  #    all
  # Uncomment the line below to alter file access behavior for the configured application
  MonoSetEnv odin.integratedwebsystems.int MONO_IOMAP=all
  #
  # Additional environtment variables can be set for this server instance using
  # the MonoSetEnv directive.  MonoSetEnv takes a string of 'name=value' pairs
  # separated by semicolons.  For instance, to enable platform abstraction *and*
  # use Mono's old regular expression interpreter (which is slower, but has a
  # shorter setup time), uncomment the line below instead:
  # MonoSetEnv odin.integratedwebsystems.int MONO_IOMAP=all;MONO_OLD_RX=1

  MonoApplications odin.integratedwebsystems.int &quot;/:/srv/www/odin.integratedwebsystems.int&quot;
  &lt;Location &quot;/&quot;&gt;
    Allow from all
    Order allow,deny
    MonoSetServerAlias odin.integratedwebsystems.int
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI &quot;\.(?:gif|jpe?g|png)$&quot; no-gzip dont-vary
  &lt;/Location&gt;
  &lt;IfModule mod_deflate.c&gt;
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
  &lt;/IfModule&gt;
&lt;/VirtualHost&gt;</pre>
<p sizcache="0" sizset="63">Edit the information above (or use the <a href="http://go-mono.com/config-mod-mono/" target="_blank">configuration tool</a>) and replace my hostname with yours. Then save this file with the extension “.conf” and copy it to your /etc/apache2/conf.d directory using <a href="http://filezilla-project.org" target="_blank">FileZilla</a> SFTP connection as the root user.</p>
<p>Create a new directory at the location you specified in the DocumentRoot command. This is the root folder you’ll use to deploy your website.</p>
<pre class="brush: bash; gutter: false; toolbar: false;">cd /srv/www

mkdir my_web_hostname</pre>
<p>After setting all this up, you’ll need to restart your Apache server. To do that, just enter:</p>
<pre class="brush: bash; gutter: false; toolbar: false;">service apache2 restart</pre>
<p>You can restart any of your services this way. You might also reboot your server just to get a fresh run after installing and configuring all our software. Use the shutdown command to restart your system. Again, you can use <em>shutdown &#8211;help</em> or <em>man shutdown</em> to learn more about that command.</p>
<pre class="brush: bash; gutter: false; toolbar: false;">shutdown -r now</pre>
<h3 sizcache="0" sizset="65"><a name="RunningMVC">Running the Default Visual Studio MVC Website</a></h3>
<div class="gallery" sizcache="0" sizset="66">
<p sizcache="0" sizset="66"><a title="Running default MVC website on Apache/Mono 2.6.1" href="/resources/p441/post_install/13.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="It works! " border="0" alt="It works! " align="right" src="http://www.integratedwebsystems.com/wp-content/uploads/2010/01/131.jpg" width="244" height="120" /></a> Open Visual Studio 2008 and build a brand new ASP.NET MVC Web Application.&#160; Publish it to a folder and copy all the published contents to your Linux server at <em>/srv/www/my_web_hostname</em> using FileZilla. Using a web browser, browse to your server and it should show that the new web application works right out the box (with the exception of Membership).</p>
</div>
<p sizcache="0" sizset="67">This is cool! It’s a great start knowing that routing, controllers and views all work. Feel free to play with it a bit more. Mono has some great tools like <a href="http://www.mono-project.com/MoMA" target="_blank">MoMa</a> that will tell you if your existing assemblies are compatible with Mono. You can also start toying around with Dblinq and alternative membership providers.</p>
<p>&#160;</p>
<p sizcache="0" sizset="68">There’s more to come. The <a href="http://www.integratedwebsystems.com/2010/02/how-to-setup-and-configure-mysql-membership-provider-6-2-2-porting-to-mono-part-2-of-3/">next post</a> will show you how to use the <a href="http://dev.mysql.com/downloads/connector/net/#downloads" target="_blank">MySql Membership</a> provider with both Windows and Mono.</p>
<p>&#160;</p>
<h3 sizcache="0" sizset="69"><a name="UsefulLinks">Useful Links</a></h3>
<ul sizcache="0" sizset="70">
<li sizcache="0" sizset="70">Mono Website – <a title="http://www.mono-project.com" href="http://www.mono-project.com">http://www.mono-project.com</a>&#160; </li>
<li sizcache="0" sizset="71">Mod_Mono Configuration Tool &#8211; <a href="http://go-mono.com/config-mod-mono/">http://go-mono.com/config-mod-mono/</a> </li>
<li sizcache="0" sizset="72">MoMa&#160; Mono Compatibility Checker &#8211; <a title="http://www.mono-project.com/MoMA" href="http://www.mono-project.com/MoMA">http://www.mono-project.com/MoMA</a> </li>
<li sizcache="0" sizset="73">OpenSuse 11.2 Download Page (scroll down) &#8211; <a href="http://software.opensuse.org/112/en">http://software.opensuse.org/112/en</a> </li>
<li sizcache="0" sizset="74">OpenSuse Documentation (loaded with great how to documents) &#8211; <a href="http://en.opensuse.org/Documentation">http://en.opensuse.org/Documentation</a> </li>
<li sizcache="0" sizset="75">Putty Download Page &#8211; <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</a> </li>
<li sizcache="0" sizset="76">FileZilla Download Page &#8211; <a href="http://filezilla-project.org/download.php">http://filezilla-project.org/download.php</a> </li>
<li sizcache="0" sizset="77">MySql Connector .NET Download &#8211; <a title="http://dev.mysql.com/downloads/connector/net/#downloads" href="http://dev.mysql.com/downloads/connector/net/#downloads">http://dev.mysql.com/downloads/connector/net/#downloads</a> </li>
<li sizcache="0" sizset="78">MySql Workbench (MySql Administration and Development tools) &#8211; <a title="http://dev.mysql.com/downloads/workbench/5.2.html" href="http://dev.mysql.com/downloads/workbench/5.2.html">http://dev.mysql.com/downloads/workbench/5.2.html</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.integratedwebsystems.com/2010/01/installing-opensuse-11-2-with-mono-2-6-1-and-apache-using-text-mode-configuration-porting-to-mono-part-1-of-3/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

