Dual booting your Ursinus laptop


Notes:
Objective: This class will use the Linux environment. This assignment is designed to get you started using Linux on your laptop.


Background: An operating system (OS) is the software that manages the resources on your computer. Examples of operating systems include Windows, MacOS and UNIX. Linux is an extremely popular variant of the UNIX operating system. As of November 2007, out of the top 500 supercomputing systems, 426 run Linux, and some of the world's largest data centers like Google and Amazon use Linux. A brief history of Linux is described in this excerpt from www.linux.org:
Linux is an operating system that was initially created as a hobby by a young student, Linus Torvalds, at the University of Helsinki in Finland. Linus had an interest in Minix, a small UNIX system, and decided to develop a system that exceeded the Minix standards. He began his work in 1991 when he released version 0.02 and worked steadily until 1994 when version 1.0 of the Linux Kernel was released. The kernel, at the heart of all Linux systems, is developed and released under the GNU General Public License and its source code is freely available to everyone. It is this kernel that forms the base around which a Linux operating system is developed. There are now literally hundreds of companies and organizations and an equal number of individuals that have released their own versions of operating systems based on the Linux kernel.

...

Apart from the fact that it's freely distributed, Linux's functionality, adaptability and robustness, has made it the main alternative for proprietary Unix and Microsoft operating systems. IBM, Hewlett-Packard and other giants of the computing world have embraced Linux and support its ongoing development. More than a decade after its initial release, Linux is being adopted worldwide as a server platform primarily. Its use as a home and office desktop operating system is also on the rise. The operating system can also be incorporated directly into microchips in a process called "embedding" and is increasingly being used this way in appliances and devices.


Assignment: This assignment has two parts. The first part is to set up your laptop to boot both the Windows XP and Linux operating systems. The second part is to begin becoming familiar with the Linux environment. Before you start you'll need to have the Ubuntu Linux CD.

Part 1: Dual Booting Linux/Windows

Initially, hard drives are just a place to store a bunch of 0s and 1s. Partitioning a hard drive places information on it about where the data can be stored. Writing a filesystem on the partition further structures the hard drive and also determines how the information is stored. Your hard drive currently has some partitions and filesystems on it. We will be changing the partitions and filesystems on your laptop to prepare to install Linux. Before continuing below, make sure I have (or a TA has) performed some necessary pre-op surgery on your hard drive. Note: Computing Services does not support Linux. If you ever have questions about it ask me or your TA. If there is ever a problem with your Windows system Computing Services may have to re-image your hard drive. This will render your Linux system unusable and you will have to reinstall Linux, so you'll need to keep backups of your work under Linux. More on this later.

  1. Note: any errors made during this process can destroy all information on your current hard drive. Before you begin, backup *all* files onto your R: drive or burn it to CD. This is, of course, a wise thing to do anyway. Now remove the data in your D: drive, or at least make sure there's less than about 500 MB of data there. This drive is going to be shrunk down. Frankly, I don't know what will happen if you have more data on it than the size of the disk after shrinking and I don't want to find out.
  2. Plug in your power cord and network cable.
  3. Start, or restart, your machine (read the next step first, though, since it comes up quickly).
  4. Your machine is configured to automatically boot from the internal hard drive. For now you need to boot the CD. During one part of startup there is a small window of time that you can press F12 (while the white bar is filling from left to right). Hold down the F12 key, then when you get the menu of boot devices, place the Ubuntu Linux CD in the CD drive and select the boot device "CD/DVD/CD-RW Drive".
  5. Hit ENTER at the "boot:" prompt.
  6. Hit ENTER to choose "Start or Install Ubuntu". The magic begins.
  7. Double-left-click on the "Install" icon.
  8. Click "Forward" to choose English as your laptop's language.
  9. Click "Forward" to choose your time zone location (NY).
  10. Click "Forward" to choose American English for your keybord.
  11. Answer the questions (I recommend using your ursinus login and password).
  12. Accept the name for your laptop or enter a new, UNIQUE, one and click "Forward".
  13. For the next two steps make sure the TA or professor is with you to ensure everything is going as planned. First, right click on the first "unallocated" partition and choose "New". Just take the defaults by clicking on "Add".
  14. Then right click on the last "unallocated" partition and choose "New". Click on "ext3" and change it to "linux-swap", then click on "Add".
  15. Click "Forward", then "Apply".
  16. Have the TA or prof eyeball the mount points to make sure they look ok, then click "Forward".
  17. After a final TA or prof check, click "Install".
  18. Ok, at this point my laptop found an error. Going back didn't help, so I just clicked "Continue" and things worked fine. If you get an error message at this point, please let me take a look at it but I'll probably just say "click Continue". Crazy, huh?
  19. Installation will now continue with the Ubuntu base system.
  20. Discuss Life, the Universe and Everything while the system is installed.
  21. Hit "Restart now".
  22. When rebooting, this time arrow down to Windows and make sure you haven't hosed your Windows installation. It's probably fine, but just make sure things look ok on your D: drive.
  23. If everything is lovely, reboot your machine and then select Ubuntu to boot.
  24. Installation will continue until you get a login screen. Login.
Congratulations - you've now got two Operating Systems on one machine to work with! Now what do you do? Read on...

Part 2: Using Linux

When you log in you are in the Gnome desktop environment. There are many directions you can go from here. For this assignment you are going to install a couple of software packages, set up email, get to know the basics of getting around in Linux and learn to create, compile and run a program.

To install some additional software packages:

  1. You'll probably be told that there are some updates, so click on the "updates" icon and then "Install Updates".
  2. There are tons of great, free programs available. Start up the Synaptic Package Manager by selecting System->Administration->Synaptic Package Manager; close the intro screen
  3. Click on the following packages and select "Mark for installation" (and mark the other packages the system wants to install):
  4. You can add any other packages that look interesting later, but keep an eye on your hard drive space. You'll need plenty for our class.
  5. Hit the "Apply" button and watch the magic.
  6. Close the Synaptic window.
To set up email, do the following:
  1. Select Applications->Internet->Evolution Mail. The following are the changes you'll need to make in the Evolution Setup Assistant.
  2. Enter the Required information (Name, Email Address).
  3. For receiving email, choose a server type of IMAP and use the hostname "students2k.ursinus.edu".
  4. For sending email, choose a server type of SMTP, server "students2k.ursinus.edu", check "Server requires authentication", set Type to "Login" and enter your username.
  5. In Account Management you may enter Ursinus as the account name.
  6. Click on New York in the Timezone picture.
  7. Choose "Apply". Evolution will start up. Select the account name you entered above, and the Inbox and you should now be able to send and receive email.
Next you'll need to set up a directory for your work. Then you'll create a source file and compile and execute it. Although Gnome provides a graphical interface to the system, many users find it much faster to work primarily in the shell environment, so that's where we'll start. Throughout the course you will learn more about the system so you can customize it however you see fit.

The shell is a textual environment for interacting with the system. At a shell prompt, something like "user@host:dir $", you enter commands that execute programs or change your environment. The shell is also provides a programming language that can be used to write short, very powerful and useful programs.

  1. Start the Web browser, called Firefox, by clicking on the earth icon just to the right of "System" at the top left.
  2. Enter "webpages.ursinus.edu/rliston/dualboot.html". You should see this page.
  3. In Gnome you have four different desktops you can use and switch among. Hold down Control-Alt and hit the left and right arrows and you will move among the desktops. Icons in the bottom right of the screen show which screen is currently displayed.
  4. Now set up another desktop to work with this intro by going to a new desktop (Ctrl-Alt-Right Arrow), then left click on Applications->Accessories, then RIGHT click on Terminal and select "Add this launcher to panel". An icon for the Terminal program should now appear next to your other icons. Click on it to start a terminal. The terminal is running a program called the "bash" shell. You can move back and forth between the browser and terminal to look up things in Google and try them out.
  5. Now we're going to use some of the basic UNIX commands to create some directories and files, and move around and begin examining the system. All commands will be entered at the shell prompt. First enter "ls". You should only see "Desktop" and "Examples". "Desktop" is a directory that is currently empty. Now enter "ls -l". The "-l" is a flag given to the ls command that causes ls to print more information, although the information won't make a lot of sense... yet.
  6. Enter the command "date". You should see a string that represents the current date and time. Now enter "date > newfile". Nothing happened... or did it? Enter "ls" and you will see that there's now a file called newfile. What's in the file? Enter "cat newfile" to see the contents. The output from the date command was redirected into the new file called "newfile".
  7. If you do "date > newfile" and "cat newfile" again (or just arrow up to get your previous commands), you'll see that the old file was wiped out and a new one created with the output from the new execution of the date command. To add information to a file rather than wiping out the original, use two greater-than signs. Enter "date >> newfile" and "cat newfile" and you'll see two lines with different times. The second one was appended to the file with ">>".
  8. You can always get information about commands by reading the "man" pages. Enter "man date". There's a lot of information about the date command. You can page through by hitting space. You don't have to read it all, but it's there whenever you need it. Hit "q" to get out of the man page. What would you do to find out more about the man command? You guessed it: "man man".
  9. Ok, let's move around in the system. The filesystem is organized in a hierarchical tree structure. The root of the tree is denoted by "/". Elements in the tree are generally either directories or files. Files can only be leaves in the tree. After the root, each element is named and separated by a slash "/". Go to the root of the filesystem by entering "cd /". Cd is short for change directory. Now enter "ls" and you'll see a number of directories. Enter "cd bin", then "ls". In this directory are a number of basic commands. Hey look... there's the "date" command you executed earlier!
  10. Each user has a home directory, which is where you created newfile. You can cd directly to your home directory with "cd /home/username" (fill in your own username). How do you know you're in your home directory? Do "ls" and you'll see the Desktop directory and newfile. You can also just enter "cd" and you will automatically be taken to your home directory.
  11. Let's create a place to work for this class. Enter "mkdir cs174" (or whatever the correct number is for the course). An "ls" shows the new directory. Change to this directory with "cd csXXX" (Fill in XXX).
  12. Now we're going to edit, compile and run a program. Start a text editor (for example, Applications->Accessories->Text Editor will start up a basic text editor). Enter the following into the text editor. (One easy way to do this is to find these instructions using your browser, highlight the following and paste it into your editing window. You may need to reformat it a bit. Note that in this environment you can just highlight it and then simply right click to paste it where the cursor is.)
        #include <iostream>
    
        using namespace std;
    
        int main()
        {
            cout << "hello world!" << endl;
            return 0;
        }
    
  13. Now save the file as assgn1.cpp into the csXXX directory you just created and exit the editor. Doing "ls" in this directory shows assgn1.cpp.
  14. Compile it by entering "g++ assgn1.cpp". If all is well, a file called "a.out" is automatically created. You can run it by entering "./a.out". Just entering "a.out" alone doesn't work --- eventually we'll see why that is the case.
  15. Hmmm. If you create all your files for this class in the same directory things could eventually get messy. In the csXXX directory create another directory called assgn1. Now move the files you just created into that directory with "mv assgn1.cpp a.out assgn1". Doing "man mv" tells you a bit about the mv command, but at the bottom it tells you to get more information by entering "info coreutils mv". You can do this and then get out of it by just hitting "q".
  16. Go back to your home directory (enter "cd"). Verify the current directory by entering "pwd" (print working directory).
  17. Now enter "ls -R > outfile". Enter "cat out" and hit TAB. The shell recognizes the filename and completes it for you, saving keystrokes (Nice shell... thanks!). Hit enter to see the contents of outfile.
  18. Here's where you turn in something for this assignment: enter the following lines verbatim, one at a time:
    date >> outfile
    id >> outfile
    
  19. Now email "outfile" to me. Start the Evolution mail program and create a new mail message with me as the recipient (rliston@ursinus.edu). Attach outfile, then send the message. I will respond to you when I receive it. If you don't receive an acknowledgement from me within a day, let me know so I can try to figure out what happened.
  20. You don't need to keep newfile or outfile around, so you can remove them by entering "rm newfile outfile". Verify that this worked with "ls".

You've now completed this assignment. What's left? Plenty! The following are things you should do before the next class.


Last updated: Sun Jan 20 14:58:05 EST 2008
Richard Liston