Software management in linux


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Software management in linux

  1. 1. Installing and managing Linux software<br />Amir khakshoor<br />
  2. 2. package<br />What is a package?<br />When Linux developers create their software they typically bundle all the executable and data files into a single file called a "package" file. <br />Type of packages in software context:<br />source code packages : suite of files related to one program: source code, documentation, and configuration files.<br />Binary packages: source code packages that have been configured for a particular Unix variant or package manager program. <br />
  3. 3. Software package<br />Packages have different formats <br />Packages contain different control files <br />Where the rest of the files should be placed<br />The permissions they should have <br />A list of prerequisite packages that are required for the package to function correctly<br />
  4. 4. Main Package Formats in Linux<br />Packages Distributed in Binaries or Source Code form<br />Main Package Management Standards<br />RPM (RedHat Package Manager) (.rpm)<br />Introduced by RedHat and has been adopted by many other distributions (Fedora, Mandrake, SuSe) . <br />The most popular Linux package format<br />DEB (Debian Package Manager) (.deb)<br />Introduced by Debian distribution <br />Tarball files (.tar.gz/.tar.bz2)<br />The old-fashioned way of distributing software in Linux/Unix<br />Compatible with all distros<br />4<br />
  5. 5. Package management system<br />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}<br />Functions:<br />Verifying file checksums to ensure correct and complete packages.<br />Verifying digital signatures to authenticate the origin of packages.<br />Applying file archivers to manage encapsulated files.<br />Upgrading software with latest versions, typically from a software repository.<br />Grouping of packages by function to help eliminate user confusion.<br />Managing dependencies to ensure a package is installed with all packages it requires.<br />
  6. 6. Package management system(continue)<br />Repositories: give users more control over the kinds of software that they are allowing to be installed on their system<br />Package formats: Each package manager relies on the format and metadata of the packages it can manage. <br />E.g. yum relies on rpm as a backend. <br />Common package management systems on: <br />Red Hat Linux systems : RPM, yum, apt4rpm.<br />Debian Linux systems : Aptitude<br />
  7. 7. Package management system(continue)<br />yum is better than RPM (why)?<br />install from network repositories<br />it can find and install dependent packages needed by the packages you request<br />In other words: resolve dependencies automatically.<br />
  8. 8. RPM Terminology<br />Naming convention: all package files are labeled with highly identifiable names.<br />{four-part name}<br />dash (-) or a period (.) to separate labels<br />Convention:<br /> name-version-release.architecture.rpm<br />E.g. kernel-smp-<br />
  9. 9. RPM Terminology(continue)<br />Table 2-1 Supported Architectures<br />
  10. 10. RPM Terminology(continue)<br />Architecture Compatibility :<br /> more recent architectures typically run software that targets older architectures within the same family; <br />E.g. a 686-class (Pentium II / III / IV) machine runs files within i386, i486, i586, and i686 RPM package files.<br />But: a 386-class (80386) machine runs files within i386<br />
  11. 11. RPM Terminology(continue)<br />Note:<br />noarch in architecture label:<br />indicates this is a special architecture such that the files in the package work on any architecture <br />Why? All files in package are interpreted scripts, not binary executables, or they are documentation.<br /> usually only the root user can install packages.<br />
  12. 12. Binary RPMs and Source RPMs<br />binary RPM: has been compiled for a particular architecture.<br />E.g., httpd-2.2.17-1.fc13.1.i686.rpm<br />platform-independent binary RPMs: noarch{Applications written in Perl, Python, or other scripting languages}<br />Source RPMs: <br />contain all the commands, usually in scripts, necessary to recreate the binary RPM.<br />you can recreate the binary RPM at any time.<br />
  13. 13. How login as another user?<br />su : Substitute (switch) User<br />Why? For installing software you need to be root! And so on. Without logging out! <br />How to use?<br />suuserid<br /> note: defaultuserid= root<br />
  14. 14. InstllingSoftware From RPM Files<br />There are generally two ways to install RPM files manually. <br />using a file previously downloaded to your hard drive<br />install the RPM from some sort of removable media such as a CD-ROM drive<br />Use command “rpm” to install (in other word =upgrade).rpm file<br />Most common usage:<br />rpm -Uhv package_file.rpm<br />14<br />
  15. 15. The RPM Command <br />rpm -Uvh is the command to install package <br />-U qualifier is used for updating an RPM to the latest version<br />-h qualifier gives a list of hash # characters during the installation <br />-v qualifier prints verbose status messages while the command is run<br />rpm command options in depth:<br />-i: installing specified Package(s)<br />-e : uninstalling (Erasing) specified Package(s)<br />-U :Upgrading= Erasing old one + Installing new one<br />-q : Query whether specifed package exist and installed or not<br />-V : Verifying Installed RPM Packages<br />15<br />
  16. 16. The RPM Command (continue) <br />Options to use with –ioption:<br />-v: print out verbose information as the command runs.<br />-h: print a series of hash marks, #, to provide feedback that the command is still running.<br />--excludedocs: ignore documentation In RPM<br /> --includedocs: reverse of --excludedocs. {Default Option}<br />--replacepkgs: replace, or reinstall, packages it may have already installed.{Fresh Start}<br />--replacefiles: Install package even if it replaces files from other packages<br />--force: A short hand for --replacepkgsand –-replacefiles<br />--nodeps: skip the dependencies check<br />--noscripts: skip running the pre- and post-installation scripts.<br />= --noscripts= --nopre+ --nopost<br />16<br />
  17. 17. The RPM Command (continue) <br />Options to use with –U option:<br /> all of options that can used by –i option.<br />Plus: <br />--oldpackage: install an older version of a package on top of a more recent one.{downgrade}<br />Why installing an old one?<br />Some bug or security vulnerability<br />Newer one won't work with some other package<br />17<br />
  18. 18. The RPM Command (continue) <br />Options to use with –q option:<br /> --whatprovides [capability] : what package provides the specified capability. e.g. webserver<br />Or : trace individual files: which package provides specified file.<br />-i: Detailed information about specified package(s)<br />-l: list files that are bundling in specified package<br />--scripts: lists the scripts associated with a package.<br />Note: RPM database itself is stored in the directory /var/lib/rpm/<br />18<br />
  19. 19. RPM command example<br />19<br />[root@bigboytmp]# rpm -Uvh mysql-server-3.23.58-9.i386.rpm<br />Preparing... ####################### [100%]<br /> 1:mysql-server ####################### [100%]<br />[root@bigboytmp]#<br />
  20. 20. RPM Installation Errors <br />Sometimes RPM installations will fail giving Failed dependencies errors which really mean that a prerequisite RPM needs to be installed<br />To get around this problem by run the rpm command with the --nodepsoption to disable dependency checks<br />20<br />[root@bigboytmp]# rpm -Uvh--nodeps mysql-3.23.58-9.i386.rpm <br />
  21. 21. Yum (Yellowdog Updater, Modified)<br />YUM adds automatic updates and package management, including dependency management, to RPM systems.<br />Can works with repositories too.<br />
  22. 22. Automatic Updates with yum <br /> The yum automatic RPM update program comes as a standard feature of Fedora Core. It has a number of valuable features: <br />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. <br />yum makes multiple attempts to download RPMs before failing. <br />yum automatically figures out not only the RPMs packages that need updating, but also all the supporting RPMs. It then installs them all.<br />22<br />
  23. 23. Working With yum.<br />Search for a package when you know the name:<br />$ yum list 'foo‘<br />Search for a package when you're not sure of the name{using REGX}<br />$ yum search 'foo*'<br />$ yum search '*foo?'<br />install and remove a package or multiple packages: <br /># yum install 'foo'<br /># yum remove 'foo'<br /># yum install 'foo fie fofum'<br /># yum remove 'foo fie fofum'<br />Update an installed package:<br /># yum update 'foo'<br />
  24. 24. Working With yum.(continue)<br />List available updates for installed packages:<br /># yum list updates<br />Update the whole system:<br /># yum update<br />Find out which package a file belongs to:<br />$ yum provides ‘httpd.conf‘<br />See package groups for installing big clumps of stuff at once. And install, update and remove them.<br />$ yum grouplist<br /># yum groupinstall 'FTP Server'<br /># yum groupupdate 'FTP Server'<br /># yum groupremove 'FTP Server'<br />
  25. 25. Installing Software From DEB Files<br />Unlike Redhat or Frdora,theDebian and Ubuntu versions of Linux rely on packages in the DEB format<br />Use dpkg --install command to install the .deb package<br />25<br />root@u-bigboy:~# dpkg--install ndiswrapper-utils_1.8-0ubuntu2_i386.deb<br />Selecting previously deselected package ndiswrapper-utils.<br />(Reading database ... 70221 files and directories currently installed.)<br />Unpacking ndiswrapper-utils(from ndiswrapper-utils_1.8-0ubuntu2_i386.deb) ...<br />Setting up ndiswrapper-utils(1.8-0ubuntu2) ...<br />root@u-bigboy:~#<br />
  26. 26. Compiling Software from Source Code<br />What Compiling means?<br />source code packages usually packaged in the tarball format.<br />tarball? nickname for compressed archives created by the tar program<br />Common file extension*.tar.gz or *.tgz. <br />Why Use source code in tarball files?<br />Compatible with all Linux distributions<br />
  27. 27. Compiling Software from Source Code(continue)<br />Using Tar utility<br />archive a directory with tar:<br />$ tar -cf tarredfilename.tar Feather<br />Add –v option to get a verbose description<br />Unarchiving Files with tar:<br />$ tar -xf labrea.tar<br />unarchive selected files with tar:<br />$ tar -xf labrea.tar mammoth<br />List files in an archiving without actually unarchiving the file:<br />$ tar -tf filename <br />see the names of the files as they're extracted from the archive. <br />$ tar -xvf filename<br />
  28. 28. Compiling Software from Source Code(continue)<br />Installing from source code step by step:<br /> locate a source code package:<br />Unix software archive on the Web<br /> pick a consistent place to put them after download or transfer from a disk<br /> We suggest using the /tmp{why?}<br />You can also use the /usr/src directory,<br /> unpack the archive<br />$ tar xvffilename<br />Change directory to decompressed file directory<br />$ cd /tmp/filename<br />
  29. 29. Compiling Software from Source Code(continue)<br />You should see README or INSTALL file.<br />$ ls –ltr<br />Read README or INSTALL file. For instruction to Compile.<br />$ less README<br />less INSTALL <br />Follow these general steps:<br />Configuring the Package:<br />configure,,, or some similar script.<br />Configure script will run some tests on your machine.<br />Run this:<br /># ./configure<br />Output after running configure script: Makefile<br />Building the Package.{= begin to compile the software.}<br />Run this:<br /># make<br />
  30. 30. Compiling Software from Source Code(continue)<br />Installing the Package: install the executable binary file as an actual program.<br />Run this:<br /> $ make install<br />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<br />clean up:<br />$ rmdir /tmp/filename<br />
  31. 31. Where to get used Packages<br />Packages on Linux Installation CDs<br />Manually Downloaded Packages<br />two most common ways of getting packages are by manually using FTP or a Web browser<br />31<br />
  32. 32. Popular Package Download Sites<br />Redhat<br /> <br /> <br />Fedora<br /> <br /><br /><br />32<br />
  33. 33. Popular Package Download Sites<br />Debain<br /> <br />Ubuntu<br /> <br />33<br />
  34. 34. How to Download Software <br />Getting Software Using Web-Based FTP<br />Browse the desired Web site until you find the link to the software package. <br />Click on the link for the desired software package. <br />Save the file to hard drive <br />Getting RPMs Using Command-Line Anonymous FTP<br />34<br />
  35. 35. FTP Commands <br />Command Description <br />binary Copy files in binary mode <br />cd Change directory on the FTP server <br />dir List the names of the files in the current remote directory <br />exit Bye bye<br />get Get a file from the FTP server <br />lcd Change the directory on the local machine <br />ls Same as dir <br />mget Same as get, but you can use wildcards like "*" <br />mput Same as put, but you can use wildcards like "*" <br />passive Make the file transfer passive mode <br />put Put a file from the local machine onto the FTP server <br />pwd Give the directory name on the local machine <br />35<br />
  36. 36. How to Download Software<br />Getting software using wget <br />The wget command can be used to download files quickly when you already know the URL at which the RPM is locate<br /># wget<br />36<br />
  37. 37. Thanks for your patient.<br />Any Question?<br />Ask me now or<br />Later on by email:<br />