Linux software Installation Management, linux software installation

Source: Internet
Author: User
Tags gpg

Linux software Installation Management, linux software installation
1. Software Package Management Overview 1. Software Package Classification

Source code package

  • Script installation package

Binary Package (RPM package, system default package)

2. Advantages of the source code package:
  • Open-source: if you have sufficient capabilities, you can modify the source code.
  • You can freely select the required functions.
  • Software design compilation and installation, so it is more suitable for your own system, more stable and effective
  • Easy to uninstall
Disadvantages of the source code package:
  • There are many installation steps, especially when a large set of software is installed (such as a LAMP environment), which may cause spelling errors.
  • The compilation process is long and the installation process is longer than that of Binary
  • It is difficult for new users to solve the problem once an error is reported during the installation because it is compiled and installed.
3. Advantages of the RPM package Binary Package:
  • The package management system is simple. Only a few commands can be used to install, upgrade, query, and uninstall packages.
  • The installation speed is much faster than that of the source code package.
Disadvantages of Binary Package:
  • After compilation, you can no longer see the source code
  • Feature selection is not as flexible as source code package
  • Dependency
4. Script installation package

The so-called script installation package is to write the complex installation process of the software package into a program script. Beginners can execute the program script for one-click installation. But the actual installation is the source code package and Binary Package.

Advantages: simple and quick installation

Disadvantage: Completely lost Customization

2. rpm command Management

Red Hat Package Manager/RPM Red Hat Package Manager

RPM package naming Rules 1. Source of RPM package

RPM package in the system Disc

2. RPM package naming principles

Httpd-2.2.15-15.el6.centos.1.i686.rpm

  • Httpd package name
  • 2.2.15 Software Version
  • 15 times of Software Release
  • El6.centos suitable for Linux platforms
  • I686 suitable hardware platform
  • Rpm Extension
3. RPM package dependency

Tree dependency: a-> B-> c

Circular dependency: a-> B-> c->

Module dependency: module dependency, query Website: www.rpmfind.net

Installation command 1. Full package name and package name

Full package name: When the operated package is not installed, the full package name is used. Note the path.

Package name: When operating on installed software packages, the package name is used to search for databases in/var/lib/rpm.

2. RPM Installation

Full rpm-ivh package name

Option:

  • -I (install) Installation
  • -V (verbose) displays details
  • -H (hash) shows the progress
  • -- Nodeps does not detect Dependencies
Upgrade and uninstall 1. RPM package upgrade

Full name of rpm-Uvh package

Option:

  • -U (upgrade) upgrade
2. Uninstall

Rpm-e package name

Option:

  • -E (erase) uninstall
  • -- Nodeps does not check Dependencies
RPM package query 1. Check whether the package is installed

Rpm-q package name

# Check whether the package is installed

  • -Q query)

Rpm-qa

# Query all installed RPM packages

  • -A all (all)

Rpm-qa | grep httpd

2. query the software package details

Rpm-qi package name

Option:

  • -I: Query Software information)
  • -P: Query package information)
3. query the file installation location in the package

Rpm-ql package name

Option:

  • -L list)
  • -P: Query package information)
Default RPM package installation location
Default RPM package installation path
/Etc/ Configuration File Installation Directory
/Usr/bin Executable command installation directory
/Usr/lib/ Saved location of the function library used by the program
/Usr/share/doc Location of Basic Software User Manual
/Usr/share/man/ Help file storage location
4. query which RPM package the file belongs

Rpm-qf System File Name

Option:

  • -F: Which package (file) Does the Query System file belong)
5. query the dependency of the software package

Rpm-qR package name

Option:

  • -R: query the dependency of a software package (requires)
  • -P: Query package information)
RPM package verification 1. RPM package Verification

Rpm-V package name

The content of the eight items in the verification content is as follows:

  • S file size changed
  • Whether the M file type or File Permission (rwx) is changed
  • 5. Whether the MD5 checksum of the file is changed (whether the file content is changed)
  • D. is the Master/Slave code of the device changed?
  • L whether the file path has changed
  • U file owner (owner) change?
  • Does the group of the G file change?
  • T Whether the file modification time has changed
  • File Type
    • C configuration file)
    • D. documentation)
    • G "ghost" file (ghost file) is rare, that is, this file should not be included in this RPM package
    • L license file)
    • R description file (read me)
2. File extraction in the RPM package

Full name of rpm2cpio package | cpio-idv. Absolute file path

  • Rpm2cpio
    # Convert an rpm package to a command in cpio format
  • Cpio
    # Is a standard tool used to create software archives and Extract files from Archives

[Root @ AmorLei ~] # Cpio option <[file | device]

Option:

  • -I: copy-in mode, restore
  • -D: The Directory is automatically created during restoration.
  • -V: displays the restoration process.
rpm -qf / bin / ls
# Query which software package the ls command belongs to
mv / bin / ls / tmp /
# Cause ls command to be deleted by mistake
rpm2cpio /mnt/cdrom/Package/coreutils-8.4-19.el6.i686.rpm | cpio -idv ./bin/ls
# Extract the ls command in the RPM package to / bin / ls in the current directory
cp / root / bin / ls / bin /
# Copy the ls command back to the / bin / directory and fix the missing files
3. yum online management

Disadvantages of the RPM package: the rpm package is too dependent during installation. If all rpm packages are manually installed, it is difficult to use the rpm packages.

Yum advantages: All packages are placed on the official server. When yum is installed online, the dependency problem can be automatically solved.

Yum disadvantage: Red Hat yum online installation requires payment

1. yum source file

vi /etc/yum.repos.d/CentOS-Base.repo

  • [Base] container name, which must be placed in []
  • Name container description, which can be written by yourself
  • Listlist image site, which can be commented out
  • Baseurl: the address of the yum source server. It is the official CentOS yum source server by default and can be used. If you think it is slow, you can change it to your desired yum source address.
  • Enabled: whether the container takes effect. If not written or written as enable = 1, writing as enable = 0 does not take effect.
  • If gpgcheck is 1, it indicates that the RPM digital certificate takes effect. If it is 0, it does not take effect.
  • The location where the public key file of the gpgkey digital certificate is stored. No need to modify
2. Create a yum source on the CD. 1. Mount the CD.
mkdir / mnt / cdrom
# Create a mount point
mount / dev / cdrom / mnt / cdrom
# Mount the disc
2. Make the network yum source invalid
cd /etc/yum.repos.d/
# Enter the yum source directory
mv CentOS-Base.repo CentOS-Base.repo.bak
# Modify the yum source file suffix to make it invalid
3. Enable the yum source function of the CD
vim CentOS-Media.repo
[c6-media]
name = CentOS- $ releasever-Media
baseurl = file: /// mnt / cdrom # The address is your own CD mount address
# file: /// media / cdrom /
# file: /// media / cdrecorder # Comment these two non-existent addresses
gpgcheck = 1
enabled = 1 # change enabled = 0 to enabled = 1 to make this yum source configuration file take effect
gpgkey = file: /// etc / pki / rpm-gpg / RPM-GPG-KEY-CentOS-6
3. yum command 1. Common yum commands

(1) Query

yum list
# Query the list of all available packages
yum search keyword
# Search for all keyword related packages on the server

(2) Installation

yum -y install package name
Options:
-install
--y automatically answer yes
For example: yum -y install gcc

(3) Upgrade

yum -y update package name
Options:
-update
--y automatically answer yes

(4) uninstall

yum -y remove package name
Options:
-remove
--y automatically answer yes
yum grouplist
# List 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

Minimal installation of servers, software installation, and installation

2. yum software group management commands
yum grouplist
# List 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
4. source code package management 1. Differences between source code package and RPM package

Differences before installation: Conceptual differences

Differences after installation: different installation locations

RPM package installation location

Is installed in the default location

You can specify the installation location for rpm installation, but it is not recommended to specify the installation location.


[root@AmorLei ~]# rpm --help | grep prefix
  --prefix=<dir>                   relocate the package to <dir>, if
Installation location of source code package

Installed in the specified location, generally:/usr/local/software name/

The source code package has not been uninstalled.

Impact of different installation locations

The services installed in the RPM package can be managed using the System service Management command (service). For example, the startup method of apache installed in the RPM package is as follows:

  • /Etc/rc. d/init. d/httpd start
  • Service httpd start (RedHat proprietary method)

Services installed in the source code package cannot be managed by service management commands because they are not installed in the default path. Therefore, you can only use absolute paths for service management, such:

  • /Usr/local/apache2/bin/apachectl start
2. source code package installation process 1. Installation preparation

Install C language compiler

Download source package: no error with httpd-2.2.34

Http://mirror.bit.edu.cn/apache/httpd

2. Installation Considerations

Source code storage location:/usr/local/src/

Software installation path:/usr/local/

How to determine the installation process error:

The installation process is stopped and an error, warning, or no prompt is displayed.

3. Install the source code package

Download source code package

Decompress the downloaded source code package

Enter the extract directory

  • /Configure software configuration and check
    • Define required function options.
    • Check whether the system environment meets the installation requirements.
    • Write the defined function options and detection system environment information to the Makefile file for subsequent editing.
    • [Root @ AmorLei httpd-2.2.34] #./configure -- prefix =/usr/local/apache2
make compile
     make clean
make install

/ usr / local / apache2 / bin / apachectl start 

RPM package webpage location/var/www/html/

Source code package webpage location/usr/local/apache2/htdocs/

4. Uninstall the source code package

You can directly Delete the installation directory without uninstalling the command. No junk files are left.

5. Script Installation

The script Installation notes will be updated later!


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.