My Adventures Installing mono 2.0 on CentOS 4 to work with apache via mod_mono
Apparently the good folks over at the mono project decided to discontinue binary packages for the Red Hat line of linux distributions. It’s a shame in a way, there are a lot of those installation out there, so it would be nice to keep things updated through yum or apt-install or rhupdate, etc..
On the up side, installing from source has never been easier. In the past I have went through many hours of trying to get the right versions of different libraries that were needed. With the official release of 2.0 it seems much better. I thought I would share the steps that I went through.
Disclaimer: This worked on a fairly fresh install of CentOS 4.7. I have not tried it on 5.x, nor on any other flavor of linux (SUSE, Ubuntu, etc..) so your mileage may vary.
At the time of the install (and this writing) the current mono stable version is 2.0.1 so all references will be to that version. Here are the steps that I went through.
Preparation
Always be prepared – Boy Scouts motto…
In rooting around the web I did find a few helpful pointers. First, make sure you have gcc installed. Now this is one of those duh pieces of information, but in the fairness of completeness I thought I would mention it. (Note: If you do not have gcc or bison, install them! Credit The_Assimilator’s comment)
# yum install gcc-c++
# yum install bison
yum install httpd-devel
You may also require the glib-2.0 libraries (thanks to Michael Walsh for that bit). If you receive the error “Package glib-2.0 was not found in the pkg-config search path” you can install it via yum as well.
yum install glib2-devel
The Main Dance
Next comes the meat of the installation. First, I downloaded the necessary source packages. I simply used wget to snag the core mono package, xsp (mono web server) and mod_mono (apache integration).
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.0.1.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.0.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.0.tar.bz2
Next we install the mono core
tar -vxjf mono-2.0.1.tar.bz2 cd mono-2.0.1 ./configure make make install cd ..
Next comes xsp
tar -vxjf xsp-2.0.tar.bz cd xsp-2.0 ./configure make make install cd ..
At this point I recevied an error (I believe it was in the make process) that the compiler could not find the file dotnet.pc. I found that it was indeed on my system so I simply had to export the path and then finsih the compile.
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig make make install cd..
Note: Make sure the file dotnet.pc is in that location. If not, adjust the path above.
Finally we install mod_mono
tar -vxjf mod_mono-2.0.tar.bz2
cd mod_mono-2.0
./configure
make
make install
There, easy huh?
Configuration
You may want to verify a few thigns to make sure the configuration is ready to rock. In my case, I am keeping the mono configuration in a separate file for sanity sake. You can do that or put it all in your httpd.conf, it’s up to you.
<IfModule !mod_mono.c> LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so AddType application/x-asp-net .aspx AddType application/x-asp-net .asmx AddType application/x-asp-net .ashx AddType application/x-asp-net .asax AddType application/x-asp-net .ascx AddType application/x-asp-net .soap AddType application/x-asp-net .rem AddType application/x-asp-net .axd AddType application/x-asp-net .cs AddType application/x-asp-net .config AddType application/x-asp-net .Config AddType application/x-asp-net .dll DirectoryIndex index.aspx DirectoryIndex Default.aspx DirectoryIndex default.aspx </IfModule>
November 6, 2008 - Posted by palehorse | .NET, C#, Development, Operating Systems | CentOS, Linux, mono
13 Comments »
Leave a comment
Pale Tweets
- Chicken on the grill, sauce on the stove, beer in the hand. Ah summer! 4 days ago
- @JTRobinette hah, maybe that's it! I could use some of those #jedimindtricks 4 days ago
- Wow, how does boondocks make it if they are this dead on az friday night #inbend 5 days ago
The Cloud
Archives
Pale’s Social Graph
Google Reader Shared Stuff- Adobe Joins Microsoft's MAPP Program
- Requiem for the G1
- Pour one out: T-Mobile G1 no longer for sale
- Review: Samsung Galaxy S
- Android Users Aren't As Disloyal As Reported
- Acer's Android-powered Stream confirmed for Expansys-exclusive August 9th launch
- Samsung dispatching free Galaxy S handsets to iPhone 4 whiners on Twitter?
- OnStar expands smartphone control over entire 2011 GM lineup
- Samsung Galaxy S review shootout: Captivate for AT&T and Vibrant for T-Mobile
- “As Administrator” only a CTRL-Shift-Click away (and other keyboard shortcuts you might not know)
Pale Tweets
- Chicken on the grill, sauce on the stove, beer in the hand. Ah summer! 4 days ago
- @JTRobinette hah, maybe that's it! I could use some of those #jedimindtricks 4 days ago
- Wow, how does boondocks make it if they are this dead on az friday night #inbend 5 days ago
Blogroll
Hey, that’s a really useful tutorial. I’ve been bitten by Novell not doing Mono 2.0 RHEL packages anymore too.
Just some notes that may help people if they get stuck:
I assume you want the httpd-devel package (instead of httpd-devl)
Mono requires at least glib-2.0 to compile and not everyone will have that. If you hit an error like “Package glib-2.0 was not found in the pkg-config search path” then you can get it by running:
yum install glib2-devel
after yum installing mod_mono it may put a line in your httpd.conf pointing to a nonexistant conf like “Include /conf.d/mod_mono.conf” which doesn’t exist on my machine so watch out for that too
Thanks Michael. Yes, a misspelling on the httpd-devel.
I’ve corrected that in the post.
I did not run into the glib-2.0 problem, thanks for that tip. I’ve added that as well.
Thanks for the tutorial!
I was able to compile from source using CentOS 5.2. The OS came with the correct glib package, but I still had export the package path to dotnet.pc.
I was also able to successfully setup the MonoApplications using .NET 2.0 libraries. There’s a few tricks there, especially for applications that already run on IIS.
When adding the MonoServerPath to httpd.conf, I had to use
MonoServerPath /usr/local/bin/mod-mono-server2
You just need to make sure you point it to the right path. All of the documentation I read had the mono server files in different places.
Also, if you’re Web.Config file references other files (like we do with log4net), you’ll need to change the paths to those files to use forward slashes, ‘/’, for linux to find them.
You’ll also need to make sure that files that need to be written/read/executed by the server can accessed by the apache user as well as the user you setup to upload/edit files on the web server. I added them to a ‘web’ group and set the permissions on the site accordingly.
Hi there!
Same theme, same subject in common (open source) then our opinions part ways!
No flame war, no rudeness, just my opinion of Mono (bearing in mind that at work im caught in a .net (sic))
Mono sponsored by Novell, Novell the official bed partner of Microsoft (IMO)
Ask yourself this, MS used patent power to get Novell to sign on board. Why would it sit back and allow Novell to sponsor Mono if it didnt have some other motive at work here?
Call it paranoid ramblings of a 30+r who never grew out of 68k asm or the A500 demo-scene, or maybe, just maybe, there is something more to the “Wonderful” gift of Mono.
“Beware of a Novell bearing gifts”
http://www.openbytes.wordpress.com
Thanks, this post was really helpful to recompile MONO, in OpenSuse I just had to install the apache2-devel package in order to compile succesfully the mod_mono. We need to recompile to solve a weird bug that was preventing the formviews to work properly.
http://royriojas.blogspot.com/2009/01/mono-formviewobjectdatasourceview-bug.html
Thanks again.
Roy, I’m glad this helped. Great job finding that bug! That’s one of the great things about OSS, the ability to find and fix things like that.
I found this guide about debugging in mono, did you try the methods in there, or did it not work trying to debug the framework?
thanks, this post was helpful for me to install mono.
Many thanks, this guide worked perfectly for me (to the letter!) on CentOS 5.2 with Mono 2.4 sources.
BTW, the httpd-devel package is required by the mod_mono compile if apxs (Apache Extension Tool) is not on your machine.
And if you need to install gcc, use:
# yum install gcc-c++
Glad to help, and thanks for the additional information!
One more thing – for compiling Mono you will need bison installed:
# yum install bison
Thanks for your article, and I successfully installed Mono 2.3.2.4, xsp and mod_xsp, and successfully ran my first example bases on iTextSharp.
Thanks for your article, My first iTextSharp example works on CentOS
[...] ASP.NET and Mono My Adventures Installing mono 2.0 on CentOS 4 to work with apache via mod_mono Share and [...]
Pingback by How to Install XSP and Integerate XSP With Apache 2 Under CentOS 5 | RubyPDF Blog | October 22, 2009 |