Archive

Posts Tagged ‘monodevelop’

Installing Mono 2.4 in Ubuntu

February 15, 2010 2 comments

This is a step by step guide to installing Mono 2.4 and mod_mono on a

fresh Ubuntu Server install. Let’s begin.

1) Logon to machine so you see a command prompt.

Type: sudo bash

Enter your password, you should now be root. This will allow you to do

whatever you want without typing “sudo” in front of every command.

2) Install all prequisits for Mono. Note you can put all packages on a

single line, but if you’re just starting out, you might want to install

each one just to make sure it all goes well. If any package is already

installed, just continue on. Depending on your system, you might already

have some of these.

Type: apt-get install build-essential

Type: apt-get install pkg-config

Type: apt-get install bison

Type: apt-get install libglib2.0-0 libglib2.0-dev

Type: apt-get install libpng12-dev

Type: apt-get install libx11-dev

Type: apt-get install libfontconfig1-dev

Type: apt-get install libfreetype6-dev

Type: apt-get install apache2

Type: apt-get install apache2-threaded-dev

Type: apt-get install gettext

3) Download and build libgdiplus which is required for Mono to build.

Type: cd ~

Type: wget

http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.tar.bz2

You should now have the file libgdiplus-2.4.tar.bz2 in your ~/ directory

Type: tar -xpjf libgdiplus-2.4.tar.bz2

This will decompress the tar file into its own directory, note you won’t

see any output)

You should now have a directory called libgdiplus-2.4

Type: cd libgdiplus-2.4/

Type: ./configure

You should not see any errors, but if you’re missing any packages please

install them and run “./configure” again.

Type: make

Sometimes here I see some error about “link is not a valid
libtool object” and Error 1. I have no idea what causes this, but I can
usually work around it by running “apt-get update” and “./configure” again.

Type: make install

4) Build Mono:

Type: cd ~
Type: wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2
Type: tar -xpjf mono-2.4.tar.bz2

This will take a minute or so because it’s a big file and you won’t see
anything on the screen because stuff isn’t too chatty in the UNIX world.

Type: cd mono-2.4/
Type: ./configure
Type: make

This will take a while – probably about 15 minutes or so.

Type: make install

When this is done, you should be able to type “mono” from the prompt and
see mono options. This is a good sign.

5) Build xsp (this also includes mono-server which is used for Apache
integration)

Type: cd ~
Type: wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.tar.bz2
Type: tar -xpjf xsp-2.4.tar.bz2
Type: cd xsp-2.4/
Type: ./configure
Type: make
Type: make install

6) Build mod_mono so you can run Mono web sites on Apache

Type: cd ~
Type: wget
http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.4.tar.bz2
Type: tar -xpjf mod_mono-2.4.tar.bz2
Type: cd mod_mono-2.4/
Type: ./configure
Type: make
Type: make install

7) Configure Mod_Mono with Apache

Type: cd /etc/apache2
Type: pico apache2.conf

Search for this section:
# Include module configuration:
Include /etc/apache2/mods-enabled/*.

load

Include /etc/apache2/mods-enabled/*.conf

Add the following line under the above lines:

Include /etc/apache2/mod_mono.conf

At the end of this file, add the following line:

MonoServerPath /usr/local/bin/mod-mono-server2

Press CTRL+X to exit Pico, answer “Yes” to save your changes and press

enter to use the same file name.

Restart Apache by typing: /etc/init.d/apache2 restart

8) Make sure it all works!

Type: cd /var/www

This is your default website directory. By default there’s just a

temporary index.html file that says “It works!”, you can remove this.

Type: rm *

Now let’s create a test ASPX page.

Type: pico default.aspx

If you know ASP.NET, you can write some code here. But for something

dirt simple, just use:

Save the file and exit Pico (CTRL+X)

In your web browser, you should now be able to browse to the site and

see “Hello World!” on your screen. From this point on, you should be good

to go and develop a much more complex application 🙂

Advertisements
Categories: Mono, Ubuntu Tags: , ,
%d bloggers like this: