In Loki We Trust The many projects of Lokkju, Inc

feed
17Sep/104

Installing Mono and ASP.Net on Bluehost (and other shared hosting providers)

I get a request from a friend the other day to get Mindtouch working on Bluehost. It's not working yet, but Mono, XSP, and mod_mono are all fully working... and I thought I'd share the process. It's pretty basic to get compiled and running, and only takes a few modifications to the build files.

details after the break...

First, lets set up our directory structure, and download some files. We alias $HDIR to your howm directory for later use.

HDIR=~
mkdir -p ~/mono/src
cd $HDIR/mono/src
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.7.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.6.5.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.6.3.tar.bz2
tar xjvf mono-2.6.7.tar.bz2
tar xjvf xsp-2.6.5.tar.bz2
tar zjvf mod_mono-2.6.3.tar.bz2

Next build Mono itself - this takes quite a while.

cd $HDIR/mono/src/mono-2.6.7
./configure --prefix=$HDIR/mono
make
make install

We now need to set more useful environment variables.

export PKG_CONFIG_PATH=$HDIR/mono/lib/pkgconfig
export PATH=$PATH:$HDIR/mono/bin

And now we build XSP...

cd $HDIR/mono/src/xsp-2.6.5/
./configure --prefix=$HDIR/mono --with-runtime=$HDIR/mono
make
make install

And last, mod_mono. We do some sed rewriting of the configure file here because it wants to try to force us into the /etc/* area, which is read-only on Bluehost.

cd $HDIR/mono/src/mod_mono-2.6.3
mkdir -p $HDIR/mono/mod_mono/lib
mkdir -p $HDIR/mono/mod_mono/conf
# configure it, with a prefix of your home directory
sed -i "s|APXS_LIBEXECDIR=.*|APXS_LIBEXECDIR=$HDIR/mono/mod_mono/lib|g" configure
sed -i "s|APXS_SYSCONFDIR=.*|APXS_SYSCONFDIR=$HDIR/mono/mod_mono/conf|g" configure
./configure --with-mono-prefix=$HDIR/mono --prefix=$HDIR/mono --with-mono-default-config-dir=$HDIR/mono/mod_mono/conf
make
make install

That's it - you can now use the binaries in $HDIR/mono/bin/ to run and compile C# and ASP.NET code. You do still have to load mod_proxy or else use fastcgi if you want to use it with Apache... which I'm still working on.

If you want it, I've also put all the commands in a script:

#set a usable home directory env var
HDIR=~
# make a directory for mono
mkdir -p ~/mono/src
cd $HDIR/mono/src
# get the mono sources
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.7.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.6.5.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.6.3.tar.bz2

# extract
tar xjvf mono-2.6.7.tar.bz2
tar xjvf xsp-2.6.5.tar.bz2
tar xjvf mod_mono-2.6.3.tar.bz2

#go to the extracted source
cd $HDIR/mono/src/mono-2.6.7
# configure it, with a prefix of your home directory
./configure --prefix=$HDIR/mono
#make and install into $HDIR/mono
make
make install

# set important env vars
export PKG_CONFIG_PATH=$HDIR/mono/lib/pkgconfig
export PATH=$PATH:$HDIR/mono/bin

#go to the extracted source for XSP
cd $HDIR/mono/src/xsp-2.6.5/
# configure it, with a prefix of your home directory
./configure --prefix=$HDIR/mono --with-runtime=$HDIR/mono
#make and install into $HDIR/mono
make
make install

#go to the extracted source for mod_mono
cd $HDIR/mono/src/mod_mono-2.6.3
mkdir -p $HDIR/mono/mod_mono/lib
mkdir -p $HDIR/mono/mod_mono/conf
# configure it, with a prefix of your home directory
sed -i "s|APXS_LIBEXECDIR=.*|APXS_LIBEXECDIR=$HDIR/mono/mod_mono/lib|g" configure
sed -i "s|APXS_SYSCONFDIR=.*|APXS_SYSCONFDIR=$HDIR/mono/mod_mono/conf|g" configure
./configure --with-mono-prefix=$HDIR/mono --prefix=$HDIR/mono --with-mono-default-config-dir=$HDIR/mono/mod_mono/conf
#make and install into $HDIR/mono
make
make install
Comments (4) Trackbacks (0)
  1. -tar zjvf mod_mono-2.6.3.tar.bz2
    +tar xjvf mod_mono-2.6.3.tar.bz2

  2. oops, thanks – deleted the wrong line when I dumped my history!

  3. I couldn’t make this solution work with mono-cgimono-fastcgi gatewaying (through various scripts, handlers, .htaccess configs …). After compiling fastcgi and xsp, the binary mono-fastcgi-server2.exe in xsp directory was unable to run either.
    This might be the result of some compile errors I saw nearly at finishes or a limit of shared host process walling, not sure yet. But, I can say dedicated hosting is the key to mangle with such things or the way to go when you want to ‘own’ what you work with..
    Best thanks for the guide, I would be grateful of hearing updates ;)
    Cheers!

  4. Hi Lokkju..first of all a great tutorial …..thanx a lot for that
    I have done all what you have said and succesfully installed Mono on the BlueHost Shared Server.
    But I have no clue to how to run the ASP.net files on BlueHost server.
    Can you tell how to make apache modules load on the server or how to run xsp.
    If I try to run the >xsp2 command in my web app dir it says command not found.

    Any help will be greatly appreciated…..Bye


Leave a comment

No trackbacks yet.

copyright
home
service
research