Dual booting your Ursinus laptop
Notes:
-
Read these instructions carefully! If you encounter any problems
let me know right away. Sometimes things change and I'll need to inform
the rest of the class about any changes here.
-
Before you begin this project, backup all of your data. If you don't,
you may be very sorry.
-
This assignment is due 48 hours from the start of this class meeting.
-
Turnin: for this assignment you will send me and email from your new
Linux account installed on your laptop. Instructions for this are contained
in one of the steps below.
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.
- 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.
- Plug in your power cord and network cable.
- Start, or restart, your machine (read the next step first, though,
since it comes up quickly).
- 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".
- Hit ENTER at the "boot:" prompt.
- Hit ENTER to choose "Start or Install Ubuntu". The magic begins.
- Double-left-click on the "Install" icon.
- Click "Forward" to choose English as your laptop's language.
- Click "Forward" to choose your time zone location (NY).
- Click "Forward" to choose American English for your keybord.
- Answer the questions (I recommend using your ursinus login and password).
- Accept the name for your laptop or enter a new, UNIQUE, one and click "Forward".
- 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".
- Then right click on the last "unallocated" partition and choose
"New". Click on "ext3" and change it to "linux-swap", then
click on "Add".
- Click "Forward", then "Apply".
- Have the TA or prof eyeball the mount points to make sure they look ok,
then click "Forward".
- After a final TA or prof check, click "Install".
- 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?
- Installation will now continue with the Ubuntu base system.
- Discuss Life, the Universe and Everything while the system is installed.
- Hit "Restart now".
- 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.
- If everything is lovely, reboot your machine and then select
Ubuntu to boot.
- 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:
- You'll probably be told that there are some updates, so click
on the "updates" icon and then "Install Updates".
- 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
- Click on the following packages and select "Mark for installation"
(and mark the other packages the system wants to install):
- 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.
- Hit the "Apply" button and watch the magic.
- Close the Synaptic window.
To set up email, do the following:
- Select Applications->Internet->Evolution Mail. The following
are the changes you'll need to make in the Evolution Setup Assistant.
- Enter the Required information (Name, Email Address).
- For receiving email, choose a server type of IMAP and
use the hostname "students2k.ursinus.edu".
- 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.
- In Account Management you may enter Ursinus as the account name.
- Click on New York in the Timezone picture.
- 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.
- Start the Web browser, called Firefox, by clicking on the
earth icon just to the right of "System" at the top left.
- Enter "webpages.ursinus.edu/rliston/dualboot.html". You
should see this page.
- 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.
- 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.
- 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.
- 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".
- 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 ">>".
- 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".
- 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!
- 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.
- 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).
- 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;
}
- 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.
- 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.
- 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".
- Go back to your home directory (enter "cd").
Verify the current directory by entering "pwd" (print working directory).
- 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.
- Here's where you turn in something for this assignment: enter the
following lines verbatim, one at a time:
date >> outfile
id >> outfile
- 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.
- 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.
- Spend some time becoming very familiar with a text editor. You may
use any of the following:
-
vi: This is my personal favorite. There is a bit of a learning
curve, but once you know it this one is quite fast to use.
-
gedit: This is probably the easiest to use.
-
emacs: This also has a bit of a learning curve, but has many
features. It contains its own tutorial. Start
up emacs (Applications->Programming->Emacs 21) and click on
Help->Emacs Tutorial and go through the tutorial. The more you
learn about emacs, the better. The basic commands you need to know are:
- C-f and C-b (forwards and backwards one character)
- C-n and C-p (next and previous line)
- C-n and C-p (next and previous line)
- Esc-< and Esc-> (top and bottom of buffer)
- C-v and Esc-v (next page and previous page)
- C-x C-s (save buffer)
- C-x C-c (save any unsaved buffers and exit emacs)
-
pico: Another easy editor.
No matter which editor you select, you should learn as much as you can
about it. The more you learn, the more time you will save. You can find
tutorials online by googling for "emacs tutorial", for example.
- Spend time getting to know Linux and the bash shell. If you
Google for "Linux tutorials" or "Unix commands" you'll find many excellent
introductions and tutorials available on the Web. Some of the ones
I've found are:
Last updated: Sun Jan 20 14:58:05 EST 2008
Richard Liston