In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Overview:
The content of this chapter: software running environment, software package foundation, rpm package management, yum management, custom yum repository, compilation and installation.
1. Software running environment
1.API:Application Programming Interface (Application Development Interface) POSIX:Portable OS (International Standard) Program Source Code-> preprocessing-> compilation-> Link static compilation: shared compilation: .so ABI:Application Binary Interface (Application binary Program Interface) Windows is not compatible with Linux linux: file format: ELF (Executable and Linkable Format) win: file format: exe Msl PE (Portable Executable) library-level virtualization: Linux: WINE (library that simulates windows and runs win environment) Windows: Cywin (runtime environment that provides linux) 2. Development language system-level development httpd,nginx,vsftpd,go application-level development java (dependent on jvm virtual machine) Python (openstack cloud station), php,perl (dependent on per interpreter), ruby 3. Program format: cUniverse + source code: text format of the program code Compilation development environment: compiler, header file, development library binary format: text format program code-> compiler-> binary format (binary program, library file, configuration file, help file) java/Python source code: compile the format that can run on its virtual machine (jvm/pvm) Development environment: compiler, development library binary project construction tool c/c++:make jave:maven
Second, package management
1. Components of binary applications: binary files, library files, configuration files, help files 2. Package management: source code-> target binary format (binaries, library files, configuration files, help files)-> organized into one or a limited number of "package files" (install, upgrade, uninstall, query Check) package manager: deblan: dpt,dpkg with ".deb" suffix redhat: rpm (redhat package manager) with ".rpm" suffix S.u.S.E:rpm, ".rpm" command 3. Package command format source code: name-VERSION.tar.gz | bz2 | xz VERSION: major (major version number). Minor (minor version number). Release (release number) rpm package naming format: name-VERSION-release.arch.rpm VERSION: major.minor.release (rpm package release number) changelog document (content repair improvement related documents) example: bash-4 .2.46-19.el7.x86_64.rpm release:release.OS Common arch: x86: i386 I486, i586, i686 x86: x64, x86: 64, amd64powerpc: ppc is platform independent: noarch (for all platforms) 4. Package: classification and unpacking Application-VERSION-ARCH.rpm: main package Application-devel-VERSION-ARCH.rpm development subpackage Application-utils-VERSION-ARHC.rpm other subpackages Application-libs-VERSION-ARHC.rpm other subpackages: there may be dependencies Even circular dependencies automatically resolve dependence on package management front-end tools: yum:rpm package manager front-end tools: apt-get:deb package manager front-end tools zypper: rpm front-end management tools on suse dnf: Fedora 18 + rpm package manager front-end management tools 5. View the library files that the binary depends on: ldd / PATH/TO/BINARY_FILE manage and view the library files loaded on this machine: ldconfig / sbin/ldconfig-p: show all available library file names and file path mapping relationships that have been cached on this machine configuration file: / etc/ld.so.conf / etc/ld.so.conf.d/*.conf cache file: / etc/ld.so.cache 6. Package manager package manager: function: package one or more package files for each component file of the compiled application, so as to easily and quickly manage the package installation, uninstallation, query, upgrade and verification of the component manifest of the package (each package is implemented separately) the metadata of the file manifest RPM in the RPM package, such as the name Version, dependency, description, etc. Install or uninstall script database (public) path: / var/lib/rpm package name and version dependency function description package generated after installation of each file path and check code information 7. Source of access 1) CD-ROM or official server issued by the system CentOS image: http://mirrors.aliyun.com http://mirrors.sohu.com http://mirrors.163.com2) project official site 3) third party organization: Fedora-EPEL search engine: http://pkgs.org http://rpmfind.net ttp://rpm.pbone.net4) made by yourself
3. Rpm command management package on CentOS system:
Functions: install, uninstall, upgrade, query, check, database maintenance
1. Installation
Format: rpm-I [option] PACKAGE_FILE option:-I: indicates install installation-v-vv: shows the installation process, the latter shows more details;-h: displays the progress bar format in #;-nodeps: ignores dependencies-force: mandatory action, note that it may not run after successful installation -test: test installation, as test check-nosignature: do not check signature is source validity;-nodigest: do not check package integrity; MD5 header;-noscipts: do not execute package script fragment Note: rpm comes with four types of script% pre: pre-installation script -nopre% post: post-installation script;-nopost% preun: pre-uninstall script;-nopreun% postun: post-uninstall script;-nopostun usage: rpm-ivh PACKAGE_FILE
two。 Upgrade
Format: rpm-U | F [optIon] PACAGE_FILE option:-U: upgrade regardless of whether the software exists beforehand, upgrade if it does not exist, install if it does not exist;-F: upgrade the software if it does not exist, abandon the upgrade;-oldpackage: downgrade. If you find a Bug or compatibility problem after the upgrade, you can use this option to roll back to the pre-upgrade version. -force: mandatory action, note that it may not run after successful installation;-replacepkgs: note that the configuration file cannot be replaced; note: (1) do not upgrade kernel; support the coexistence of multiple kernel; can be installed directly; (2) the modified configuration upgrade will not be overwritten, the upgrade will be the same as the new file, will be renamed to file.rpmnew
3. Query:
Format: rpm-Q [option] [PACKAGE-NAME | PACKAGE_FILE] option:-qa: query all installed packages on the system;-qf / path/to/file: query files generated by that package;-ql: files generated by the query program:-qi: query program properties information;-qc: query program configuration files -qd: the document provided by the query program-Q-whatprovides CAPABILITY (function): query the CAPABILITY provided by that program;-Q-whatrequires CAPABILITY: query which packages this CAPABILITY is dependent on;-Q-scripts: the script generated by the query package -Q-changelog: query software history to query the information of uninstalled software packages. You need to add the-p option in conjunction with the above options. The following parameters must be PACKAGE_FILE;, such as:-qpi: query the program attribute information of the specified PACKAGE_FILE
4. Unloading
Format: rpm-e [option] PACKAGE-NAME option:-vh: display process-nodeps: ignore dependencies-noscripts: ignore scripts-allmatches: uninstall all packages that match the specified name, that is, uninstall all packages with that name in the software name -test: test check uninstall, not real uninstall Note: uninstall will check dependencies. If the uninstalled software is dependent by other programs, please uninstall it carefully, otherwise the dependent program will not run. Use: rpm-e PACKAGE_FILE
5. Check
How it works: check the legitimacy and integrity of the source of the software package. If you want to check them, you must have a verification mechanism. This mechanism is based on signature and encryption. Usually, there is a file containing all the software signatures on the CD of the distribution version, which is extracted according to the features of the software package and is used to verify the integrity of the software package through individual encryption. If the software package is modified on the way to acquisition, the software package signature is extracted again in the system and compared with the existing signature file of the system, and the modified software package is judged differently. The features extracted according to the same encryption algorithm must be different. The source validity is based on the signature; the signature file is called the public key; the verification is done by the verification program, and the default rpm command is called when it is installed Public key acquisition: in the official website system CD system configuration file, this is the system public key location copied from the installation CD during installation: / etc/pik/rpm-gpg/RPM-GPG-KEY-CentOS-7 import public key: rpm- import / path/to/pub.key verification software: rpm- V PACKAGE-NAME: verify whether the installation file has been modified since installation Judging from the information recorded by PMS Rpm-K PACKAGE_FILE: manual verification of specified uninstalled packages
6. Database reconstruction
Default database directory location: / var/lib/rpm syntax format: rpm-initdb: initialize database rpm-rebuilddb: rebuild-dbpath=/path/: specify database creation location
4. Yum command management package on CentOS system:
1.yum profile
Yum repository:yum repo (yum repository), which stores many rpm packages and related metadata files (placed in a specific directory repodata) file server: ftp:// http:// file:///yum client configuration file: / etc/yum.conf: provides common configuration for all repositories Generally do not change / etc/yum.repos.d/*.repo: provide the definition of the configuration repository point to: [repositoryID] name=Some name for this repository Yum warehouse describes the baseurl=url://path/to/repository/,yum warehouse path. The above three paths enabled= {1 | 0} are supported. 0 means disabled, 1 means enabled, and can be enabled without writing. However, if you write enabled incorrectly, gpgcheck= {1 | 0} will be disabled. This line does not write to detect, and 0 means no packet detection. 1 is to check the package pgkey=URL. In addition, if the check text file / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 is already installed on the system, it is equivalent to the above two items enablegroups= {1 | 0}, package group failovermethod= {roundrobin | priority}, priority-(default: roundrobin, meaning random selection Cost= defaults to 1000)
The usage of 2.yum command
Format: yum [options] [command] [package...] 1) display warehouse list: yum repolist [all | enabled | disabled] 2) display package: yum list3) installation package (yum on centos7 supports completion because its bash version is higher): yum install package1 [package2] […] Yum reinstall package1 [package2] […] (reinstall) 4) upgrade package: yum update [package1] [package2] […] Yum downgrade package1 [package2] […] (downgrade) 5) check for available upgrades: yum check-update6) Uninstall package: yum remove | erase package1 [package2] […] ) 7) View package information information: yum info […] 8) check which package the specified feature (which can be a file) is provided by: yum provides | whatprovides feature1 [feature2] […] , similar to rpm's-qf option 9) Clean the local cache (yum cache is described in the main configuration file that is # cat / etc/yum.conf): when installing the package, the downloaded package files are stored in cachedir=/var/cache/yum/$basearch/$releasever, where $basearch is the hardware architecture Releasever is the operating system version number yum clean [packages | metadata | expire-cache | rpmdb | plugins | all] .10) build cache: yum makecache11) search: yum search string1 [string2] […] To search for the package name with the specified keyword and summary information 12) to view the capabilities: yum deplist package1 [package2] […] on which the specified package depends 13) View yum transaction history: yum history log file: / var/log/yum.log # cat / var/log/yum.log can also view yum transaction history yum history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | sync | stats] 14) commands related to package group management: the functions of a single package are limited, in order to achieve complex functions, many packages are required to form package groups yum groupinstall group1 [group2] […] , install package group yum groupupdate group1 [group2] […] , upgrade package group yum grouplist [hidden] [groupwildcard] […] To view the list of package groups yum groupremove group1 [group2] […] , uninstall the package group yum groupinfo group1 […] To view package group information
3. How to use CD as a local yum repository
1) Mount the CD to a directory, such as / mnt/cdrom [root@localhost ~] # mkdir / mnt/cdrom [root@localhost ~] # mount / dev/cdrom / mnt/cdrom 2) create a configuration file [root@localhost ~] # vim / etc/yum.repos.d/ yum.repos [CDRom] name=yum testbaseurl= file:///mnt/cdrom or file:///misc/cdgpgcheck=0gpgkey=enabled=1
4. Command line options for yum
-nogpgcheck: disable gpgcheck check-y: automatically answer "yes"-Q: silent mode-disablerepo=repoidglob: temporarily disable the repo-enablerepo=repoidglob specified here: temporarily enable the repo-noplugins specified here: disable all plug-ins
5. Yum warehouse
1) variables available in yum's repo configuration file: $releasever: major version number of the current OS release $arch: platform, i386, i486, and i586 X86 platform 64 and so on $basearch: current infrastructure architecture example: baseurl= http://server/centos/$releasever/$basearch/ http://server/centos/7/x86_64 http://server/centos/6/i3842) creates a custom yum repository: createrepo [options] in which some dependency, verification information and so on required by yum are stored in the repodata directory Therefore, in order to customize the establishment of yum source, you need not only rpm package, but also repodata directory. Repodata directory files can be generated by createrepo command.
5. Source code installation
C code compilation and installation three steps-operate in the source code directory
C code compilation and installation three steps: 1). / configure: (1) pass parameters through options to specify enabling features, installation path, etc.; execution will refer to the user's specification and Makefile.in file generation makefile; (2) check the dependent external environment; 2) make: build the application based on the makefile file 3) make install development tool: autoconf: generate configure script automake: generate Makefile.in suggestion: check the source code of INSTALL,README open source program before installation: official self-built site: apache.org (ASF) mariadb.org. Code hosting: SourceForge Github.com code.google.comc/c++: gcc (GNU C Complier) compiling C source code: premise: provide development tools and development environment development tools: make, gcc and other development environments: development libraries Header file glibc: standard library provides development components CentOS 6: "Development Tools", "Server Platform Development" through "package group". First step: configure script options: specify installation location, specify enabled features-- help: get the options it supports to use. Category: installation path setting:-- prefix=/PATH/TO/SOMEWHERE: specify the default installation location. Default is / usr/local/-- sysconfdir=/PATH/TO/SOMEWHERE: configuration file installation location; system types: Optional Features: optional feature-- disable-FEATURE-- enable-FEATURE [= ARG] Optional Packages: optional package-- with-PACKAGE [= ARG]-- without-PACKAGE step 2: make step 3: make install
two。 Configuration after installation: (take httpd as an example)
1) Import the compiled and installed binary program directory into the PATH environment variable, and you can use the command directly instead of writing absolute or relative paths. Edit file / etc/profile.d/NAME.sh#vim / etc/profile.d/http2.shPATH=$PATH:/usr/local/http2/bin2) Import library file path edit / etc/ld.so.conf.d/NAME.conf add the new library file directory to this file # vim / etc/ld.so.conf.d/http2.sh/usr/local/http2/lib and then let the system regenerate the cache # ldconfig [- v] 3) Import header file The default location of the header file is / usr/include link-based implementation: ln-sv [root@localhost htdocs] # cd / usr/include [root@localhost include] # ln-s / usr/local/http2/include http24) Import help manual editor / etc/man.config | add a MANPATH / usr/local/http2/man to the man_db.conf file
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
Http://tech.49jie.com/?p=1298http://oldj.net/article/notes-on-mongodb/
© 2024 shulou.com SLNews company. All rights reserved.