0% found this document useful (0 votes)
37 views45 pages

102 - Linux Installation and Package Management

The document discusses Linux installation and package management. It covers allocating filesystems and partitions, filesystem types, installing boot managers like LILO and GRUB, and managing shared libraries. Key areas covered include partitioning schemes, formatting partitions, configuring swap space, mounting filesystems, and library locations and management.

Uploaded by

Legesse Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views45 pages

102 - Linux Installation and Package Management

The document discusses Linux installation and package management. It covers allocating filesystems and partitions, filesystem types, installing boot managers like LILO and GRUB, and managing shared libraries. Key areas covered include partitioning schemes, formatting partitions, configuring swap space, mounting filesystems, and library locations and management.

Uploaded by

Legesse Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

1

102: Linux Installation and


Package Management
2
102: Linux Installation and
Package Management
 Key knowledge areas
 Allocate filesystems and swap space to separate
partitions or disks
 Tailor the design to intended use of the system
 /boot partition, hardware architecture requirements for
booting,
3
102: Linux Installation and
Package Management
 At installation design your hard disk layout
 Data on devices such as hard disks are accessed randomly and

are called block devices.


 Linux device mapper framework allows the creation of virtual

block devices on which filesystems can be created.


 Virtual block devices: encrypted drives, raid devices

 Logical Volume Manager – provides a method to install

bootable system with a root partition on a logical volume.


 Most Linux releases are aware of LVM.
4
102: Linux Installation and
Package Management
Hard Drive Partitions
 X86 machines HD only supported 4 partitions
 To overcome 4 partition limitation, backward

compatible mechanism was created to enable one of


the partitions to be extended partition.
 Thus: 3 primary partitions
 1 Extended partition (in this, multiple
logicals)
 Only extended partitions allow creation of many

logical partitions.
5
102: Linux Installation and
Package Management
Hard Drive Partitions
6
102: Linux Installation and
Package Management
Hard Drive Partitions – PATA (Parallel ATA)
Physical location Device Name

Primary Master hda

Primary Slave hdb

Secondary master hdc

Secondary slave hdd


7
102: Linux Installation and
Package Management
Hard Drive Partitions – Partitions
Device Name Description

hda1 First Primary Partition

hda1 Second Primary Partition

hda3 Third Primary Parttiion

hda4 Extended Partition

hda5 First Logical Partition


** Logical partitions always start
from 5,
hda6 Second Logical Partition

… …
8
102: Linux Installation and
Package Management
Hard Drive Partitions – common partitioning
schemes for smaller systems
Partition Descrition

/boot 50 – 100MB, 1st partition

Swap Swap space, virtual memory

/ Root file system, containing rest of


LINUS OS, and should be allocated
rest of remaining space.
9
102: Linux Installation and
Package Management
Hard Drive Partitions – Larger Systems
Partition Descrition
/boot 100 – 250MB, for modern computers that
do not have 1024 cylinder limitation

Swap Swap space, virtual memory


/home - User data and documents kept
- Protect kernel filesystem from running
out of space
- Easier to back up data
/usr Contains user application
/var Log files, can rapidly fill up disk space

/tmp Houses all temporary files.


/ Remainder of the filesystem
10
102: Linux Installation and
Package Management
Hard Drive Partitions – partitioning using fdisk
#fdisk /dev/hda - takes block device as parameter
11
102: Linux Installation and
Package Management
Hard Drive Partitions – partitioning using fdisk
12
102: Linux Installation and
Package Management
Hard Drive Partitions – partitioning using fdisk
#fdisk /dev/hda - takes block device as parameter
 To create a new partition, press “n” from prev. menu

 Pressing “p”, assuming you have not created max. number of


primary partitions
13
102: Linux Installation and
Package Management
Hard Drive Partitions – partitioning using fdisk
 Then you have to decide what type of partition, for

this pressing “l” will give a list of partition types:

 Options 82, and 83 are used to create virtual block


devices.
14
102: Linux Installation and
Package Management
Formatting Partitions with Filesystems
 ext2 – the oldest and most well supported filesystem

on Linux machines.
 ext3 - an extension of the ext2 filesystem which

adds journaling support


 reiserfs - an enhanced journaling filesystem written

by Hans Reiser
15
102: Linux Installation and
Package Management
Managing swap space
 Swap space does not contain a file system but is accessed

in raw mode by the Linux kernel.


 After creating the disk partition to be used as swap space ,

you will need to activate it with


e.g. swapon /dev/sda2
 During system installation this will be done automatically

for you. Information on the swap partition can be


displayed with swapon.
e.g swapon -s # Display the available swap partitions
16
102: Linux Installation and
Package Management
Mounting File system Partitions
 After a partition has been prepared, it has to be

brought for use.


 Mount point, a point in which the new partition is

accessed through
17
102: Linux Installation and
Package Management
2. Installing boot manager
 A boot loader is in the MBR, system loads what is in the MBR to

RAM.
 In Linux there are two boot loaders:
 Lilo: LInux LOader.
 Grub: Grand Unified Boot Loader.
 Boot loaders allow selection of images one would like to boot

from.
 GRUB is today's default boot loader for many distributions.
 When installing Windows with Linux, install Windows first and

Linux second, because Windows overwrites the MBR without


asking , which first stage boot information is lost.
18
102: Linux Installation and
Package Management
2. Installing boot manager
LILO Boot Loader
 Older boot manager, now replaced by GRUB
 Can be configured in /etc/lilo.conf
19 102: Linux Installation and
Package Management, LILO …
contd
20
102: Linux Installation and
Package Management
2. Installing boot manager
GRUB Boot Loader
 It is a boot loader, capable of loading a variety of

free and proprietary operating systems, so well


works with Linux, DOS, Windows or BSD.
 Dynamically configurable
 Can be installed to any devices (floppy, CD-ROM,

USB drive, network drive), and can load operating


systems from just as many locations.
21
102: Linux Installation and
Package Management
2. Installing boot manager
GRUB Boot Loader … contd.
 It has 3 stages, with stage 1 – the usual job of primary boot

loader, plus it loads stage 1.5


 Stage 1.5 understands a particular file system, ext2, ext3 or

reiserfs, and after loading this loads 2nd boot loader.


 $grub-install #installs grub loader

/boot/grub/grub.conf
/boot/grub/menu.lst Files we edit to
configure
Grub uses hdx – to refer to hard grub
disks irrespective of
PATA/SATA, e.g. hd0
22
102: Linux Installation and
Package Management
2. Installing boot manager
GRUB Boot Loader … contd.

Sample of a
grub
configuration
file
23
102: Linux Installation and
Package Management
3. Manage Shared Libraries
Key knowledge areas
 identify shared libraries
 Identify the typical locations of system libraries
 Load shared libraries
24
102: Linux Installation and
Package Management
3. Manage Shared Libraries
Introduction
 A library is a set of functions that programs can use to implement

their functionalities.
 When building a program, those libraries can be statically(the

program having its own library) or dynamically (loaded when


program executes lib.so)
 Application developers make use of existing libraries to provide

needed functionality to their applications.


 Build applications with required lib compiled into the

application
 Dynamically link required dependency at run time.
25
102: Linux Installation and
Package Management
3. Manage Shared Libraries
Introduction … contd
 Trusted library file locations in Linux
 /lib – used mainly by /bin programs
 /usr/lib – used mainly by /usr/bin programs
 Additional locations for library files can be
specified in the /etc/ld.so.conf file. This file in turn
include all files under /etc/ld.so.confi.d/ directory
 $ldconfig – command creates fast caches at

/etc/ld.so.cache to optimize loading


26
102: Linux Installation and
Package Management
3. Manage Shared Libraries
The ldd command
 Shows statically or dynamically linked libraries to

applications
e.g. $ldd /usr/sbin/apache2
27
102: Linux Installation and
Package Management
3. Manage Shared Libraries
The LD_LIBRARY_PATH
 Used to override the default search path for dynamic libraries.

 Where you need to use it:


 For applications you have installed from source.
 Testing out for latest version of a library
 If the application relies on an older version of a library

 this adds libraries to a search path.


28
102: Linux Installation and
Package Management
4. Debian Package Management
Key knowledge areas
 Install, upgrade and uninstall Debian binary

packages
 Find packages containing specific files or libraries

which may or may not be installed


 Obtain package information like version,

dependencies, package integrity and installation


status (installed? Or not installed?)
29
102: Linux Installation and Package Management
4. Debian Package Management

Key knowledge areas


 Install, upgrade and uninstall Debian binary

packages
 Find packages containing specific files or libraries

which may or may not be installed


 Obtain package information like version,

dependencies, package integrity and installation


status (installed? Or not installed?)
30
102: Linux Installation and Package Management
4. Debian Package Management

Introduction
 There are two main package management system in

use today:
 RPM package manager – distributions derived from
Redhat
 DPKG manager – distributions derived from Debain
 The debian system is more strict and configurable
than the RPM system and is used by Debian
derivative such as Ubuntu.
31
102: Linux Installation and Package Management
4. Debian Package Management … contd.

Package Naming
Debain package names are formed as follows
name_version-release_architecture.deb
 e.g. xxchat_2.8.6-4ubuntu5_amd64.deb
 Release number – which debian release
 Architecture – a computer architecture (i386, sparc, all)
dpkg
 Command tool used to manage Debian Packages
 Provide package information about: status, selection

states, & flags


32
102: Linux Installation and Package Management
4. Debian Package Management … contd.

dpkg … contd
33
102: Linux Installation and Package Management
4. Debian Package Management … contd.

dpkg … contd
34
102: Linux Installation and Package Management
4. Debian Package Management … contd.

dpkg … contd
Actions
Action Description
-l Print list of files
-s Shows information about a particular installed package

-L List packages included in a package


-i Install package, .deb
--unpack Unpack a .deb package only
--configure Configre unpacked package
-r Remove a file, but leave configuration files
35
102: Linux Installation and Package Management
4. Debian Package Management … contd.

dpkg … contd
Options
Option Description
--force-thing Force dpkg, force-depends, force-downgrade

--refuse-thing Refuse to do something,

--ignore- Ignore depedencychecking


depends
--no-act Show what dpkg would do, simulate
--R Recursive, with –i or --simulate
36
102: Linux Installation and Package Management
4. Debian Package Management … contd.
APT
 dpkg tool is fine for installing individual packages with no dependencies, for

such packages apt tool is used instead


 apt provides easy way to installing and updating system
 Controlled by two files:
 /etc/apt/apt.conf – contain proxy address, which Debian releases to install
 /etc/apt/sources.list – lists sources of Debian files, which may be CD, or

on the network
 Once those two files are configured, two command tools are used for

package management, apt-cache, and apt-get


37
102: Linux Installation and Package Management
4. Debian Package Management … contd.
APT … contd.
 apt-cache
 search: searching for available packages, given a string
 e.g: #apt-cache search skyp, could return skype
 show: shows full description of a package,
 e.g: #apt-cache show skype
 apt-get
 update: update list of packages
 install <pkgname>: install a package, #apt-get install skype
 upgrade: upgrade any packages which have newer versions
 dist-upgrade: upgrade entrire distribution
 remove <pkgname>: remove specified package,
 alien tool: converts rpm package to deb, and vice-versa
 e.g. #alien --to-rpm package.deb
38
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Manament


Key knowledge areas
 Install, reinstall, upgrade and remove packages using

RPM and YUM


 Obtain information on RPM packages
 Determine what files a package provides
39
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Manament … contd.


 Some Linux distribution uses rpm “Red Hat Package

Manager” for all its distribution software.


 Package naming:
 name-version-release.architecture.rpm
 Architecture: i386, ia64, noarch

Major and Minor Modes


First option given to rpm is major mode, what ever comes
not as first option is a minor mode.
40
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Manament … contd.


 Major mode options
41
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Management … contd.


 Minor mode options
42
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Manament … contd.


 Query modes
43
102: Linux Installation and Package Management
4. Debian Package Management … contd.

RPM and YUM Package Manament … contd.


 Some examples [package name: routed-0.17.i386.rpm ]
 Query a package to see its contents before installation
 #rpm -qpl routed-0.17.i386.rpm
 Install this package
 #rpm –i routed-0.17.i386.rpm
 Query the installed package
 #rpm –ql routed
 Query which package installed the file: /usr/sbin/routed
 $rpm –qf /usr/sbin/routed
44
102: Linux Installation and Package Management
4. Debian Package Management … contd.

YUM package Manager


 Default package manager for many rpm based dists

 It is as apt package manager for Debian based dists, thus installs

with out worrying to dependencies


 yum install: installs package

 #yum install tsclient

 yum groupinstall – installs all related packages

 #yum groupinstall “mysql database


 #yum update – updates package lists

 #yum search PalmPilot – searches for package

 #yum remove tsclient – remove tsclient package

 #yum groupremove “mysql database” – remove related pkgs

You might also like