Вы находитесь на странице: 1из 35

Module 04

Linux Installation n
io
t
a
c
and Package Management
it fi om
r
e
C

I
P
L

x bk
u
.
n
w
i
w
L
w

//
:
tp
t
h

a
c
a

c
.
d

Ojectives
Design a Hard Disk Layout
System Considerations
Swap Space
General Guidelines

Install a Boot Manager

LILO
GRUB
Manage Shared Libraries
Shared Library Dependencies
Linking Shared Libraries

Use Debian Package Management


Debian Package Management Overview
Managing Debian Packages

I
P
Use Red Hat Package Manager (RPM)L
RPM Overview
Running rpm
YUM Overview

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Design a Hard Disk Layout

Part of the installation process for Linux is designing the


hard disk partitioning scheme
System Considerations:

n
o
i
t
a
c
fi

The amount of disk space


The size of the system
m
i
o
t
c
r d.
What the system will be used for
e
a
C
c
How and where backups will be performedx
ka

Limited disk space

I
P
L

u
b
.
n
Li www
//
:
tp
t
h

Design a Hard Disk Layout


Limited disk space:
Filesystems and partitions holding user data should be maintained
with a maximum amount of free space to accommodate user activity
n of
When disk space is limited, you may opt to reduce the number
o
i
t
partitions, thereby combining free space into a single a
contiguous pool
c
m space
Exp: installing Linux on a PC with only 1 GB of available
it fi codisk
r d.
might best be implemented using only a few partitions:
e
Cthe firstacapartition
o /boot : 50 MB. A small /boot filesystem in
x bk
u
.
ensures that all kernels are below the
limit for older
n1024-cylinder
w
i
w
L
kernels and BIOS
w
I
//
:
o / : 850 MB. A large root partitionPholds teverything
p
on the system
t
L
h
thats not in /boot
o swap : 100MB

Design a Hard Disk Layout


Larger systems:
On larger platforms, functional issues such as backup strategies
and required filesystem sizes can dictate disk layout
File server is to be constructed serving 100 GB of executable data
files to end users via NFS
n

I
P
L

i
t
er

io
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Design a Hard Disk Layout


Mount points:
Before you may access the various filesystem partitions created on
the storage devices, you first must list them in a filesystem table
This process is referred to as mounting, and the directory you are
mounting is called a mount point
n
o
i points if
You must create the directories that you will use for mount
t
a
c
they do not already exist
it fi com
During system startup, these directories and mount
r points
may be
.
e
d
C aca
managed through the /etc/fstab file

I
P
L

x bk
u
.
n
w
i
w
L
w

//
:
tp
t
h

Design a Hard Disk Layout

Superblock:
A superblock is a block on each filesystem that contains metadata
information about the filesystem layout
nsize,and
o
The information contained in the block includes the type,
i
t
a
status of the mounted filesystem
c
i
f
m
i
The superblock is the Linux/Unix equivalent to Microsoft
o
t
FAT
c
r
.
e
d holding the
table, which contains the information about the
a
C blocks
c
a
x
top-level directory
k
u
b
.
n is wimportant, Linux
Since the information about the filesystems
i
L /ww
filesystems keep redundant copies Iof the :superblock
that may be
/
used to restore the filesystem should
corrupt
t tp
LP ithbecome

Design a Hard Disk Layout

Master Boot Record (MBR):


very small program that contains information about your hard disk
partitions and loads the operating system.
n and is
o
This program is located in the first sector of the hard disk
i
t
a
512 bytes.
c
i
f
m boot
i
If this file becomes damaged, the operating system
o
t
cannot
c
r d.
e
Therefore, it is important to back up the MBR
a you can
Cso that
c
a
x
k
replace a damaged copy if needed
u
b
.
n
w
Example of such a backup command:Li
w
I
/w
/
:
LP http
To restore:

Design a Hard Disk Layout


Booting from a USB device:
Linux may be booted from a Live USB, similar to booting from a
Live CD.
One difference between booting to the USB opposed to the CD is
that the data on the USB device may be modified and stored
back
n
io
onto the USB device.
t
a
c
In order to boot from the USB device, you will need
fi to: m

i
t
er

o Make the USB device bootable: This requires setting up .at


co least one
ad
partition on the USB with the bootable flag set to the cprimary
partition.
a
k
o An MBR must also write to the primary partition on
the
b USB.
.
w create live USB
o There are many applications that can be usedwto
w Creator and Ubuntu
distributions of Linux, including Fedora Live://USB
tp CentOS.
Live USB Creator, ISO2USB for Redhat tor
h
o The computer may also need the BIOS to be configured to boot from
USB.

I
P
L

x
u
n
i
L

Design a Hard Disk Layout


System role:
The role of the system should also dictate the optimal disk layout
Exp: Unix-style network with NFS file servers, most of the
workstations wont necessarily need all of their own executable
files. So reduce size of /home partition
n

Backup:

io
t
a
c
fi

Using the dd command, you can back up each tof


m
i the cindividual
o
r upd. the entire
partitions. The command may also be used toeback
C aca
hard drive.
x bk
u
. would issue the
To back up a hard drive to another hardindrive, wyou
w
L
following command, where if=/dev/hdx
represents
the hard drive
w
I
/
:/
P
you want to back up and of=/dev/hyd
represents
the target or
p
t
t
L
h
destination drive of the backup

Design a Hard Disk Layout

Backup:
Backup of the partition layout:

Restore the partition table:

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Design a Hard Disk Layout

Swap Space (virtual memory):


Used to temporarily store portions of main memory containing
programs or program data
n of
o
Size of the systems swap space to be double the amount
i
t
a
physical RAM in the machine.
c
i
f
m
i
Exp: if your system has 512 MB of RAM, it wouldt be reasonable
o
to
c
r
.
e
set your swap size to at least 1 GB
ad
C

I
P
L

c
a
x
k
u
b
.
n
i
ww
L
w

//
:
tp
t
h

Design a Hard Disk Layout


General Guidelines:
Keep the root filesystem (/) simple by distributing larger portions of the
directory tree to other partitions. A simplified root filesystem is less likely to be
corrupted.
Separate a small /boot partition below cylinder 1024 for installed kernels used
by the system boot loader.
Separate /var : big enough to handle your logs, spools, and mail, taking their
rotation and eventual deletion into account.
m
o
Separate /tmp: Its size depends on the demands of the applications
you run.
c
.
dbuilding. Making
Separate /usr and make it big enough to accommodate kernel
a
c
a
it standalone allows you to share it read-only via NFS.
k
b
.
Separate /home for machines with multiple users or any
machine where you
w
w
dont want to affect data during distribution softwarewupgrades.
For even better
/
:/ on a disk array and use
performance (for multiuser environments), put /home
p
t
Logical Volume manager (LVM).
ht
Set swap space to at least the same size (twice the size is recommended) as
the main memory.

I
P
L

x
u
n
i
L

i
t
er

n
o
i
t
a
c
fi

Install a Boot Manager


Boot Processing in Linux consists 2 basic phases:
Run the boot loader from the boot device
o It is the boot managers job to find the selected kernel and get it
loaded into memory, including any user-supplied options.
Launch the Linux kernel and start processes
n
o
ti loaders
o Your boot loader starts the specified kernel. The aboot
ic placed
job at this point is complete and the hardwareifis
under
m
o and begins
tup shop
c
r
the control of the running kernel, which sets
.
e
C acad
running processes.

Boot Loader:

LILO (Linux Loader)


I
P
Grub (GRand Unified Bootloader)
L

x bk
u
.
n
w
i
w
L
w

//
:
tp
t
h

Install a Boot Manager

LILO
The LILO is a small utility designed to load the Linux kernel into
memory and start it
n
o
Consists of two parts:
i
t
a
o The boot loader:
c
i
f
m
i
o
t
o The lilo command: used to install and configure
c
r d.
e
o the LILO boot loader
C aca

I
P
L

x bk
u
.
n
w
i
w
L
w

//
:
tp
t
h

Install a Boot Manager

Grub
GRUB is a multistage boot loader, much like LILO.
More flexible than LILO, as it includes support for booting arbitrary
n
o
kernels on various filesystem types and for booting several
i different
t
a
operating systems.
c
i

i f com
t
r d.
e
a
C

I
P
L

c
a
x
k
u
b
.
n
i
ww
L
w

//
:
tp
t
h

Manage Shared Libraries


When a program is compiled under Linux, many of the functions

required by the program are linked from system libraries that handle
disks, memory, and other functions.
Exp: when the standard C-language printf() function is used in a
program, the programmer doesnt provide the printf() source code, but
n such
instead expects that the system already has a library containing
o
i
t
functions
a

Link Type:

c
i
f
m
i
o
t
c
e r d.

Statically linked:
a
o Stands alone, requiring no additional code at runtimeac
bk concurrently
o Wasted memory when many different programs running
.
w
contain the same library functions
w
//w
Dynamically linked
:
tp
t
h library code in memory
o Allows multiple programs to use the same
o Dynamically linked libraries are shared among many applications and
are thus called shared libraries

I
P
L

x
u
n
i
L

Manage Shared Libraries

Shared Library Dependencies


Ldd command: Display shared libraries required by each of the
programs

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


The Red Hat Package Manager is among the most popular
methods for the distribution of software for Linux and is
installed by default on most distributions.
RPM automates the installation and maintenance of
n
software packages
o
i
t
a
c
Built into each package are program files, configuration
i
f
m
i
files, documentation, and dependencies onrt other.copackages
e
d
a
C
c
RPM packages have four common elements:
a
x
k
u
b
.
Name
n
w
i
w
L
Version
I
//w
Revision
Architecture

LP

:
tt p
h

Use Red Hat Package Manager (RPM)


RPM Command:
Provides for the installation, removal, upgrade, verification, and
other management of RPM packages

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Install/upgrade mode

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Uninstall mode

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Query mode
o Installed packages and raw package files can be queried using
the rpm -q command

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Query mode

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Query mode

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Query mode

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Red Hat Package Manager (RPM)


RPM Command:
Verify mode
o Files from installed packages can be compared against their
expected configuration from the RPM database by using rpm -V.

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

YUM Overview

YUM (Yellowdog Updater Modified) is a package manager


offering a fast way for installing, updating, and removing
packages
n
o
i functions
The yum command has a very simple interfaceatand
c
i
similar to rpm
f
m
i
o
t
c
r d. for you
e
yum additionally manages all of the dependencies
C aca
k
Yum has the ability to support multipleuxrepositories
for
b
.
n
w
i
packages
w
L
I
/w
/
:
YUM is configured through theLP/etc/yum.conf
configuration
tp
t
h
file.

YUM Overview

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

YUM Overview

You can also check to see if a particular package is installed


or available for install using the list command

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

YUM Overview

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

YUM Overview

I
P
L

i
t
er

n
o
i
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Debian Package Management


Debian Package Management Overview
Each Debian package contains program and configuration files,
documentation, and noted dependencies on other packages
The names of Debian packages have three common elements,
including:
n

o Package name
o Version number
o File extension

I
P
L

i
t
er

io
t
a
c
fi

a
x
k
u
b
.
n
ww
Li
w

//
:
tp
t
h

d
a
c

.c o

Use Debian Package Management


Managing Debian Packages
The original Debian package management tool is dpkg
The alternative apt-get (Advanced Package Tool) tool operates
using package names, obtaining them from a predefined source
(such as CD-ROMs, FTP sites, etc.)
n
o
The dselect command offers an interactive menu thattiallows the
a
c
i and
administrator to select from a list of available packages
mark
f
m
i
o
t
them for subsequent installation
c
r
.
e
d
a
alian: Convert to or install a non-Debian (or C
alien)
package
as
c
a
rpm
ux .bk

I
P
L

n
i
L

:
tt p
h

w
w
//w

Вам также может понравиться