Linux Foundation III (software Installation management)

Source: Internet
Author: User
Tags pack

Directory:

I. Classification of software packages in Linux

1. Source Code Package

2. Binary Package

3. Source code Package

4. Selection of software Installation

Second, the software installation of RPM

1. Background knowledge

2. Preparation of knowledge

3. Install Upgrade and Uninstall

4. Query check and extract

first, the classification of software packages in Linux:1. Source Code Package1.1 Introduction to the source package

Source package is a variety of source code files from a combination of compressed package, because Linux is open source, the source code in the package can be viewed or even modified, the user can be installed according to their own functions. But the source package needs to be compiled when it is installed, that is, compiling the machine language from the source code, which takes abcd 0101 a long time.

Programs in Windows are compiled, and it is generally thought that compilation is irreversible, that is, decompile (which 0101->abcd is very difficult), even if it can be done reluctantly, it will lose some code. For this reason, you need to use a program in Windows, if the program charges you, you can only pay the money, unless you do not. This is the charm of Linux open source!

1.2 Advantages and disadvantages of the source package

The source code package has the following advantages:

  1. Open source, if there is sufficient capacity, you can modify the source code in the package;
  2. can choose to install specific functions according to their own needs;
  3. Software is compiled and installed, so more suitable for their own system, more stable and efficient;
  4. Easy to uninstall, just need to remove the installation directory, you can leave no traces.

The source code package has the following disadvantages:

  1. Many steps in the installation process, especially when installing a large set of software (such as lamp environment), prone to spelling errors;
  2. The compilation process will be long, so the installation process is also longer than the binary package installation time;
  3. The novice is not very friendly, because is compiled installs, so once the error, the novice is difficult to solve.
2. Binary Package2.1 Introduction to Binary Packages

Binary packages are already compiled packages, the data in the binary package can be directly recognized by the computer 0101 , so the installation will eliminate the compilation link, which can save a lot of time. In Linux, the Redhat series of binary packages are generally RPM packages, while the Ubuntu series of binary packages are generally deb packages.

2.2 Pros and cons of binary packages

Binary packages have the following advantages:

  1. Package management system is simple, only need to knock a few commands to implement package installation, upgrade, query and uninstall;
  2. Installation speed is much faster than the source package;

Binary packages have the following advantages:

  1. After compiling, can not see the source code, not according to their own needs to decide which features to install;
  2. The choice of function is less flexible than the source package
  3. Efficiency is inferior to the source package
  4. Dependence
3. Script installation package3.1 Introduction to the script installation package

For some complex environments (such as lamp), too cumbersome, the great God wrote the environment of the installation script, only need to run the script, everything can be loaded. Although there is a separate class for the script installation package, the script installation package actually installs the source package and the binary package.

3.2 Advantages and disadvantages of the script installation package:

The script installation package has the following advantages:

  1. Installation is simple, convenient, only need to run the script, you can install all the software included in the script, will not error.

The script installation package has the following disadvantages:

  1. Complete loss of customization, can not install the required features according to their own needs, the installation of the function is entirely up to the scripting people to help you decide.
4. Selection of software Installation

If it is a server, the recommended source package installation. Because the server to be accessed by thousands of people, the source package execution efficiency.
If it is a personal device, recommended RPM package, of course, also look at the individual's own hobby, want to pack what package will pack what package, who special tube you.



Second, the software installation of RPM:1. Background knowledge:

RPM package source and CD, so you have to mount the disc before you can follow the steps. Examples of mounting are as follows:

  1. Create a mount point and mount it:

    mkdir /mnt/cdrommount /dev/sr0 /mnt/cdrom/
  2. All RPM packages are in/mnt/cdrom/packages/and can be ls viewed as shown in the command:

Related to the mount, you can refer to one of my other blog posts:
Linux Base II (Mount, shutdown restart and system level)

2. Preparation of Knowledge

When you know the mount, you cannot install the RPM package directly, and you must have some knowledge about the RPM package (naming rules and laziness).

2.1 Naming rules 2.1.1 name format

As shown below:

httpd-2.2.15-29.el6.centos.x86_64.rpm其中:    httpd 为包名    2.2.15 为版本号;    29 为软件发布的次数    el6.centos 为其适合的Linux平台    x86_64 为其适合的硬件平台    rpm 是包的扩展名
2.1.2 Package name and package full name

The full name of the package refers to the full package name, which is the first word at the beginning of the package.

In the example above:

httpdfor the package name;

httpd-2.2.15-29.el6.centos.x86_64.rpmis the full name of the package

  1. Package full Name: When operating a package that is not installed (install and upgrade), use the full name of the package, and note the path (absolute path or relative path)
  2. Package Name: After the software has been installed, the package name will be used for subsequent operations (uninstallation and querying) of the package. When using the package name, is actually going to search /var/lib/rpm/ the database __db.001到__db.004 (inside is garbled)
2.2 Dependence
  1. Tree-dependent: a->b->c

    Solution: Install C Reload B reload a
  2. Ring-dependent: a->b->c->a

    Solution: Put a, B, c three packages in one command to install
  3. Module dependencies: Also called library dependencies.

    The most disgusting, depends on the. SO.N (n is a number) end of the library file, which is a file in a RPM package in the/mnt/cdrom/packages directory, to install the package first

    Workaround: How to determine in which package, query www.rpmfind.net
3. Install Upgrade and uninstall3.1 Installation

Command:

rpm -ivh 包全名选项:    -i:安装(install)    -v:显示详细信息(verbose)    -h:显示进度(hash)    --nodeps:不检测依赖性(不要用)

Be aware of dependencies when installing software with the RPM command. Installation can be carried out according to the ideas in section 2.2.

Example: Installing HTTPD

1. 进入挂载目录:cd /mnt/cdrom/Packages/2. 安装 httpd:rpm -ivh http-tab(2次tab)3. 经过 2. 后会提示几个 rpm 包,其中:    1. httpd-2.2.15-29.centos.x86_64.rpm 为主包    2. httpd-devel-* 为库包    3. httpd-manual-* 为文档包    4. httpd-tools-* 为工具包4. 一般先安装主包,再安装附加包

Note: There are two 100% to calculate the completion, the first 100% is ready to succeed, the second 100% appears to be installed successfully

3.2 Upgrade

Command:

rpm -Uvh 包全名选项:    -U:升级(Upgrade)    --nodeps:不检测依赖性(不要用)升级相当于安装一个版本更新的安装包,你也可以用升级命令来安装新包。
3.3 Uninstalling

Command:

rpm -e 包名选项:    -e:卸载(erase)    --nodeps:不检测依赖性(不要用)

Description

  1. When uninstalling, simply enter the package name, as the package is already written in the database at the time of installation. /var/lib/rpm/
  2. The uninstall command still has dependencies, which can be uninstalled at the time of installation
  3. RPM package does not specify the installation location at the time of installation, the installation location is the RPM package author defined by the default location (as shown), will be distributed in various parts of the disk, to manually remove inconvenient, so the uninstall command.
  4. The source package does not have the uninstall command, because the source package during the installation process can specify the installation location, as long as the package installation location of the directory is deleted will be completely deleted software.

4. Query Check and extract4.1 Queries

Command:

rpm –q 包名           // 查询指定软件包是否安装rpm –qa              // 查询所有已安装的软件包rpm –qi 包名          // 查询指定包名的详细信息(里面只有帮助网站有点用)rpm –qip 包全名       // 查询指定未安装包的详细信息(注意路径)rpm –ql 包名          // 查询指定软件包都安装在哪些位置了rpm –qf 系统文件名     // 查询该系统文件属于哪一个软件(必须是已经安装了的软件生成的文件才能反向追查)rpm -qR 包名          // 查看软件包的依赖关系 (–p 未安装的软件包)选项:    -q:查询(query)    -a:所有(all)      -i:信息(information)    -p:包(package)    -l:位置(local)    -f:文件(file)

You can use the pipe character flexibly with the grep command when querying

4.2 Checksum

Command:

rpm –V 已安装的包名       // 校验指定rpm包中的文件选项:    -V  (verify)        校验示例:rpm -V httpd

If the file has not been modified, no prompt will appear, and if the file is modified, the following prompt will appear:

Where the validation content (9 and one in front of the file . c ) represents:

S:文件的大小是否被改变M:文件的类型或文件的权限是否被改变5:文件的MD5校验和是否改变(可看成是文件内容是否改变)D:设备的主从代码是否改变L:文件路径是否改变U:文件的属主(所有者)是否改变G:文件的属组是否改变T:文件的修改时间是否改变c:这个字符所占的位置有以下意义:    c:配置文件    d:普通文档    g:鬼文件,很少见,就是该文件不应该被这个 RPM 包所包含    L:授权文件    r:描述文件
4.3 extract

When a certain configuration file of a software is deleted by mistake, the file can be extracted from the RPM package by extracting the command.



Third, the software installation of YUM:

Todo



Iv. installation of the source code package for software Installation:

Todo

Linux Foundation III (software Installation management)

Related Article

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.