Monday, January 28, 2013

Setting up Fedora 18 virtually on Windows as a Dev Environment for Sugar Activities

I had the pleasure of attending OLPC-SF's (One Laptop Per Child, San Francisco Chapter) 5th Anniversary event here in SF this weekend. It's amazing that folks have been working on exciting projects together for 5 years already, and I feel lucky to have met all of these interesting and awesome people, albeit coming to this game only relatively recently!

Since being first inspired to jump aboard and do my part for OLPC, I've got my own XO 1.75 laptop (courtesy of the lovely ladies from OLPC Canada) to experiment with and test my work, and I've managed to get SoaS ("Sugar on a Stick") installed via Oracle's VirtualBox on my development machine at home. This was pretty straightforward, and I documented some of the steps on this previous blog entry.

If you are interested in developing Sugar Activities or contributing software skills to the OLPC effort, contact the fine folks on the Sugar Dev team here or email me at jutanclan (-at-) gmail (-dot-) com and I'm happy to give you a hand or pass you along to the right people/helpful website.

In the background I've been slowly making my way through this excellent Floss manual ("Making your own Sugar Activities") and I thought I'd do a bit of screen-capping of my own as I go, to document my own process, and to help anyone else who might come across this and have an interest to develop for OLPC too.

If you're like me and born after 1980, you grew up with Microsoft Windows and you might not use Linux at home... even if you are a Computer Scientist. (I know, I know.) ;) I have a Win 7 Dev machine and a Mac Mini, and my Win 7 machine has a massive HD and is my main go-to machine... so I've decided to install the Fedora 18 Operating System via VirtualBox. You can also do a dual-boot scenario, but VirtualBox really seems to have improved over the years, so it makes it easy to virtualize a machine... plus that idea is just kinda cool, and sortof crazy that this works.

You really need Linux for developing parts of Sugar or Sugar Activities, so I'm installing the newest Fedora (version 18) now. First I made a new VirtualBox machine, and labelled it "Fedora 18".

Fedora 18 Virtual Machine in VirtualBox
Then I downloaded what's called an "ISO" file, also sometimes referred to as an "Installer". This was from the Fedora site: http://fedoraproject.org/en/get-fedora



If you get an error like this, go to the Devices-> CD/DVD Devices menu and select "Choose a virtual CD/DVD disk file" and point to the ISO file you downloaded from the Fedora site.

Reboot the Virtual Machine from the "Machine" menu, then you should see something like this.


This is a good sign. Let's get started!

Log into Fedora, and start setting up your user/account. You can just select Live System User for now, that's a quick way to get started.

Well that certainly was easier than installing Linux ever used to be :) Now we've got Fedora 18 up and running, and humming along fast enough. I just noticed my VirtualBox settings are only giving this Virtual Machine 764Mb of RAM, so I up'd it to 1GB, and also gave this machine 2 Procs so it'll run a little faster.

We're in!
You'll notice this isn't running at full resolution either, it's not taking up my entire screen. That's pretty annoying, but VirtualBox has a way to fix that. Just google "virtualbox larger resolution" and you'll find lots of pages explaining how to extend the size of the window.

Now let's install the OLPC Sugar Operating System locally on this machine, so we can have an area to test our development going forwards.

First we need a terminal window. I was surprised you couldn't right-click on the desktop by default to get a Terminal window, but it is easily found in the "Activities", "System Tools" area.


Ok now, let's follow the very helpful instructions for getting the package of Sugar from the Sugar Development site, and install it to our Virtualized Linux machine.

Now that you've got a terminal open, run the following 3 commands:
1) su (press enter. This puts you into "root" access mode, allowing you to install software locally)
2) yum groupinstall sugar-desktop (press enter, then wait for a while while it downloads) Note: I had this freeze on me at action 46/106, and it stopped installing... I had to do a reboot of the virtual machine and just try again....
3) yum install sugar-emulator

Installing...
Ok this stalled on me a few times and was generally unstable. I decided it was probably a bad idea to be running this "Live System" mode on a Virtualized Machine, so I went through with the rest of the installation instructions listed here.

The installer finished and I had a "real" Fedora install now rather than the sortof temporary "Live System" one, better place to start from. Then I rebooted and things are already looking more reasonable. Things run much faster now.

I tried again to get VirtualBox to do a higher resolution screen but it was taking a while and I ran out of patience ;) It's harder to get that to work than it should be, but I remember getting it going ages ago for another older project. I'll figure that out and post it another time. (Edit: turns out I just needed to change desktop settings in Fedora itself - duh. Should have checked that first).

Building Sugar

Then I decided it was probably wiser to just BUILD sugar from scratch rather than to install it, since I am going to ultimately be modifying activities and testing them anyway. There are great instructions for this here.

First you need git for code repository access. You can install this with:

yum install git-core

Then follow those great instructions on that previous page I linked. This setup is pretty great because all related dependancies are contained within this script and it gets all the related libraries and does an install of everything that is needed. Pretty sweet.

Looks to be working much better than my earlier atempt

Alrighty! Looks like it built perfectly which is awesome. Now I tried to run it... and I got a few errors. Looks like I might have messed something up with my dual monitor setup in VirtualBox, so that might be messing with stuff. I'll try to get that worked out for next time and post the details.

That was a pretty good hack-a-thon to get this off the ground. Soon I'll get it running and then I can start digging into the code for the Activities themselves. Boom!

No comments:

Post a Comment