software management in linux

37
INSTALLING AND MANAGING LINUX SOFTWARE Amir khakshoor

Upload: nejadmand

Post on 19-May-2015

3.433 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Software management in linux

INSTALLING AND MANAGING LINUX SOFTWARE

Amir khakshoor

Page 2: Software management in linux

package

What is a package? When Linux developers create their software they typically

bundle all the executable and data files into a single file called a "package" file.

Type of packages in software context: source code packages : suite of files related to one program:

source code, documentation, and configuration files. Binary packages: source code packages that have been

configured for a particular Unix variant or package manager program.

Page 3: Software management in linux

Software package

Packages have different formats Packages contain different control files

Where the rest of the files should be placedThe permissions they should have A list of prerequisite packages that are required for

the package to function correctly

Page 4: Software management in linux

4

Main Package Formats in Linux

Packages Distributed in Binaries or Source Code form

Main Package Management Standards RPM (RedHat Package Manager) (.rpm)

○ Introduced by RedHat and has been adopted by many other distributions (Fedora, Mandrake, SuSe) .

○ The most popular Linux package format DEB (Debian Package Manager) (.deb)

○ Introduced by Debian distribution Tarball files (.tar.gz/.tar.bz2)

○ The old-fashioned way of distributing software in Linux/Unix○ Compatible with all distros

Page 5: Software management in linux

Package management system

Def: collection of software tools to automate the process of installing, upgrading, configuring, and removing software packages for a computer's operating system in a consistent manner.{= install manager}

Functions: Verifying file checksums to ensure correct and complete packages. Verifying digital signatures to authenticate the origin of packages. Applying file archivers to manage encapsulated files. Upgrading software with latest versions, typically from a software

repository. Grouping of packages by function to help eliminate user confusion. Managing dependencies to ensure a package is installed with all

packages it requires.

Page 6: Software management in linux

Package management system(continue)

Repositories: give users more control over the kinds of software that they are allowing to be installed on their system

Package formats: Each package manager relies on the format and metadata of the packages it can manage. E.g. yum relies on rpm as a backend.

Common package management systems on: Red Hat Linux systems : RPM, yum, apt4rpm.Debian Linux systems : Aptitude

Page 7: Software management in linux

Package management system(continue)

yum is better than RPM (why)?install from network repositoriesit can find and install dependent packages

needed by the packages you request○ In other words: resolve dependencies automatically.

Page 8: Software management in linux

RPM Terminology

Naming convention: all package files are labeled with highly identifiable names.{four-part name}dash (-) or a period (.) to separate labels

Convention: name-version-release.architecture.rpmE.g. kernel-smp-2.6.32.9-3.i686.rpm

Page 9: Software management in linux

RPM Terminology(continue)

Table 2-1 Supported Architectures

Page 10: Software management in linux

RPM Terminology(continue)

Architecture Compatibility : more recent architectures typically run software

that targets older architectures within the same family; ○ E.g. a 686-class (Pentium II / III / IV) machine runs files

within i386, i486, i586, and i686 RPM package files.○ But: a 386-class (80386) machine runs files within

i386

Page 11: Software management in linux

RPM Terminology(continue)

○ Note: noarch in architecture label:

- indicates this is a special architecture such that the files in the package work on any architecture

- Why? All files in package are interpreted scripts, not binary executables, or they are documentation.

usually only the root user can install packages.

Page 12: Software management in linux

Binary RPMs and Source RPMs

binary RPM: has been compiled for a particular architecture. E.g., httpd-2.2.17-1.fc13.1.i686.rpm

platform-independent binary RPMs: noarch{Applications written in Perl, Python, or other scripting languages}

Source RPMs: contain all the commands, usually in scripts,

necessary to recreate the binary RPM.you can recreate the binary RPM at any time.

Page 13: Software management in linux

How login as another user?

su : Substitute (switch) User Why? For installing software you need to be

root! And so on. Without logging out! How to use?

su userid○ note: default userid = root

Page 14: Software management in linux

14

Instlling Software From RPM Files There are generally two ways to install RPM

files manually. using a file previously downloaded to your hard

driveinstall the RPM from some sort of removable

media such as a CD-ROM drive Use command “rpm” to install (in other word

=upgrade).rpm fileMost common usage:

○ rpm -Uhv package_file.rpm

Page 15: Software management in linux

15

The RPM Command

rpm -Uvh is the command to install package -U qualifier is used for updating an RPM to the latest

version -h qualifier gives a list of hash # characters during the

installation -v qualifier prints verbose status messages while the

command is run rpm command options in depth:

-i : installing specified Package(s) -e : uninstalling (Erasing) specified Package(s) -U :Upgrading= Erasing old one + Installing new one -q : Query whether specifed package exist and installed or

not -V : Verifying Installed RPM Packages

Page 16: Software management in linux

16

The RPM Command (continue)

Options to use with –i option: -v: print out verbose information as the command runs. -h: print a series of hash marks, #, to provide feedback that the

command is still running. --excludedocs: ignore documentation In RPM --includedocs: reverse of --excludedocs. {Default Option} --replacepkgs : replace, or reinstall, packages it may have

already installed.{Fresh Start} --replacefiles : Install package even if it replaces files from other

packages --force: A short hand for --replacepkgs and –-

replacefiles --nodeps: skip the dependencies check --noscripts: skip running the pre- and post-installation scripts.

○ = --noscripts = --nopre + --nopost

Page 17: Software management in linux

17

The RPM Command (continue)

Options to use with –U option: all of options that can used by –i option.Plus:

○ --oldpackage: install an older version of a package on top of a more recent one.{downgrade}Why installing an old one?

- Some bug or security vulnerability- Newer one won't work with some other package

Page 18: Software management in linux

18

The RPM Command (continue)

Options to use with –q option: --whatprovides [capability] : what package

provides the specified capability. e.g. webserver ○ Or : trace individual files: which package provides

specified file. -i: Detailed information about specified package(s) -l: list files that are bundling in specified package --scripts: lists the scripts associated with a

package. Note: RPM database itself is stored in the

directory /var/lib/rpm/

Page 19: Software management in linux

19

RPM command example

[root@bigboy tmp]# rpm -Uvh mysql-server-3.23.58-9.i386.rpmPreparing... ####################### [100%] 1:mysql-server ####################### [100%][root@bigboy tmp]#

Page 20: Software management in linux

20

RPM Installation Errors

Sometimes RPM installations will fail giving

Failed dependencies errors which really mean

that a prerequisite RPM needs to be installed

To get around this problem by run the rpm

command with the --nodeps option to disable

dependency checks

[root@bigboy tmp]# rpm -Uvh --nodeps mysql-3.23.58-9.i386.rpm

Page 21: Software management in linux

Yum (Yellowdog Updater, Modified)

YUM adds automatic updates and package management, including dependency management, to RPM systems.

Can works with repositories too.

Page 22: Software management in linux

22

Automatic Updates with yum

The yum automatic RPM update program comes as a standard feature of Fedora Core. It has a number of valuable features: You can configure the URLs of download sites you

want to use. This provides the added advantage of you choosing the most reliable sites in your part of the globe.

yum makes multiple attempts to download RPMs before failing.

yum automatically figures out not only the RPMs packages that need updating, but also all the supporting RPMs. It then installs them all.

Page 23: Software management in linux

Working With yum.

Search for a package when you know the name: $ yum list 'foo‘

Search for a package when you're not sure of the name{using REGX} $ yum search 'foo*' $ yum search '*foo?'

install and remove a package or multiple packages: # yum install 'foo' # yum remove 'foo' # yum install 'foo fie fo fum' # yum remove 'foo fie fo fum'

Update an installed package: # yum update 'foo'

Page 24: Software management in linux

Working With yum.(continue)

List available updates for installed packages:# yum list updates

Update the whole system:# yum update

Find out which package a file belongs to:$ yum provides ‘httpd.conf‘

See package groups for installing big clumps of stuff at once. And install, update and remove them.$ yum grouplist# yum groupinstall 'FTP Server'# yum groupupdate 'FTP Server'# yum groupremove 'FTP Server'

Page 25: Software management in linux

25

Installing Software From DEB Files

Unlike Redhat or Frdora,the Debian and Ubuntu versions of Linux rely on packages in the DEB format

Use dpkg --install command to install the .deb package

root@u-bigboy:~# dpkg --install ndiswrapper-utils_1.8-0ubuntu2_i386.deb Selecting previously deselected package ndiswrapper-utils.(Reading database ... 70221 files and directories currently installed.)Unpacking ndiswrapper-utils (from ndiswrapper-utils_1.8-0ubuntu2_i386.deb) ...Setting up ndiswrapper-utils (1.8-0ubuntu2) ...root@u-bigboy:~#

Page 26: Software management in linux

Compiling Software from Source Code

What Compiling means? source code packages usually packaged in the

tarball format. tarball? nickname for compressed archives

created by the tar programCommon file extension*.tar.gz or *.tgz.

Why Use source code in tarball files? Compatible with all Linux distributions

Page 27: Software management in linux

Compiling Software from Source Code(continue)

Using Tar utilityarchive a directory with tar:

○ $ tar -cf tarredfilename.tar FeatherAdd –v option to get a verbose descriptionUnarchiving Files with tar:

○ $ tar -xf labrea.tarunarchive selected files with tar:

○ $ tar -xf labrea.tar mammothList files in an archiving without actually unarchiving the

file:○ $ tar -tf filename

see the names of the files as they're extracted from the archive. ○ $ tar -xvf filename

Page 28: Software management in linux

Compiling Software from Source Code(continue)

Installing from source code step by step: locate a source code package:

Unix software archive on the Web

pick a consistent place to put them after download or transfer from a disk We suggest using the /tmp{why?} You can also use the /usr/src directory,

unpack the archive $ tar xvf filename

Change directory to decompressed file directory $ cd /tmp/filename

Page 29: Software management in linux

Compiling Software from Source Code(continue)

You should see README or INSTALL file. $ ls –ltr

Read README or INSTALL file. For instruction to Compile. $ less README less INSTALL

Follow these general steps:○ Configuring the Package:

configure, configure.pl, configure.sh, or some similar script. Configure script will run some tests on your machine. Run this:

- # ./configure Output after running configure script: Makefile

○ Building the Package.{= begin to compile the software.} Run this:

- # make

Page 30: Software management in linux

Compiling Software from Source Code(continue)

○ Installing the Package: install the executable binary file as an actual program.

Run this:- $ make install- This command moves the binary into the proper directory

(outside of /tmp) and installs any required configuration or documentation files that were included in the archive

clean up:○ $ rmdir /tmp/filename

Page 31: Software management in linux

31

Where to get used Packages

Packages on Linux Installation CDs Manually Downloaded Packages

two most common ways of getting packages are by manually using FTP or a Web browser

Page 32: Software management in linux

32

Popular Package Download Sites

Redhathttp://www.redhat.com/ http://www.rpmfind.net/

Fedoraftp://download.fedora.redhat.com/pub/fedora/

linux/core/ http://download.fedora.redhat.com/pub/fedora/

linux/core/http://www.rpmfind.net/

Page 33: Software management in linux

33

Popular Package Download Sites

Debainhttp://packages.debian.org

Ubuntuhttp://packages.ubuntu.com

Page 34: Software management in linux

34

How to Download Software

Getting Software Using Web-Based FTPBrowse the desired Web site until you find the

link to the software package. Click on the link for the desired software

package. Save the file to hard drive

Getting RPMs Using Command-Line Anonymous FTP

Page 35: Software management in linux

35

FTP Commands Command Description binary Copy files in binary mode cd Change directory on the FTP server dir List the names of the files in the current

remote directory exit Bye bye get Get a file from the FTP server lcd Change the directory on the local machine

ls Same as dir mget Same as get, but you can use wildcards like

"*" mput Same as put, but you can use wildcards like

"*" passive Make the file transfer passive mode put Put a file from the local machine onto the FTP

server pwd Give the directory name on the local machine

Page 36: Software management in linux

36

How to Download Software

Getting software using wget The wget command can be used to download

files quickly when you already know the URL at which the RPM is locate

# wget http://linux.stanford.edu/pub//i386/RPMS/dhcp-3.0pl2-6.16.i386.rpm

Page 37: Software management in linux

Thanks for your patient. Any Question?

Ask me now or○ Later on by email: [email protected]