Moonlight On Ubuntu 7.04

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!

  • I have a question. Does this piece of commands still work with other Linux like Redhat? Thanks.
  • Ubunto is the best. I have been using it since many months. It has never given problem to me.
  • I didn't know this earlier. Thanks for informing. Now I am also using Ubuntu. It is very easy to work with it.
  • 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
  • Ubuntu has done a great job this time creating a superb plug-in that is working smoothly for me:)


    Thanks and Regards.
  • I dont know about you guys but this this isnt working for me!
  • Ubuntu is, definitely best OS! The Moonlight plug-in for Firefox is really good though it should get available in binary number :)
  • 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!

    Thanks
  • I dont know about you but it work for me very well:) I love this plugin.


    Thanks and Reagrds
  • I also really like this plug-in I think it cant get any better then this, You have done great job!
  • Unfortunately, the Moonlight plug-in for Firefox is not available as a binary package and needs to be compiled from source.
  • Ubuntu is my best os ever.
  • brightondentist
    It actually takes some time to get hang of it.. buts isnt it a wonderful OS.. just love the flexibility.. and not spoon feeding as windows does..

    Dentists in Brighton
  • Yes he is the best:)
blog comments powered by Disqus