Hey there, human — the robots need you! Vote for IEEE’s Robots Guide in the Webby Awards.

Close bar

TurtleBot 2 Tutorial: Installing Ubuntu Linux

Trust us, you can do this: you can install Ubuntu, and you'll be glad you did

8 min read

TurtleBot 2 Tutorial: Installing Ubuntu Linux

This is the fourth post in our TurtleBot tutorial series. Check back every week (or so) for new posts.

I apologize for the break in the TurtleBot 2 tutorials; we got entirely too caught up in U.S. National Robotics Week last week (there's still more to come on that)! And there will likely be another break for a few weeks in early May, since we'll be in Switzerland and Germany checking out robotics labs and covering the IEEE International Conference on Intelligent Robots and Systems (IROS) and ROSCon. But it's all for you, dear reader, all for you, and our little TurtleBot is constantly demanding out attention (and affection), so it's not like we'll (ever) be forgetting about it.

This week, we're going to lay the initial groundwork for doing just about everything complicated with TurtleBot, and that means getting Ubuntu set up to coexist with Windows 7 on our desktop computer. Why do we need a desktop if the TurtleBot carries its own computer, a netbook? Good question. The goal is that, eventually, we won't be using the TurtleBot's netbook for anything at all: we'll be running ROS (Robot Operating System) on our desktop, and feeding commands wirelessly to the TurtleBot. It's the future, people!

Installing Ubuntu is probably not the easiest thing you've ever done, but it's certainly not the hardest, and we'll take you through everything that you need to do to make it happen flawlessly.

We hope.

 

Step 1: Prepare Windows

The first thing you're going to want to do is BACK UP YOUR COMPUTER. You should be doing this anyway, but if you haven't (or haven't in a while), now is the perfect time for it. There are all kinds of different ways to do this involving piles of third party software, but I just used the regular old backup tool included for free in Windows 7. It's fairly straightforward, and while there are plenty of options you can mess with, I just let Windows do whatever it wanted to do by default. You'll need a place to put the backup, of course, and I'd recommend an external hard drive. I have a 1 TB drive in my desktop, and a 1 TB external HD, and that seemed to work just fine, although I had to let it run for several hours. If you don't have an external drive, it's a worthwhile and versatile investment that you can probably find for well under $100.

As long as you have the backup (which includes a system image, a sort of photograph of everything on your drive) along with your original Windows install disc, you should be reasonably well protected against anything that goes wrong during the Linux install. If you do lose data during that process, it's not going to be a huge amount of fun to restore everything back to normal, but it should at least be possible. We're hoping, of course, that it all goes smoothly, but now you're protected if it doesn't. Oh, and if you're missing your Windows install disc, there's a tool in Windows to make a new recovery disc with a blank CD or DVD.

Okay, so now that we're all backed up, we can start actually messing with stuff. I'd find yourself a second computer (or tablet or phone) if possible, so that you have somewhere else to read this tutorial and Google for help if necessary.

 

Step 2: Make a Partition

We're about to install something called Ubuntu. Ubuntu is a free, open source Linux operating system, and it's what ROS people use to run ROS. It does most of the same stuff as Windows, just in different ways.

To stick Ubuntu on our hard drive, we've first got to carve out a little bit of space. If you've got Windows installed and nothing else, it probably ate up every last byte of your hard drive. It's fine that it did that, but we're going to have it back off a little bit to free up some space for Linux. Windows has a built-in tool to do this called Disk Management, which lets you chop your hard disc up into different areas, called partitions. You can find this tool in Control Panel > System and Security > Administrative Tools > Computer Management, and Disk Management will show up under Storage in the left-hand pane.

Incidentally, most Ubuntu installers have tools that will do this for you, but I was advised that it's safer to just let Windows deal with moving itself around your drive, since Windows can be finicky like that.

Right click on your Windows partition, which is probably called "C:", and select "Shrink Volume." Windows will figure out how much room you have to shrink it down (which is basically all the free space on the drive), but odds are, you don't need nearly that much. Of my 1 TB drive, my current Windowsy stuff took up about 400 gigs, leaving me with over 500 gigs available to devote to Ubuntu and ROS. Ubuntu and ROS together can probably survive on about 10 gigs or so, but I'm going to make a partition for 100 gigs, and here's why: I don't want to worry about needing more space soon, so I'm giving myself a bit of leeway with 50 gigs. The other 50 I'll make into a third partition that's accessible from both Windows and Linux to move files and stuff between the two, which I've heard is a good idea. You can always mess with partition sizes after the fact, and since I've never done this before it's just my best guess, but I figure I'll give it a shot.

So, I just put in 100,000 MB as the amount to shrink the C: partition by, and let 'er rip. About 30 seconds later, I had a 97.66 GB unallocated partition. Yay! Right clicking on that unallocated space lets you create a new simple volume, to which I gave 50,000 MB and called "U" for Ubuntu. Windows gives me the option to format it, but I'll just let Ubuntu do that by itself. That leaves one last partition, which I'll format as NTFS and call "S" for Storage.

And now, if you check under Computer, you should have a smaller partition for Windows (C:), a 50 gig S: partition, and then U:, which is also 50 gigs but you can't access since it's not formatted.

Now, on to Ubuntu!

 

Step 3: Install Ubuntu

There are several different ways to install Ubuntu (check some of them out here) but I decided to go the more traditional route, doing a full install from an external disk. You don't have to buy anything, but you do have to make a boot disk. Back in the day, this used to be a DVD (or a CD or even a series of floppies), but you can now (usually) do it with just any old USB key. I'd lay it all out for you, but happily, from this point on Ubuntu has some very, very friendly instructions:

How to create a bootable USB stick on Windows

Once you've created the USB key, there's another tutorial to help you out. Before you get started, here are a couple quick notes from my experience doing this that you might find useful:

  • More than likely, your computer won't by default boot from a USB drive, which is has to do to start the initial Ubuntu install. To get it to boot from a USB drive, you'll need to tweak a setting in your BIOS. Different computers have different BIOSes (it's based on your motherboard), but in most cases, pressing Delete or some Function key (like F12) during the boot process should let you access it. The window of time you have to do this is often quite short (and the instructions telling you which key to use are usually small and appear and disappear rapidly), but if you pay attention, you'll figure it out after a few tries. Once you make it into the BIOS, look for a boot menu, and reorder it so that USB ends up above Hard Disk. Save your changes and exit (there should be a hotkey or menu item for that), and you should be good to go.
  • As part of the install process, Ubuntu will try and connect to the Internet. There's a wireless option, but I just plugged my computer directly into my router with an Ethernet cord to simplify matters.
  • On occasion, the Ubuntu installer appeared to freeze. I waited, and it fixed itself. Don't panic!
  • Step 4 of the Install Ubuntu tutorial below will offer to partition your hard drive. We already did this, so you'll want to direct the install into the U: partition that you prepared earlier, with the "Something Else" option. Look for a partition that's 50 gigs and "Unknown." Ubuntu shows some confusing information on how to set this partition up; but there'a a Lifehacker tutorial here (with a screenshot here) of how to do it. The important bit is the file system: set it to Ext4.
  • At some point you'll be asked to make a swap partition. Apparently, we can just do that later, or not at all.
  • Otherwise, the install process just involves answering simple questions and setting up accounts and stuff. Set Ubuntu to update while it's installing (this requires an Internet connection), and then just step through the tutorial below:

Install Ubuntu 12.10

Hopefully, you made it through all that in one piece. If so, congratulations! If not, remember that Google is your friend, and odds are that any problem you have, other people have complained about publicly before, and found solutions from smart and helpful people online. And if you seriously did not make it through in one piece, take comfort in the fact that all of your data are safely backed up.

Assuming you survived, you should spend a little bit of time exploring how Ubuntu works. Some things are like Windows, and some things are not like Windows at all. Prepare to be very, very confused, but the best way to figure out what's what is to just mess around a little bit. For example, you should be able to find your hard drives, which now include Windows (you can access it from Ubuntu) and that Storage partition we made, that you can access from both operating systems.

The first thing you'll want to actually do, however, is to figure out how to use something called GRUB. GRUB is a boot loader, which means it's the thing that lets you decide whether you want to run Ubuntu or Windows 7 every time you start your computer. In other words, it's how you escape Ubuntu and make it back into Windows, by selecting where you want to go from a simple list. It comes with Ubuntu by default, but you'll have to set it up, and for an inexperienced Ubuntu user (like me!) it's immediately terrifying, because here's the first thing the GRUB help page has to say about configuring it:

"Configuration changes are normally made to the /etc/default/grub file and to the custom scripts located in /etc/grub.d."

Uh, what? None of that makes the slightest bit of sense to me. A lot of Ubuntu seems to be like this: once you get even slightly under the surface, doing stuff rapidly becomes impossible for novices.

Fortunately, there's a lot of ways to stay up above the surface using graphical user interfaces. In the case of GRUB, I Googled up a tool called GRUB Customizer. I have no idea how installing things works yet, but I can at least follow instructions (located here). Fire up a terminal window (with  Control + Alt + T), and enter the following commands to download and install and run GRUB Customizer from whatever a repository is:

sudo apt-add-repository ppa:danielrichter2007/grub-customizer 

sudo apt-get update 

sudo apt-get install grub-customizer

Launching the GRUB GUI should now give you a huge amount of options about how your computer boots. I set mine up to wait five seconds, and then boot whatever operating system was booted last: I've found that I use Windows for a while, followed by Ubuntu for a while, so it's handy to only have to deal with the boot menu when you actually want to switch between the two.

 

At this point, you should be all set, with a Windows 7 partition, an Ubuntu partition, a shared space on your hard drive to pass files between the two, and an easy way to boot into one or another. Take a deep breath, and pat yourself on the back.

The next thing we're going to do is install ROS, which (believe it or not) is a cinch. We'll learn how to talk to our TurtleBot over a network (possibly the most difficult part of this entire business, to be totally honest with you), and then take a tour of some of the basic features that we'll be working with in ROS.

I know all of this setup stuff can be a little tedious, but we're nearly to the exciting robot tricks part, so hang in there with us, it'll be worth it!

The Conversation (0)