I recently had to install Moonlight (Silverlight on Linux) on Ubuntu 7.04. The Moonlight plug-in for Firefox is not available as a binary package and needs to be compiled from source. Moonlight has dependencies on Mono. The instructions on the Moonlight project page are not sufficient for a casual Linux user like me. Fortunately, this thread at the mono-olive group came to my rescue (thanks Chris!). I am reproducing its contents with minor changes and slightly more detailed instructions:
The instructions assume that you have a clean installation of Ubuntu 7.04 up and running on your machine. Fire up Terminal. First we’ll update the Ubuntu package list and install Subversion on our machine. The commands to accomplish this require admin privileges and we’ll be using sudo to execute them. Unlike a lot of other Linux distributions, Ubuntu doesn’t prompt you to create a root account during installation. When sudo prompts you for a password, just key-in the password of the account that you’ve used for logging into your current session.
sudo apt-get update sudo apt-get install subversion
If you are attempting this at work, chances are you are behind a proxy. In which case apt-get will give you errors. Use the following command to indicate your proxy server and type the above commands again.
export http_proxy=http://YourProxyName:Port sudo apt-get update sudo apt-get install subversion
We’ll now create a folder for Mono source and pull down the required bits.
mkdir mono cd mono svn co svn://anonsvn.mono-project.com/source/trunk/mcs svn co svn://anonsvn.mono-project.com/source/trunk/mono svn co svn://anonsvn.mono-project.com/source/trunk/gtk-sharp svn co svn://anonsvn.mono-project.com/source/trunk/gnome-sharp svn co svn://anonsvn.mono-project.com/source/trunk/olive svn co svn://anonsvn.mono-project.com/source/trunk/moon svn co svn://anonsvn.mono-project.com/source/trunk/monodoc
Again, if you are behind a proxy, things will need to be done a little differently. The above commands would have given you errors. Go to the .subversion folder under your home directory open the file called “servers”.
cd ~/.subversion vi servers
If you are from the Windows world and don’t know how to use vi, use gedit:
gedit servers
Scroll down to the end of the file, and add the following lines. Save and exit your text editor.
http-proxy-host = sinproxy http-proxy-port = 80
We’ll also need to re-run the svn commands. Notice that this time we’ll use the http:// prefix instead of svn://.
svn co http://anonsvn.mono-project.com/source/trunk/mcs svn co http://anonsvn.mono-project.com/source/trunk/mono svn co http://anonsvn.mono-project.com/source/trunk/gtk-sharp svn co http://anonsvn.mono-project.com/source/trunk/gnome-sharp svn co http://anonsvn.mono-project.com/source/trunk/olive svn co http://anonsvn.mono-project.com/source/trunk/moon svn co http://anonsvn.mono-project.com/source/trunk/monodoc
We’ll use apt-get again to install dependencies and tools required to build Mono and Moonlight.
sudo apt-get install libavcodec0d libavformat0d libgtk2.0-dev libnspr-dev firefox-dev libavcodec-dev libavformat-dev libasound2-dev librsvg2-dev
sudo apt-get install autoconf automake libtool build-essential bison
One of the dependencies required for Moonlight to build (libswscale-dev), is not available for Ubuntu 7.04 but is available from the upcoming 7.10 release. We’ll use a tool called prevu to backport the package’s 7.10 version to our present 7.04 installaiton. First, we’ll need to install prevu itself.
sudo apt-get install prevu
Next we setup the prevu environment. This step requires a few hundred megs of space under /var, and takes a while to finish.
sudo prevu-init
We now need to instruct prevu to pick the libswscale-dev package from the 7.10 repositories. Go to /etc/apt and edit the sources.list file.
cd /etc/apt sudo vi sources.list
Add the following line right at the end of this file and save it.
deb-src http://us.archive.ubuntu.com/ubuntu gutsy main universe restricted multiverse
Next, we retrieve and build libswscale-dev.
sudo apt-get update prevu libswscale-dev
The step above will again take a while to finish. If all goes well, you’ll have a bunch of .deb packages under /var/cache/prevu/feisty-debs that can be installed. Ignore any errors/warnings about being unable to install ffmpeg.
cd /var/cache/prevu/feisty-debs sudo dpkg -i *.deb
We are a step or two short of being able to build Mono and Moonlight. To build Mono we need a working copy of the Mono runtime and the Mono C# compiler (mcs).
cd ~ sudo apt-get install mono-mcs
You might get some errors in the step above about missing dependencies. The following command should install the dependencies.
sudo apt-get -f install sudo apt-get install mono-mcs
We also need to patch the Mono source for Moonlight to work. Browse to: http://tirania.org/tmp/mono-delegate-appdomain-patch using Firefox, select everything and save it to a text file (call it mono-delegate-appdomain-patch) in the mono/mono/mono under your home directory. In case you are wondering about the three mono folders - the first one was created by you, the second one got created when you retrieved the mono branch using svn and the third one came along with the mono source. Let’s switch back to the terminal window and apply the patch that we just saved.
cd ~/mono/mono/mono patch -p0 < mono-delegate-appdomain-patch cd ..
We are now ready to build Mono and co.
./autogen.sh --prefix=/usr --with-moonlight=yes make sudo apt-get remove mono-mcs sudo apt-get autoremove sudo make install cd ../olive ./configure --prefix=/usr make sudo make install cd gtk-sharp ./boostrap-2.10 --prefix=/usr make sudo make install cd ../monodoc ./autogen.sh --prefix=/usr make make install cd ../gnome-sharp ./bootstrap-2.16 --prefix=/usr make sudo make install cd ../moon ./autogen.sh --prefix=/usr make sudo make install
This builds Mono and the Moonlight Firefox plug-in. We install it as follows.
sudo cp *.so moonlight.exe /usr/lib/mozilla-firefox/plugins sudo ln -s /usr/lib/mono /usr/lib/mono/3.0
Launch Firefox and type about:plugins into the address bar. The Moonlight plugin will be listed on top (on my build it was called Silverlight). Visit any of the samples at the Silverlight website to check your installation or take the Silverlight Airlines demo for a spin!
Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)