Building Mono From Source Code on Suse 10

If you followed the first article in the series, you now have Suse 10 installed and you are able to access the internet and hopefully you have looked around and tried a few things to get familiar with linux.

If you are new to linux you are probably surprised to find out how user friendly the desktop environments are, things are really starting to come together in the linux desktop space. However, if you are serious about becoming proficient in the use of linux you are going to have to warm up to the idea of using the command shell, once you learn some of the basics you will start to realize that using the command shell is easy when you know how and much more direct than a GUI in a lot of ways. I've never been a guru of the DOS prompt myself, I know a few commands for network settings, telnet ftp and smtp commands, etc but thats about it I don't write a lot of .bat files or anything and what I do know I have learned out of neccesity not joy.  So my initial perception when I started learning linux was oh great I have to learn some old school ways because they don't have a GUI for everything in linux, oh well I'm not afraid but I'm not excited. But let me tell you the linux command shell is not your father's DOS prompt, because command shell is the culture in the unix/linux world they have taken it way beyond any DOS prompt on a Windows machine. There are a zillion tools and the shell itself can even be visually customized, no boring black and white fixed width console, try a full screen transluscent with the Suse lizard smiling through at you. Now I am totally a command shell enthusiast apprentice, I am not an expert yet but I love it and want to learn as mcuh as I can.

So hey before we get started on building mono lets trick out your shell so the lizard smiles through while you build mono. Login to your machine using the KDE desktop and click the little icon in the bottom left of the screen that looks like a monitor with a DOS prompt to launch Konsole. (You can do the same thing later in the command shell using the Gnome desktop, poke around, you'll find it). When Konsole opens maximize it and then choose Settings > Configure Konsole from the menu at the top. Click the tab that says "Schema". In the Schema list as shown below choose Transparent, Dark Background then click the box that says "Set as Default Schema".

You can also tweak the transparency with the slider in the bottom right if you want.  Click OK to finish.
Now type exit and hit the enter key to close the shell then click the icon in the lower left again to re-open it and now you have the transluscent shell.

One more thing before we get started we need to make sure you installed the apache2 development libraries, we will need this for compiling mod_mono. It was not available from the cd install but there is a link in my previous article. In any case you can check and make sure its there by browsing the menu in suse 10 to System > Control Center (YaST). You will be prompted for the root password. Next Choose Software > Software Management from YaST and you will see a screen that allows you to search for installed software as shown below.

Search for apache and make sure apache2-devel is installed. 
Open the File Manager -Super User mode again and browse to the rpm file and right click and choose Actions > Install With YaST

All right now we're well on our way, lets get started with building mono so you can test ASP.NET using mod_mono and apache while staying up with the latest bug fixes and improvements. We will be using the Subversion command line client svn to get the source code from the public mono repository, but to simplify things we will be using a bash script to automate the svn commands.  I downloaded this script from Paul Johnson's site and paired it down to just what is needed for ASP.NET. If you are interested in doing Forms applications or even building the MonoDevelop IDE from source code you should visit his site and check out his scripts, but for now just download this zip file with the script I've prepared for this article. When you get time look at the script to learn a little about svn, there's only a few lines of code in the file.

Close the Super User file Manager and click the House icon in the lower left corner to open a file manager in normal user mode. You are now in your home directory. Create a new folder for the mono source files Edit > Create New > Folder. Name the folder monosrc or whatever you want. Now you need to extract the monowebupdater.sh file from the zip file you downloaded above and place it in the new monosrc folder. Hint, you can right click the .zip file and you should see an option to extract it.

Now go back to your command shell window and the fun can begin. I switched my background back to white to get better screen shots.
The first thing we need to do is mark the monowebupdater.sh script file as executable by giving it execute permission. You should already be in your home folder in the command shell so just type
cd /monosrc
to switch to the folder with the script or you could use
cd /home/frodo/monosrc
replacing frodo with your user name. You have to hit the enter key after every command if thats not obvious.
another handy command is
ls
which lists the files in the current folder much like the dir command in DOS. Now to make the script executable type
chmod +x monowebupdater.sh
Then to execute the script type
./monowebupdater.sh

Let it run and it will get the files for compiling mono, mcs, libgdiplus, xsp, and mod_mono. I'm pretty sure ligdiplus is more important to WinForms development but I always get it anyway, its easy enough. When its done getting files use the ls command and you should see something like this.

Enter the command cd mono to switch to the mono folder then enter the command
./autogen.sh --prefix=/usr
(note here that in subsequent runs you should run the command make clean before the autogen)
to start compiling the core mono libraries. Be patient, consider what it would be like to compile the whole .NET framework, you are basically doing the equivalent in this and the next few steps. After the above command completes you should see this.

now enter the command make

after a good while it will finish then you enter the command
sudo make install
it will prompt you for the root password

Sweet, next we'll compile xsp the mono web server, switch to the xsp directory by entering the command
cd ../xsp
then we do just as we did in the mono directory, enter the command
./autogen.sh --prefix=/usr

when it finishes type make, then of course sudo make install



next, as shown above we start the same process for mod_mono
cd ../mod_mono
./autogen.sh --prefix=/usr

then make as shown above

and finally
sudo make install

Thats all there is to it. You can repeat this process as often as you like to get the latest mono source code. On subsequent runs its a good idea to use the
make clean
command before running
./autogen.sh --prefix=/usr

Congratulations you've now compiled and installed several programs on linux from source code.

Stay tuned for the next article where we will learn how setup a Samba share to share files between linux and Windows and after that I will create a walkthorough tutorial to install mojoPortal and configure Virtual Hosts in apache.
 

Books


I just got this book recently but I wish I had got it when I was first starting to learn linux as it would have saved me a lot of struggle. It answers a lot of the how to questions and will give you confidence in using the command shell.


This book is a great desk reference compendium of linux shell commands useful for all distributions.


This is a great MySQL book. Read through it and keep it handy as a reference.


This is a great MySQL book if you need to scale to a whole lot of users. Jeremy Zawodny is a super guru with real world experience squeezing the most out of MySQL for Yahoo!


This is the definitive book for PostgreSQL, the most advanced open source database.
Donate Money to support the mojoPortal Project. View Joe Audette's profile on LinkedIn View Joe Audette's profile on The Guild of Accessible Web Designers site