Preface:
Installing a program on an operating system is a common task. However, in Linux, many programs are source program packages developed by online hackers or project teams using C, C ++, or Perl. To install these source programs, you must compile the program. This may take the following steps: preprocessing --> Compilation --> assembly --> link. Then you can install and run it. However, not all users have this capability for installation. Therefore, the Package Manager simplifies installation and usage.
Bytes -------------------------------------------------------------------------------------------
Classification of Package Manager:
Debian: dpkg
RedHat: rpm (RedHat Package Manager)
Features of the Package Manager:
Package
Install
Uninstall
Upgrade
Verification
Database Management
Development of Package Manager: front-end tools
Dpkg: APT-Get
Rpm: Yum
Bytes -------------------------------------------------------------------------------------------
Program naming format:
Source code:
Name-version.tar. {GZ, bz2, xz}
Version: Major. Minor. Release
RPM package:
Name-version-relase.arch.rpm
Version: Major. Minor. Release, same as the source code.
Relase: The Release Number of rpm, which is independent of the release number of the program source code. It is only used to identify the revision of different RPM packages. In addition, release also contains the OS applicable to this package.
Arch: Suitable for hardware platforms.
How to Get RPM:
1. Released CD or Site Server
Image:
Http://mirrors.163.com
Http://mirrors.sohu.com
2. Official Website of the project
Source code
RPM package
3. Many third-party organizations or individuals create and publish many rpm packages
Http://rpmfind.net
Http://rpm.pbone.net
Reliable approach: epel
Fedora-epel
Verify the validity of the RPM package:
After the package producer is created, a digital signature is attached to the package;
Verification Method:
Source Validity
Package integrity
Verification process:
Premise: a reliable mechanism is required to obtain the public key of the package producer;
1. Use the producer's public key to decrypt the encrypted signature. decryption means that the source is legal;
2. Use the same intention encryption algorithm as the producer to extract the original data signature and compare it with the decrypted signature. If the same, the integrity is normal;
Bytes -------------------------------------------------------------------------------------------
Use of RPM package manager:
---------------------------------------- ------
Install
Rpm [Option]/path/to/package_file
-I: Install
-V display
-VV detailed display
-Vvv details + display
-H: displays the progress #
Combination options:-IVH
-- Test: Only for testing, no installation is actually performed
If it depends on other packages:
1. Solve the dependency
2. Ignore dependency
Can be installed, but may not be running;
-- Nodeps ignore dependency
Reinstall:
-- Replacepkgs
If the original configuration file is modified, it is likely not to be replaced, but to rename the generated configuration file to. rpmnew.
---------------------------------------- ------
Uninstall the package:
Rpm [Option] package_name
-Eerase
If it is dependent on other packages:
1. Uninstall all packages dependent on this package
2. Ignore dependency
Can be uninstalled, but dependent on this package program may not run normally
-- Nodeps ignore dependency
---------------------------------------- ------
Upgrade package:
Replace old version with new version
Rpm [Option]/path/to/package_file
1. Upgrade or install
-Uvh
2. Upgrade only
-Fvl
-- Force update
---------------------------------------- ------
Query operation:
1. check whether a package is installed.
Rpm-Q package_name...
2. query all installed packages
Rpm-Qa
3. query the Package Description
Rpm-Qi package_name
4. query the files generated by a package installation.
Rpm-QL package_name
(1) query the configuration files generated by a package installation
Rpm-QC package_name
(2) query the help files generated by a package installation
Rpm-Qd package_name
(3) query the script of the package
Rpm-Q -- scripts package_name
5. query the package generated by which a file is installed.
Rpm-qf/path/to/some_file
6. query uninstalled packages
Rpm [Option]/path/to/package_file
-QPI: queries the information generated by an uninstalled package.
-Qpl: query which files are generated for an uninstalled package
-Qpc: query which configuration files are generated for an uninstalled package.
-Qpd: query which help files are generated for an uninstalled package.
---------------------------------------- ------
Verification:
Used to check whether the file attributes generated by package installation have changed
Rpm-V package_name
------------
S file size differs
M mode differs (supported des permissions and file type)
5 Digest (formerly MD5 sum) differs
D device major/minor number Mismatch
L readlink (2) path Mismatch
U user ownership differs
G group ownership differs
T mtime differs
P capabilities differ
A property is displayed.
------------
Check the legitimacy and integrity of the RPM package Source:
Premise: import the public key of the package producer on the current system
Import:
Rpm -- import/path/to/key_file
# Rpm-Qa GPG-pubkey *
Display All imported public keys in GPG format
# Rpm-Qi GPG-pubkey-name
Displays the details of a key.
Check package: automatically executed during installation
Manual check:
Rpm-k/path/to/package_file
Do not check the package integrity:
Rpm-k -- nodigest
Do not check the source validity:
Rpm-k -- nosignature
Rpm -- checksig/path/to/package_file
---------------------------------------- ------
Database reconstruction:
Database directory location:/var/lib/RPM
Reconstruction:
Rpm -- initdb: initialization
If no database exists, a new one is created. If yes, no new database is created.
Rpm -- rebuilddb: Rebuilding
Direct reconstruction, covering the original database
Rpm Study Notes