I generally stay away from anything that's not in rpm form, because playing the configuration/build game is just such a waste of time especially when trying to come up with a repeatable recipe. Unfortunately, there's no rpm's for 2.8.x, 2.6.7 being the latest on the mono-project site.
I don't have a clue about building rpm's from source and have not found a build recipe either, but if one exists, I'd be more than happy to start building and distributing current rpm's for mono, since i don't feel like building from source on every new machine and having that machine's config fall out of the management purview of yum/rpm.
Goal: ASP.NET MVC2 environment
The purpose of build 2.8.1 is running ASP.NET MVC2. In theory this should work under 2.6.7, but there's a couple of bugs that mean it's not quite usable for production purposes. While I develop in Visual Studio, i don't want to commit binaries to my git repo and I want the ability to make fixes with emacs on the development server. To make this work, I also include xbuild as part of the recipe, since it lets me build the Visual Studio solution.
Anyway, here's the chronicle of my install. This is less of an article than a log of what I did to get mono 2.8.1 installed from source on a fresh Amazon Linux AMI 1.0, so it may include things you don't need that were dead-ends i went down. I started by looking at Nathan Bridgewater's Ubuntu & Fedora recipe.
Pre-requisites
yum install gcc gcc-c++ httpd httpd-devel bison gettext autoconf automake libtool libtiff-devel glib2 glib2-devel freetype fontconfig fontconfig-devel libpng-devel libexif-devel libX11-devel giflib-devel libjpeg-devel
Setup
cd /tmp mkdir mono-2.8.1 cd mono 2.8.1 wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.8.1.tar.bz2 wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.8.tar.bz2 wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.1.tar.bz2 wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.8.1.tar.bz2 tar jxf libgdiplus-2.8.1.tar.bz2 tar jxf mod_mono-2.8.tar.bz2 tar jxf mono-2.8.1.tar.bz2 tar jxf xsp-2.8.1.tar.bz2
Building mono 2.8.1
cd libgdiplus-2.8.1 ./configure --prefix=/opt/mono-2.8.1 (30s) make make install cd .. cd mono-2.8.1 ./configure --prefix=/opt/mono-2.8.1 (2m) make make install cd ..
In order to build xsp, we need to configure the environment to find mono:
export PATH=$PATH:/opt/mono-2.8.1/bin export PKG_CONFIG_PATH=/opt/mono-2.8.1/lib/pkgconfig/:$PKG_CONFIG_PATH
The above export is just affects the current session. But also needs to be set up as part of the profile:
cat >>/etc/profile.d/mono_path.sh export PATH=$PATH:/opt/mono-2.8.1/bin export PKG_CONFIG_PATH=/opt/mono-2.8.1/lib/pkgconfig/:$PKG_CONFIG_PATH
Now we can build xsp and finally mod_mono:
cd xsp-2.8.1 ./configure --prefix=/opt/mono-2.8.1 make make install cd .. cd mod_mono-2.8 ./configure --prefix=/opt/mono-2.8.1 make make install
That took a while
I did this build on an Amazon EC2 micro instance, and it took 3 hours. So might be worth attaching the EBS to a EC2 High CPU instance building it there and then re-attaching it to a micro. But you can see why I prefer rpm's. Sure i can zip up the build directories and run make install on another identical machine, but the make install on the micro instance for mono took 20 minutes. Compare that to the 2.6.7 rpm install, which took me 42 seconds including downloading via yum from novell.
[...] my mono 2.8.1 install, I'm doing this on an Amazon Linux AMI 1.0. And like that article, this isn't so much a [...]
I just did this, only installing mono, and upped to the 'medium' machine and it took 44 minutes. I would have gone for a better machine, but that's all that was available (I'm new to Amazon EC3, so not exactly sure if it wasn't available or just not to me). I didn't waste any time, just did a wget, unzipped it, cd'ed to the dir, ran make and make install. Here's the uptime report:
00:19:29 up 44 min, 1 user, load average: 0.31, 0.55, 0.65
I followed these instructions, but used vs 2.10.2 and it all worked just fine..
I get a few errors when trying to follow this procedure.
cat >>/etc/profile.d/mono_path.sh results in a permission denied error. Even doing sudo cat >>/etc/profile.d/mono_path.sh results in permission denied. I worked around it by using VI to edit mono_path.sh and manually added in the following lines to it
export PATH=$PATH:/opt/mono-2.8.1/bin
export PKG_CONFIG_PATH=/opt/mono-2.8.1/lib/pkgconfig/:$PKG_CONFIG_PATH
cd xsp-2.8.1
./configure –prefix=/opt/mono-2.8.1
I need to use sudo to run the above command like so
sudo ./configure –prefix=/opt/mono-2.8.1
And get the following error output…
[ec2-user@ip-10-245-39-133 xsp-2.8.1]$ sudo ./configure –prefix=/opt/mono-2.8.1
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether to enable maintainer-specific portions of Makefiles… no
checking for a BSD-compatible install… /usr/bin/install -c
checking for pkg-config… /usr/bin/pkg-config
checking if tracing is requested… no
checking for csc… no
checking for gmcs… no
checking for dmcs… no
checking for runtime in the installation prefix… /opt/mono-2.8.1/bin/mono
checking for gacutil… no
checking for sn… no
configure: error: No C# compiler found
Not sure what to do about this one. Anyone got any ideas?
Using the most recent Amazon basic 32-bit Linux AMI, I've created a bash script to compile Mono, XSP, and Nant.
You'll want to su to root first by running: sudo su -
You may also want to prevent ssh from timing out by editing: /etc/ssh/sshd_config
Uncomment 'ClientAliveInterval' and change its value to 60
Save the config file and run: /etc/init.d/sshd reload
Log out and then ssh back in again to a new session
#!/bin/bash
pushd /opt
MONO=mono-2.10
XSP=xsp-2.10
NANT=nant-0.91
if [ ! -f ${MONO}.tar.bz2 ]; then
wget http://ftp.novell.com/pub/mono/sources/mono/${MONO}.tar.bz2
tar xjf ${MONO}.tar.bz2
fi
if [ ! -f ${XSP}.tar.bz2 ]; then
wget http://ftp.novell.com/pub/mono/sources/xsp/${XSP}.tar.bz2
tar xjf ${XSP}.tar.bz2
fi
if [ ! -f ${NANT}-bin.tar.gz ]; then
wget http://downloads.sourceforge.net/nant/${NANT}-bin.tar.gz
tar xzf ${NANT}-bin.tar.gz
fi
if [ ! -f /opt/mono/bin/mono ]; then
yum -y install gcc gcc-c++ httpd httpd-devel bison gettext make automake autoconf libtool libtiff-devel glib2 glib2-devel freetype fontconfig fontconfig-devel libpng-devel libexif-devel libX11-devel giflib-devel libjpeg-devel
if [ -f ${MONO}/configure ]; then
mv ${MONO} ${MONO}-src
cd ${MONO}-src
./configure –prefix=/opt/${MONO}
make; make install
cd ..
fi
rm -f mono
ln -s ${MONO} mono
rm -f /usr/bin/mono
ln -s /opt/mono/bin/mono /usr/bin/mono
rm -f /usr/lib/mono
ln -s /opt/mono/lib/mono /usr/lib/mono
fi
export PATH=/sbin:/usr/sbin:/opt/mono/bin:$PATH
export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
if [ ! -f /opt/mono/bin/xsp2 ]; then
if [ -f ${XSP}/configure ]; then
mv ${XSP} ${XSP}-src
cd ${XSP}-src
./configure –prefix=/opt/${MONO}
make; make install
cd ..
fi
rm -f /usr/bin/xsp2
ln -s /opt/mono/bin/xsp2 /usr/bin/xsp2
fi
if [ ! -f /opt/mono/bin/nant ]; then
cd mono/bin
echo '#!/bin/sh' > nant
echo "mono /opt/${NANT}/bin/NAnt.exe" '"$@"' >> nant
chmod 755 nant
cd ..
rm -f /usr/bin/nant
ln -s /opt/mono/bin/nant /usr/bin/nant
fi
popd