2. 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.
3. Software package Packages have different formats Packages contain different control files Where the rest of the files should be placed The permissions they should have A list of prerequisite packages that are required for the package to function correctly
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 4
5. 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.
6. 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
7. Package management system(continue) yum is better than RPM (why)? install from network repositories it can find and install dependent packages needed by the packages you request In other words: resolve dependencies automatically.
8. 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.rpm E.g. kernel-smp-2.6.32.9-3.i686.rpm
10. 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
11. 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.
12. 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.
13. 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? suuserid note: defaultuserid= root
14. InstllingSoftware From RPM Files There are generally two ways to install RPM files manually. using a file previously downloaded to your hard drive install the RPM from some sort of removable media such as a CD-ROM drive Use command “rpm” to install (in other word =upgrade).rpm file Most common usage: rpm -Uhv package_file.rpm 14
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 15
16. The RPM Command (continue) Options to use with –ioption: -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 --replacepkgsand –-replacefiles --nodeps: skip the dependencies check --noscripts: skip running the pre- and post-installation scripts. = --noscripts= --nopre+ --nopost 16
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 17
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/ 18
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 --nodepsoption to disable dependency checks 20 [root@bigboytmp]# rpm -Uvh--nodeps mysql-3.23.58-9.i386.rpm
21. Yum (Yellowdog Updater, Modified) YUM adds automatic updates and package management, including dependency management, to RPM systems. Can works with repositories too.
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. 22
23. 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 fofum' # yum remove 'foo fie fofum' Update an installed package: # yum update 'foo'
24. 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'
25. Installing Software From DEB Files Unlike Redhat or Frdora,theDebian and Ubuntu versions of Linux rely on packages in the DEB format Use dpkg --install command to install the .deb package 25 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:~#
26. 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 program Common file extension*.tar.gz or *.tgz. Why Use source code in tarball files? Compatible with all Linux distributions
27. Compiling Software from Source Code(continue) Using Tar utility archive a directory with tar: $ tar -cf tarredfilename.tar Feather Add –v option to get a verbose description Unarchiving Files with tar: $ tar -xf labrea.tar unarchive selected files with tar: $ tar -xf labrea.tar mammoth List 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
28. 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 xvffilename Change directory to decompressed file directory $ cd /tmp/filename
29. 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
30. 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
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 31
33. Popular Package Download Sites Debain http://packages.debian.org Ubuntu http://packages.ubuntu.com 33
34. How to Download Software Getting Software Using Web-Based FTP Browse 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 34
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 35
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 36
37. Thanks for your patient. Any Question? Ask me now or Later on by email: khakshoor.amir@gmail.com