To Our Sponsors - Nathan Bridgewater

secrettownpanamanianMobile - Wireless

Dec 10, 2013 (3 years and 7 months ago)

48 views

Thanks
To Our Sponsors
Thursday, April 26, 12
HOSTING ASP.NET MVC3
ON LINUX / MONO
an Introduction
Thursday, April 26, 12
NATHAN BRIDGEWATER
nbridgewater
Thursday, April 26, 12
BLOG

.NET Tutorials & Code Samples

Installation scripts for the latest 2.11 Mono

Miscellaneous .NET nuggets

Source hosted on GitHub:

bit.ly/iwebsysgit
bit.ly/iwebsys
Thursday, April 26, 12
AGENDA

What is Mono?

Connect to Linux

Install Mono  2.10.2

Configure Apache

Deploy MVC 3 Website
GOAL: Host an ASP.NET MVC3 website on Linux
Thursday, April 26, 12
“An open source, cross-platform,
implementation of C and the CLR that is
binary compatible with Microsoft.NET”
Thursday, April 26, 12

Multi-platform

Licensing Costs

Packaged Appliances

Linux Ecosystem of Libraries
WHY?
Thursday, April 26, 12
HOSTING LINUX
Pick a flavor
Thursday, April 26, 12
12.04 LTS Precise Pangolin
Thursday, April 26, 12
BEFORE WE START

Configure Networking

User Accounts

OpenSSH-Server
Baseline Server
Thursday, April 26, 12
TOOLS
Grab an SSH client for Windows

Putty

MsysGit

FileZilla
Thursday, April 26, 12
DEMO
Connect to a Linux host from Windows
Thursday, April 26, 12
PACKAGE MANAGERS

Dependency resolution

Easy to maintain

All major distros use a flavor
yum, apt-get, zypper, etc
Thursday, April 26, 12
UPDATE UBUNTU

Update local package cache
sudo
 apt-­‐get  update

Upgrade packages
sudo
 apt-­‐get  dist-­‐upgrade
Thursday, April 26, 12
INSTALL MONO

Use the system default package

Use a backport - unofficial build

Compile & install from source
Thursday, April 26, 12
sudo
 apt-­‐get  
install
 
   mono-­‐apache-­‐server4  
   mono-­‐devel  
   libapache2-­‐mod-­‐mono
   apache2
MONO PACKAGES
Install Mono
Thursday, April 26, 12
VERSION CHECK
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and
Contributors.
www.mono-project.com
!TLS: __thread
!SIGSEGV: altstack
!Notifications: epoll
!Architecture: amd64
!Disabled: none
!Misc: softdebug
!LLVM: supported, not enabled.
!GC: Included Boehm (with typed GC and Parallel Mark)
mono -V
Install Mono
Thursday, April 26, 12
CONFIGURE
APACHE
Thursday, April 26, 12
SETUP WEB FOLDER

Create web directory

sudo
 
mkdir
 -­‐p  /srv/www/test

Grab a test page

sudo  cp
 /var/www/index.html  /srv/www/test/
Thursday, April 26, 12
DEMO
Setup Web Directories
Thursday, April 26, 12
CONFIGURE WEB SERVER
Virtual Host Setup

Setup a new virtual host

Disable default & enable new one

Reload Apache

Test basic web access
Thursday, April 26, 12
GENERATE CONFIG
bit.ly/monovhost
Virtual Host Setup
Thursday, April 26, 12
TWEAK CONFIG
Virtual Host Setup
Enable the .NET 4 runtime for the host.
Use: mod-mono-server4
Thursday, April 26, 12
UPLOAD CONFIG
File Transfer w/ FileZilla
Upload to
sftp://hostname
Thursday, April 26, 12
ENABLE SITE
From Interactive SSH

Disable the default website

sudo
 
a2dissite
 default  

Move the config file to sites-available

sudo
 
mv
 test.conf  /etc/apache2/sites-­‐available

Enable new site

sudo
 
a2ensite
 test.conf

Restart the server

sudo  
service  apache2  restart
Thursday, April 26, 12
DEMO
Build and Enable Mono Virtual Host
Thursday, April 26, 12
DEPLOY AN MVC3 SITE
Thursday, April 26, 12
PROJECT REFERENCES
Add references and set Copy Local

System.
Web.Mvc

System.
Web.Helpers

System.
Web.Routing

System.
Web.Razor

System.
Web.WebPages

System.
Web.WebPages.Razor

System.
Web.WebPages.Deployment
Thursday, April 26, 12
PROJECT REFERENCES
Remove (if present)

EntityFramework
Thursday, April 26, 12
PUBLISH SITE

Publish to File System

Connect with FileZilla

Upload to /srv/www/test/

Test it out!
Thursday, April 26, 12
DEMO
Build and publish new MVC 3 website
Thursday, April 26, 12
REVIEW

Installed Mono  2.10.2

Configured Apache

Deployed our website
Thursday, April 26, 12
nbridgewater
bit.ly/kcdc2012mono
bit.ly/iwebsys
Slides in PDF
Blog
Thursday, April 26, 12