In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Package management for Linux:
Components of the software package:
Binary programs / bin, / sbin, / usr/bin, / usr/sbin, / usr/local/bin, / usr/local/sbin
Library lib, / usr/lib, / lib64, / usr/lib64, / usr/local/lib, / usr/local/lib64
/ etc/ld.so.conf, / etc/ld.so.conf.d/*.conf
Configuration file / etc
Help files man files, info files, README, INSTALL, ChangeLog
Man COMMAND
Go to a path to find the name of a compressed file with the same name as the command, which usually ends in .gz
/ usr/share/man/
Ldd command:
View the shared libraries on which the application depends
Ldd [options] FILE...
Use of the rpm package:
Rpm package naming format:
Source program: name-version.tar. {gz | bz2 | xz}
Version: major.minor.release
Rpm package: name-version-release.arch.rpm
Release: usually contains the production and release number of rpm, as well as the applicable OS
Bash-4.3.2-2.el6.x86_64.rpm
Legal verification of the source:
Source program: check by md5 or sha1 check code
Rpm package: the legitimacy provided by the publisher is credible
Check packet integrity: check code
Source verification method: public key
How to get the rpm package:
1. The publisher's CD or site server
Take CentOS as an example:
Http://mirrors.163.com
Http://mirrors.sohu.com
2. Http://rpmfind.net
3. Http://rpm.pbone.net
Rpm package management: installation
# rpm-ivh [install-options] / path/to/rpm_package installation package, showing installation progress
[install-options]
-- test only tests and does not actually perform the installation process
-- nodeps ignores dependencies
-- replacepkgs reinstallation
The original configuration file will not be overwritten and the newly installed configuration file will be renamed to a file with the suffix .rpmnew
Rpm package management: uninstalling
# rpm-e [install-options] package_name Uninstall package
[install-options]
-- nodeps ignores dependencies
Rpm package management: query
# rpm-qa queries all installed packages
# rpm-Q package_name queries whether a single package is installed
# rpm-qi package_name query package description
# rpm-ql package_name query package generates a file list on the current system after installation
# rpm-qd package_name query package generated help documentation after installation
# rpm-qc package_name query the configuration file generated after installation of the package
# rpm-qf / path/to/somefile query which package is installed to generate a file
# rpm-Q-scripts package_name query package related scripts
There are four types of scripts:
Preinstall pre-installation script
Postinstall post-installation script
Preuninstall pre-uninstall script
Postuninstall post-uninstall script
Query information about rpm package files that have not been installed:
# rpm-pqi / path/to/package_file query package description
# rpm-pql / path/to/package_file query package generates a file list on the current system after installation
# help documentation generated after installation of rpm-pqd / path/to/package_file query package
# rpm-pqc / path/to/package_file query package generated configuration file after installation
Upgrade of rpm package:
# rpm-Uvh [install-options] / path/to/package_file upgrade or installation
# rpm-Fvh [install-options] / path/to/package_file upgrade
[install-options]
-- nodeps ignores dependencies
-- force forced installation
Rpm package management: check whether the files generated after the package installation have been modified
# rpm-V package_name
S file Size differs
M Mode differs (includes 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
Rpm package management: verifying source validity and package integrity
Packet integrity: through one-way encryption mechanism (md5 | sha1)
Source legitimacy: through public key encryption mechanism (RSA)
Import the public key of the producer, and the public key of the CentOS distribution is in the iso file
Import command: rpm-- import / path/to/gpg-key-file
# pm-K-- nosignature / path/to/package_file only checks integrity, not source validity # pm-K-- nodigest / path/to/package_file does not check integrity, only source validity
# pm-K / path/to/package_file checks both integrity and source legitimacy
Rpm package Management: database Reconstruction
Database: / var/lib/rpm/
# rpm-initdb initialization. Create a new database if it does not exist in advance.
# rpm-- rebuilddb reconstruction, directly rebuilding the database, will overwrite the original database
Yum client:
1. Configuration file: specify the available yum repositories
2. Cache metadata: yum acquires metadata from each available yum repository and caches it locally
3. Analyze metadata: complete metadata analysis according to specific operation requests, which may include checking dependencies, file lists and other information
4. Perform specific operations:
The client profile specifies the corresponding server access method:
Ftp ftp://server/path/to/repo
Http http://server/path/to/repo
Nfs nfs://server/nfs_path
File file:///path/to/repository
To use yum to manage the application, you must first configure its available yum repository and save it in the configuration file:
/ etc/yum.conf
/ etc/yum.repos.d/*.repo
Configuration file format: consists of two segments, similar to windows's ini configuration file
[main]: main configuration segment
[repo]: warehouse configuration section
Configure repo:
[repo_ID]
Name=String
Access path to baseurl= warehouse
Enabled= {1 | 0}
Gpgcheck= {1 | 0}
Gpgkey= public key file (either locally or server-side path)
Cost= defines this warehouse cost, which defaults to 1000
[base]
Name=CentOS 6.5 X86_64 relase
Baseurl= http://172.16.0.1/cobbler/ks_mirror/centos-6.5-x86_64/
Enabled=1
Gpgcheck=1
Gpgkey= http://172.16.0.1/cobbler/ks_mirror/centos-6.5-x86_64/RPM-GPG-KEY-CentOS-6
The commands of yum:
# yum repolist lists all available yum repo
# yum clean all cleans cache
# yum list [all | installed | available] lists [all installation packages | installed packages | installable packages]
# yum info package_name lists the description of the package
# yum whatprovides | provides / path/to/somefile queries which package is used to install and generate a file
# yum install package_name installs the specified package
# yum reinstall package_name reinstall the specified package
# yum erase package_name Uninstall the specified package
# yum check-update checks for upgradable packages
# yum update package_name upgrade the specified package
# yum downgrade package_name downgrade the specified package
# yum grouplist lists all package groups
# yum groupinfo "group_name" displays package group information
# yum groupinstall "group_name" installs the specified package group
# yum groupremove "group_name" Uninstall the specified package group
If the system is CentOS 5, the commonly used development package groups are "Development Tools" and "Development Libraries"
If the system is CentOS 6, the commonly used development package groups are "Development Tools" and "Server Platform Development"
Install the local package:
# yum install / path/to/package_file
Manually prohibit checking source and integrity:-- nogpgcheck
# yum-nogpgcheck install / tmp/zsh-2.3.1-2.el6.x86_64.rpm
Exercise: install the relevant package groups and ensure that the following commands can be executed
# gcc-version
Gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# yum-y groupinstall "Development tools"Server Platform Development"
Yum repository: file server
Repodata/:
Repomd.xml:
Test the configuration that implements yum repository:
1. Prepare the file server; using httpd as an example, make sure that the httpd package has been installed in advance
2. In the / var/www/html directory, use a directory to store all rpm packages that are going to be made into yum repositories
# cd / var/www/html
# lftp 172.16.0.1/pub/Sources/6.x86_64
# lftp: > mirror openstack
# bye
3. Create a yum repository
# rm-rf / var/www/html/openstack/repodata
# createrepo / var/www/html/openstack
4. Start the httpd service
# service httpd start
5. Configure to use self-built yum warehouse
[openstack]
Name=Openstack Repository
Baseurl= http://172.16.100.7/openstack/
Enabled=1
Gpgcheck=0
6. Configure the yum source of epel
7. Test use
# yum install openstack-keystone
Compilation and installation of package management:
Source program:
Project engineering: spread the code across multiple source code files
GNU/make
Autoconf: configure script
Check whether the compilation environment compiles the requirements, and define which features or functions are enabled when the current program is compiled, as well as the definition of the installation path, and so on
Result: makefile file will be generated based on Makefile.in file
Automake: Makefile.in fil
Used to generate makefile files in combination with configure scripts
The makefile file is the configuration file for the make command
To compile and install:
1. Get the source code and decompress:
# tar xf package-version.tar. {gz | bz2 | xz}
Note: the directory name after deployment is usually package-version.
2. Switch to the source directory
# cd package-version
3. Execute configure script
#. / configure
4. Compilation
# make
5. Installation
# make install
Common features of configure scripts:
We need to define the configuration:
1. Specify the installation path:
-- prefix=/usr/local/package_name
-- sysconfdir=/etc/package_name
2. Specify which features are enabled / disabled:
-- enable-feature: for example-- enable-fpm
-- disable-feature: for example-- disable-socket
3. Specify the dependent function, program, or file
-- with-function: enable a feature
-- without-function: disable a feature
Different programs have different configure script functions. To get help:
. / configure-- help
Exercise:
1. Compile and install nginx, and start it
2. Compile and install axel and try it out
3. Compile and install httpd, and start it
/ usr/local/apache/bin
Binary program:
# vim / etc/profile.d/apache.sh
PATH=/usr/local/apache/bin:/usr/local/apache/sbin:$PATH
Export PATH
Output the header file to the system:
# ln-sv / usr/local/apache/include / usr/include/httpd
Library file output:
# vim / etc/ld.so.conf.d/httpd.conf
/ usr/local/apache/lib
Let the system regenerate the library file path cache
# ldconfig
Export the man file:
# vim / etc/man.config
MANPATH / usr/local/apache/man
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.