The Linux Operating System - Tonga Institute of Higher Education
Download
Report
Transcript The Linux Operating System - Tonga Institute of Higher Education
Tonga Institute of Higher Education
The Linux Operating System
Lecture 2:
Installation and
Installing Programs
Installation in Linux
●
●
●
There are many different versions of Linux. Unlike other
commercial operating systems that are controlled by one
company, Linux is free to distribute and use.
So, in the Linux world, there is a situation unlike what occurs
in the proprietary operating system world: a number of
companies, organizations and individuals have developed
their own "versions" of the Linux operating system, known as
distributions.
There are versions of Linux that were developed to be
installed on computers that receive heavy traffic. Some were
developed to be used in networks were security is a priority.
There are versions of Linux that are meant to be installed on
top of an existing operating system like Windows so people
can try out Linux under familiar conditions.
Which Linux is the best?
●
●
Most PC users probably just need the everyday
version. This kind of Linux has been widely
available for some time now.
Unfortunately Microsoft Corp., who makes its living
selling people "ordinary" operating systems, have a
lot to lose if Linux ever got popular with the
masses. For this reason they have done everything
in their power to "warn" the public that Linux is
something that you probably don't want and don't
need. But in reality, Linux is just as easily installed
and supports just as wide a range of hardware as
Microsoft Windows does.
Which Linux is the Best?
●
●
●
●
Of all the distributions out there, and there are a lot,
the most popular ones, with the easiest installation and
maintenance are RedHat, SuSE, and Debian.
RedHat Linux is probably the most popular and they
have been the most successful. You can download their
'Personal' version for free from their website.
They also have an 'Advanced Server' which costs
around $500-$1000 US, but Linux is Linux and you'll be
able to do anything you need with the 'Personal Edition‘
The one we will use is RedHat 9.0, the most popular
version
The Install
●
There are a couple of questions you need to
ask yourself.
1. Do you have another operating system installed.
2. Do you want to continue to use it.
●
●
If you want to keep an existing operating system,
and install Linux as well, you will have what is
known as a "dual-boot" system.
That means that you have a PC that can use two
different operating systems. The important thing is
that you have the option to have both.
Dual-booting
●
●
●
●
To have to operating systems on your computer,
you'll need two partitions at least.
If you happen to have MS Windows you must
repartition your hard drive to make room for Linux.
You can either erase the drive and repartition a
blank drive or you can attempt to repartition a
working hard drive. Ideally, what was done in the
"old" days was to install Windows in C: and Linux in
the D: partitions.
There are programs that can help you repartition a
hard drive that only has one partition, but
sometimes this might be dangerous
Installing
●
●
●
●
If you have the right partitions, then you can
pop in the CD you have and boot up your
computer.
Your computer probably supports booting
from the CD-ROM. In this case, Linux
installer will start right up
Sometimes, a CD-ROM will not install from
booting and you'll need a boot disk. The CDROM will usually contain a way on the disc
on how to make a floppy boot disk.
Once you've made this boot disk, you'll be
able to boot up the CD-ROM
Partitioning
●
●
●
Your hard disk is like a pie. You can divide it into
sections. For example, if you had two partitions,
popular operating systems would generally call
them C and D. You can call them whatever you
want
Linux doesn't use them, though. Linux may call
them /hda3 and /hda5 for example.
You will also need another partition known as a
'swap' partition. This 'swap' partition is just a way
that Linux uses to get more memory so that you
don't run out of it. This is the virtual memory part
Partitioning
●
●
●
The classic way of partitioning your hard disk is with a
program called 'fdisk'. This is the dangerous way to do
it. The re-partioning using this method will get rid of
everything forever
But installing Linux isn't dangerous. If you're fortunate
enough to have a hard drive with more than one
partition (the old C: and D: routine), then it may be just
a question of moving some files around.
If you didn't have two partitions already made, then
there's a tool called FIPS that comes with major Linux
versions. This will re-arrange your hard drive so you
can install Linux. There are also other programs you
can download that will do the same and help you move
things around and make new partitions.
The rest of installation
●
●
●
At this point you should have your hard drive partitioned and
these partitions assigned to what areas they'll be housing.
Now, comes the point in the process to install the Linux kernel.
You can choose additional parts to add to the kernel, known as
modules, to better use your hardware. Unless you need
something specific, the installation program will choose the
correct ones you need
Next, you'll have to choose a 'hostname' or name for your
computer. Use whatever name you want for the computer.
After, you should choose a 'domain' name. Even if your not
running an Internet server and even if you don't have a
network you should choose a name as if you had one. Normally
if you were in fact a server providing Internet services, you
would choose a name and append .com, .net etc on the end.
Example: yahoo.com
Making it bootable
●
●
●
●
Now, as we're installing from a CD, you should choose
'CD-Rom' for the installation procedure. You should also
choose the settings 'make system bootable'.
Your hard disk is basically a piece of metal with a metal
disk flying around in it at incredible speeds. It essentially
does nothing unless you tell it to do. At this point, we're
going to tell it to boot up the Linux operating system.
If you have a dual-boot system, you can also tell it to ask
you to choose from different operating systems at boot.
These are programs called Boot Loaders. One good one
is 'LILO'. Later, you can actually make alternative versions
of the Linux kernel and have LILO boot them.
Adding packages
●
●
●
●
●
Different distributions will have different orders for their
installations. At this point, most will ask for what
packages you want installed on the system
Packages are just programs that will run on your
computer. They could be web browsers, web servers,
Gnome or KDE.
Often there will be guidelines for what kind of computer
you want, Server, Workstation or Desktop. Each will
give you a different configuration for packages
If you have a lot of harddrive space, you can install
everything and not worry about what you might need in
the future
If you're short on space, you can choose the minimalist
package. We'll go into what programs you'll need for
what kind of computers later on.
Choose Passwords
●
●
●
●
You'll be asked for a root password at some point.
The root user, you'll remember, is the superuser, the
most important user who can do anything they
want.
So you don't want anyone else to be able to guess
the password or else they can do whatever they
want to your computer.
A good password will have numbers and letters and
special characters (,.><;:&$^#!@). People can
also use password crackers and these will make a
brute force attempt to guess your password, but if
you use numbers, letters and special characters, it
will be very hard to guess
Other installation issues
●
●
●
●
●
The rest of the installation is pretty simple, but sometimes
things go wrong when the software tries to detect hardware.
Most distributions will have a long list of hardware device
drivers they use to get the operating system to talk to the
hardware.
Sometimes it doesn't have the right hardware or it can decide
what hardware you actually have.
In this case, your best bet is too choose manually what you
have from a list. If it's not on the list, then choose the most
generic form.
For example, if you have a monitor but can't find it on the list,
look for Generic VGA 800x600. Most likely it will work and
then you can search online later to find the correct driver
The end of installation
●
●
●
Now you have installed Linux. Remove the
CD and reboot the computer. When it starts
up again you'll be able to choose which
operating system (if you have more than
one) and you'll see a login screen. That's
where you type in the root username and
password.
What to do after that?
That's what we'll be focusing on for the rest
of the classes.
Installing new programs
●
●
●
●
So you finished installing Linux, but what happens
when you need to get a new program or you need to
update an existing program?
Installing programs on Linux is sometimes very easy
and sometimes painfully difficult.
The first objective is to find the program on the
internet. The best bet is to search with google.com to
find what you need.
Other sites that also have a lot of Linux software are:
–
http://www.linux.org
–
http://www.sourceforge.net
–
http://rpmfind.net
–
http://www.ibiblio.org
Installing new programs
●
●
●
●
There are two ways to install a new program on
your system.
You can download the source code and compile it
Or, you can download a binary “package.” Different
distributions use different types of systems. Redhat
and SuSE will use what is called an rpm file. This is
like a program all bundled up into one file and then
you just need to run a command and it will install
on your system
Of course sometimes things aren't that easy.
The easy way: RPMs
●
●
●
●
RPM stands for RPM package manager. It's a way to
download, install, verify and update packages on a
system.
Each software package consists of an archive of files
along with information about the package like its
version, a description, and the like.
When you go to get a RPM from a website (like
http://www.rpmfind.net) you'll want to look for the one
that most closely matches your system.
For example, if you have RedHat 9.0 installed and you
want a rpm for a package but can't find one made for
RedHat 9.0, choose the one that says RedHat 8.0 or
RedHat 7.2. This is because the rpm will put files in
different places that it thinks the system follows.
The easy way: RPM
●
●
Now that you've downloaded your rpm
package for your system, time to install it
For example, if the name of the package you
downloaded is called mozilla.rpm, to install
it, we'd type into the shell
–
●
The -U stands for upgrade, which is the
safest way to do it. You can also try
–
●
rpm -U mozilla.rpm
rpm -i mozilla.rpm
This will install the program, but generally
does not work as well as the -U
Problems with RPMs
●
●
●
Unfortunately, RPMs aren't always so easy.
The thing about RPMs is that they might assume
you have other files and programs already installed
on your computer.
So sometimes when you try to install, you'll see
stuff like this
[root@usp root]# rpm -U bittorrent-3.2.1b
error: Failed dependencies:
python-base >= 2.2 is needed by bittorrent
●
●
This means that you need the program called
python-base (and a better version that 2.2) before
you can install the program called bittorrent.
So what can you do? Begin the search for other
More RPMs
●
●
●
●
Sometimes you'll be led on a wild chase to find all
the packages. Because when you go for the
package that is missing, sometimes that package
will also need other programs. It can be a big
headache.
The other downside about RPMs is that they put
files and programs in places where maybe you
don't want them.
You won't always know where they go, and they
might overwrite files that you think are important.
So there is another way, luckily for us.
Installing from source
●
●
●
So we don't RPMs, and a lot of the time we won't
be able to find one, so the other option is to
download the source code of the program and to
compile the program ourselves. This is actually not
as hard as it sounds
So now you'll download the source code and it will
usually be in one of 3 formats, .gz, .zip or .bz2
These are all compression formats used to make
the files smaller so it's easier to download.
The first step: Decompressing
●
●
●
●
So the first step we need to do after downloading is
to decompress the file.
If it ends in “.tar.gz” this means it's gzipped and put
together with tar. Tar is a program that puts
directories and many files together into one file.
Then gzip is a way to decompress files
We can decompress in one small simple step
– tar zxvf kxine-0.4.tar.gz
The 'z' says first decompress. The 'x' says to
expand the tar file. The 'v' says to output any
messages and the 'f' says use the file that you're
going to type after
Other Compressions
●
●
●
If you get a file that ends in '.bz2' you'll use the
bunzip2 program. Bunzip is a good compression,
better than even gzip
– bunzip2 kxine-0.4.2.bz2
The last format you will probably see is the '.zip'
format. This is the compression used on most
Windows machines. You can also use it with Linux
– unzip kxine-0.4.2.zip
Now you'll have a folder with the source files and
you'll be ready to compile
Installing from source
●
●
●
●
After decompressing, you'll need to change into the
new directory with the files. For example,
– cd kxine-0.4.2
Now the best thing to do is to open the README or
the INSTALL file. Usually there will be one or the
other. These will tell you the exact steps to take to
compile and install.
Most programs today will follow a general guideline
of steps that most other programs follow.
With these steps, things are pretty easy.
Compiling
●
In all likelihood, the INSTALL or README file will
tell you do to the following.
[root@comp root]# ./configure
[root@comp root]# make
[root@comp root]# make test
[root@comp root]# make install
●
●
The configure says to run a little program that will check
your system for everything it needs and where to find it. If
configure runs and it's all good, then you can type make
make is a program used to compile other programs. So now
you will see a lot of output where the computer is compiling
●
make test will make sure it compiled correctly
●
make install will put the program in the right place
Installing from source
●
●
●
When you install from source, there are potentially
many more things that can go wrong. Sometimes
the configure program will tell you what's wrong
and how to fix it.
If you get a compiler error though, it means that
the program was not able to find everything it
needed. In that case, it's best to give up and look
for another program that will do the same thing.
Unless you really need that program, dealing with
compiler errors is more of a headache then it's
worth
Summary
●
●
●
Installation with most Linux distributions is very
easy these days. Using RedHat 9.0, it's very simple,
just follow the steps, and you'll be on your way to
using Linux in no time. RedHat may be the easiest,
but Slackware was pretty simple too
Installing programs is getting easier, but there still
can be lots of problems if something on your
system is missing or it's in a place that is not
expected.
It can be quite time consuming and difficult to get
programs to compile and install when they don't
work right away, but usually there are 3 or 4 other
programs that will do the same thing in Linux.