Linux Basics (v): Packages

Source: Internet
Author: User

I. Introduction to package Management(a) Package Classification 1, source package: (mostly c,c++)
    • Script installation Package
2, binary package (source after compiling, Linux installation is basically binary package)
    • RPM Package (Redhat system only)
    • System Default Package
(ii) Source code package 1, Advantages:
    • Open source, you can modify the original code
    • You have the freedom to choose the features you want
    • Software is compiled and installed, more stable and more efficient
    • Easy to uninstall (delete the source package installation files)
2. Disadvantages
    • More installation steps, error prone
    • Long compile time, longer than binary installation
    • Compile and install, the installation process when the novice error is difficult to solve
(iii) Binary package 1, advantages
    • Package management system is simple, only need a few commands to implement package installation, upgrade, query, uninstall.
    • The installation speed is fast because it has been compiled.
2. Disadvantages
    • Can't see the source code
    • Function selection Step into the source package flexible
    • Dependencies, a relies on B to rely on C, and the order of installation uninstallation needs to be correct

Second, rpm command management(i) RPM package naming principles and dependencies 1, naming rules: httpd-2.2.15-39.el6.centos.x86_64.rpm, Package full name
    • HTTPD: Package Name
    • 2.2.15: Version
    • 39: Number of software releases
    • El6.centos: the right Linux platform
    • X86_64: the right hardware platform
    • RPM:RPM Package Extension
2. Dependence
    • Tree-dependent: a-->b-->c
    • Ring-dependent: a-->b-->c-->a
    • Module dependency: Query site, www.rpmfind.net
      • So.2 end, belong to the library dependency, need to go to www.rpmfind.net query belongs to what package.
(ii) installation upgrade and uninstall 1, package name and package full name
    • Package full Name: Operate the package that is not installed, and note the path.
    • Package Name: Operate a package that has already been installed. is to search for a database in/var/lib/rpm/.
2, RPM installation1) Syntax:
    • RPM-IVH Package full Name
      • -I (Install): Installation
      • -V (verbose): Show details
      • -H (hash): Show progress
      • --nodeps: No dependency x detection, recommended detection dependency
2) Example
    • Mount Processing:
      • New mount point: mkdir mnt/cdrom
      • Mount Processing: mount-t iso9660/dev/sr0/mnt/cdrom
    • Installation
      • RPM-IVH httpd-2.2.15-39.el6.centos.x86_64.rpm
      • You need to use the full name of the package, you can use the TAB key
      • Because there is dependence, so more trouble (almost want to die). You need to use the Yum command to resolve

3, RPM upgrade 1) Syntax:
    • RPM-UVH Package full Name
      • -U (upgrade): Upgrade
4, uninstall 1) Syntax:
    • RPM-E Package Name
      • -E (Erase): Uninstall
      • --nodeps: Do not check for dependencies
2) Note
    • RPM-E httpd
      • Use the package name because it is the search background database.

(iii) RPM query1, query whether to install1) Syntax:
    • rpm-q Package Name: Whether the query package is installed
      • -Q: Query
    • RPM-QA: Query all installed RPM packages
      • -A (All): all
2) Example
    • Rpm-q httpd: Query httpd for installation
      • Rpm-qi httpd: query httpd details, I is more information
    • RPM-QA: Lists all
      • Rpm-qa | grep httpd: All search queries and then use pipe breaks to retrieve
2. Query Package Details1) Syntax:
    • Rpm-qi Package Name
      • -I: Querying software information
      • -P: Query does not install package information, add package full name
2) Example
    • Rpm-qi httpd: Query httpd details
    • RPM-QIP httpd-2.2.15-39.el6.centos.x86_64.rpm: Query for package information that is not installed
3) RPM package when the package is set up, it is OK. So you can query for information that is not installed, where installation rules are not installed, and so on。

3, Query the package file installation location1) Syntax:
    • RPM-QL Package Name
      • -L: List
      • -P: Query does not install package information, add package full name
2) Example
    • RPM-QL httpd: Query httpd
    • RPM-QLP httpd-2.2.15-39.el6.centos.x86_64.rpm: Query for package information that is not installed

4, the query system files belong to which RPM package1) Syntax:
    • RPM-QF System file name
      • -F: Query which package the system file belongs to (file)
2) Example
    • RPM-QF Man.config
5, query the dependencies of the package1) Syntax:
    • RPM-QR Package Name
      • -R: Querying package Dependencies (requires)
      • -P: Querying for information about packages that are not installed
2) Example
    • RPM-QR httpd
    • RPM-QR httpd-2.2.15-39.el6.centos.x86_64.rpm

(d) Checksum file extraction 1, RPM package Check 1) Syntax:
    • rpm-v Installed package name
      • -V: Verifies the files in the specified RPM package (verify)
2) Example
    • Rpm-v httpd
3) Check whether the content is modified
    • 8 Content Information


    • File type


2. File extraction in RPM Package 1) Syntax:
  • Rpm2cpioPackage Full Name | Cpio-idv .  File absolute Path
      • Rpm2cpio : Convert RPM package to cpio Format command
      • Cpio: is a standard tool for creating documents and extracting files from archive files
        • Cpio "Options" < "files" "Devices"
          • -i:copy-in mode, restoring
          • -D: Automatically create a new directory when restoring
          • -V: Displays the restore process
      • One line cannot be lost, use "\"
2) Example



Third, yum online management(i) IP address configuration and network Yum source 1, IP address configuration 1) using the Setup tool:Setup2) Start the network card:Vi/etc/sysconfig/network-scripts/ifcfg-eth0
    • Change onboot= "No" to onboot= "yes"
3) Restart the Network service:Service Network Restart

2, network Yum source (default is easy to use) 1)LS/ETC/YUM.REPOS.D
    • Centos-base.repo, which is in effect by default
    • Centos-media.repo, no network, the CD is going to take effect.



2)Vi/etc/yum.repos.d/centos-base.repo
    • [Base]: container name, typically placed in ""
    • Name: Container description, you can write your own
    • Mirrorlist: Mirror site, this can be commented out
    • BaseURL: The address of our Yum source server. The default is the official CentOS Yum source server, which is available for use. can also be modified into domestic, the speed will be relatively fast.
    • Enabled: Whether this container is in effect, if not written or written emabled=1 are effective, written enabled=0 is not effective.
    • Gpgcheck: If 1 refers to the RPM digital certificate is in effect, 0 is not valid.
    • Gpgkey: The public key file where the digital certificate is saved. Without modification.



(ii) Yum Command 1, query 1) Yum List: Query all available Packages list
    • Query from a remote server, provided that Linux can connect to the Internet. is the network Yum source configured address.
    • Yum List | MORE: Split screen display
2) Yum search + keywords: Search all and keyword-related packages on the server
    • Yum Search httpd: Searching for httpd packages
2, Installation: 1) Syntax:yum-y Install + package name
    • Install: Installation
    • - y: Auto Answer Yes
2) Example:
    • Yum-y Install GCC:GCC is a C language editor, when installing the source package, you must have GCC.
    • Rpm-q GCC: See if it's installed.
3. Upgrade:yum-y Update + package name
    • No packages, all upgrades, including the Linux kernel will be upgraded (will be dead)
4. Uninstall:yum-y Remove + package name
    • No package, cascade Delete, will be problematic.
    • Do not use Yum to upgrade and uninstall, not secure.
5. Yum Software Group Management commands
    • Yum grouplist: List of all available software groups
    • Yum Groupinstall + software group name : Install the specified software group, the group name can be queried by grouplist
    • Yum Groupremove + software group name : Uninstall the specified software group

(iii) CD-ROM Yum source 1, Step 1) Mount Disc
    • New mount point: mkdir mnt/cdrom
    • Mount Processing: mount-t iso9660/dev/sr0/mnt/cdrom
2) Modify the network Yum source failure:
    • Modify the suffix, such as change Centos-base.repo to Centos-base.repo.bak
      • Centos-base.repo, which is in effect by default
      • All the other changes.
      • Centos-media.repo, no network, disc yum source.
    • or enter the document, modify the effective sign, enabled=0
3) Modify the disc yum source file
    • Baseurl=file:///mnt/dcrom: The address is the Mount address of the disc and is defined by itself. Comment out the other Yum sources
    • Gpgcheck=1: Certificate Valid
    • Enabled=1: Effective




Iv. Source Package Management(a) Source code package and RPM Package Difference 1, the difference:
    • Differences before installation: conceptual differences
    • The difference after installation: different installation locations
2, RPM package installation location
    • Installed in the default location, manual modification is not recommended.



3. Source Package Installation Location
    • Installed in the specified location, typically:/user/local/software name/
4. Impact of different installation Locations 1) RPM Package Installation Services can be managed using the System Service Management Command (service), such as the boot method for the Apache of the RPM installation package is
    • /ETC/RC.D/INIT.D/HTTPD start: Starting in absolute path
    • service httpd start: Managing with service commands
      • Service Network Restart,reahat specific commands
      • Service: Is fixed to the default path of the system to find, does not search the local path
      • So only the RPM package can be managed
2) The source package can only use the absolute path for service management:
    • /user/local/apache2/bin/paachectl start
(ii) Source package installation process: slightly
v. Script installation package(i) Script installation package 1, Introduction:
    • The script installation package is not a standalone package type, the common installation is the source package
    • The installation process has been written to the automatic installation of the script, as long as the execution of the script, define simple parameters, you can complete the installation.
    • Very similar to how software is installed under Windows
2, the role of Webmin
    • Webmin is a Web-based Linux system management interface. You can set up user accounts, Apache, DNS, file sharing and other services in a graphical way.
3. Webmin installation process
    • du -sh webmin-1.610: Viewing size



Linux Basics (v): Packages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.