 Everyone, this is Jeff Chalon, and this is the first in a series of screencasts designed to help you get started with the opsclass.org programming assignment. So let's start with assignment zero, which is where I am. I'm on the website here looking at it. And what I want to focus on in this particular screencast is just getting you set up with an environment where you can build and run OS 161 kernels. So I'm going to scroll down to here. Now you have a couple of choices here. If you have access to a shared machine, such as Timberlake at UB, your core staff may have installed the tool chain there. The CSC IT guys are very nice and helped us out. So the Sysmon 621 simulator and tool chain is installed on Timberlake. You do need to add it to your path. That's the only thing you would have to do to use it on Timberlake. If you have your own computer that runs a bunch of natively, then you can install the tool chain using a PBA that we set up on Launchpad. It's easiest if you're using one of the Ubuntu LTS releases, but if you're using another release it's also possible. You just need to sort of modify things a little bit when you do the installation. So if you have an Ubuntu host and if you don't, you might want to think about one because it's kind of fun to have a Linux machine to play with. That's one way to do it. But what I'm going to assume is that you do not have an Ubuntu machine and you'd like to develop locally rather than using a shared machine like Timberlake. So in that case, what we're going to do is we're going to use a software package called Vagrant to set up an Ubuntu virtual machine that can run on a Windows or on a Mac host. It can actually also run on an Ubuntu host, but that would be kind of silly. So at this point I'm going to assume that you've installed Vagrant. There's great instructions on how to do that. And once you have Vagrant installed what you need is what's called a Vagrant file which describes the virtual machine in terms of what type of machine it is and what software package it has installed. So our Vagrant file is maintained in this particular GitHub repository. I would encourage you to look at this a little bit because it has a readme which includes basically how you install it, which is not that hard, but also some information about known problems and workarounds that we've encountered on Windows systems. If you encounter things like this, please report them in the forums and we'll update this documentation. Or you can pull it and send us a pull request, which would be awesome. So what I'm going to do is I'm going to use get to get this. If you don't have get installed on your host machine, you need to do that. I have it installed on Mac. I don't know how to do it on Windows, but I'm sure it's possible. So what I'm going to do is I'm going to clone our Vagrant repository that clones into Vagrant by default. Now I'm going to set things up here so that I have an OS 161 directory in my home directory. I'm in my home directory now. So to do that, I'm going to just move Vagrant into OS 161. So now what I have is an OS 132 directory with the Vagrant file inside of it. Okay. Now this is pretty simple. Vagrant up. What that is going to do, and let me open up a TMux session so that I can do this in parallel with something else. This is going to begin the process of creating and initializing the Ubuntu virtual machine that will have the OS 161 tool chain installed inside of it. So you're welcome to sort of watch this output go by. What's happening is it's creating this machine. It's going to perform some updates to it. And essentially what's happening is a series of steps that are described in this provisioning file, which is included next to the Vagrant file. So if you look at this, you can see that it's installing some common software packages. It adds our PBA, it uses the PBA to install the tool chain, and then it sets up a user called Trinity that is the default user when you log in. And then it makes a few changes. That's the time zone, blah, blah, blah. So this takes a few minutes. You want to do this somewhere where you have pretty good network access because it's downloading a few things over the web and it'll run faster with a fast connection. So while this is going on, just let me point out that when you installed Vagrant, it also installed a virtual box by default. And if you open up the virtual box interface, what you'll see is that here's the virtual machine that was created by the Vagrant up command that I just ran, and it's running. And you don't need to use the virtual box manager to manage a Vagrant virtual machine. That's one of the things that's nice about Vagrant. But it's kind of neat to see that here it is. And if you want to change things like adjust the amount of memory or things like that, this is one way to do that. All right, so let's see how my Vagrant up is going. So what's happening here is it's currently in the process of upgrading my kernel modules to match the version of virtual box that I'm using. And now what's happening is it's starting to actually update the software that's included. What we tried to do is we tried to package a very minimal Ubuntu installation so that it doesn't consume too many resources on your system. I mean, essentially, this is just to run a couple of pieces of software. So it shouldn't be that large. In the past, we distributed something that had a GUI and that ended up being kind of big. So let's make sure that things are small. The other thing I want to point out is that by default, our Vagrant virtual machine is configured to share this source directory with the guest. So what that means is that any files that you put in the source directory will be visible both on the host and in the guest. And the source directory is there because it's a good place for you to put the OS 161 sources that you're going to download in a later step. That way, if you want to edit them outside the virtual machine and run the make and the run commands inside the virtual machine, you can do that. You can also, of course, edit them inside the virtual machine if you want. The Vagrant virtual machine should persist over time. So once you run Vagrant up, you shouldn't really have to do anything else. I think that when machines are shut down, sometimes the Vagrant VMs are halted. So you can imagine it's like running the virtual machine through a shutdown process. If you try to run Vagrant SSH and Vagrant tells you that the virtual machine isn't all you should have to do is run Vagrant up and it should essentially boot up your virtual machine at which point the Vagrant SSH command will succeed. If you're like me and you use a Mac and you very rarely power it off, you'll find that your Vagrant virtual machine is pretty much running all the time in the background. It doesn't consume very many resources, so it's sort of safe to do that. All right, so this is the awkward point where the Vagrant provisioning command is continuing to run. It's still installing software. You can see that here it's installing the software that it got from our PPA, which includes the binutils. Oh, it's done. Awesome. Okay, so that completed. If that command does not complete successfully, and in particular, if you look down here at the last output from the command and it says that something went wrong, the next step will not work. So if you're trying to SSH into your Vagrant virtual machine and it's asking for a password, it means that the install didn't complete properly. So at that point, the best option is to use Vagrant Destroy to remove the virtual machine and start over. Okay, but that worked. So now what I can do is run Vagrant SSH. And here I am. So now I'm inside my virtual machine. And this may get a little bit tricky. So it's important to kind of maintain the distinction here, right? So I'm using Teambox, which means I have two terminal windows open. Here I am inside my virtual machine. I'm in a home trinity directory. And here I'm outside the virtual machine. I'm in my user's channel directory on my Mac. Now as I pointed out, you'll see there's a source directory in here. And that source directory, oops, that source directory is shared with the host. So now I'm in my host and I go into source and let's create a file. There it is. So the file in the guest actually is owned by user trinity and the host it's owned by me. So and again, if I wanted to change this, then I can see that those changes are reflected in the guest. So this is one way that you can share information between the host and the guest. Now you own this virtual machine. You have pseudo access, right? And you can do whatever you want. We've put some packages in here that we think are helpful. There's obviously standard utilities like Top, LSOF, which is something we use in class. PNAP is installed. I put in something called IOTOP into new versions of the system. So this will show you top-like information, but it tracks the usage of the IOTOP system. It's pretty cool. If you want another piece of software that's not installed here, just use apt-get install whatever. And of course, on a bunch of like systems, if you type a command, if you type a command that let's see, let me see if I can figure out a command that wouldn't be installed here. I'm struggling with this. So anyway, if you type a command and it's not found, it may suggest how to install it, or you can look this up online. But you have complete control over this virtual machine. Now when you exit the virtual machine, you'll see that the connection is closed to this particular device. It can get back by running vagrant SSH again. Now again, if I kind of want to see what the state of the virtual machine is, one way to do that is to go back, open up my virtual box terminal and see that this is running. Now if I want to power it off, this command will do that. This command will, as you see, it attempts to raise or shut down, and now I go back here and I see it's powered off. The way to get it back on is to run vagrant up. But normally, there's no real need to power your virtual machine on and off. You should just be able to leave it alone. Use SSH to get in as you need, and at all other times, just kind of allow it to run. So this is how to get started with vagrant. Hopefully that helped you out a little bit, so it got you through the first stage. And I'll continue in the next screencast with how to get the OS 161 sources and how to build your first car.