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--
=
Usage of package Manager rpm,yum and Automated deployment of apache httpd Services
Package management?
Generally speaking, download the program name .exe in windows and click on the setup installer or directly on the package. The next step is done. The package in Linux is not exe, and different mainstream distributions have different package management mechanisms. The mainstream ones are rpm package manager and deb package management.
Here's the difference:
Package name (PACKAGEFILE): full name of the rpm package file
Program name (PACKAGENAME): the program name of a rpm package without a version number, such as QQ instead of QQ-8.0.1.exe
Now take a look at how rpm's administrative commands "double-click" to install and uninstall the administrative rpm package?
Rpm:RPM Package Manager
-Q check whether the program is installed, generally with other options to query-p is generally used to view information about uninstalled programs, with other options can be used to preview the source of the program-V verification package and security-K verification digital signature (no detection tool Default not ok)-v display details-more detailed-U |-F upgrade package shown by vv Delete old packages (use with caution)-R check package dependencies-ivh install rpm packages-e uninstall packages-qi view information about packages-files generated during ql installation-qf to see which program a file comes from-qc view programmers Configuration file-- replacepkgs override installation Existing reservation-replacefiles overwrites an existing file-ql-- script view installation script-- script view script file in package-- whatprovides "function" view a function provided by that software-- import import key key how to view files in rpm? rpm2cpio x.rpm | cpio-tv Preview rpm2cpio x.rpm | cpio-d unpack
The rpm manager will set up the database file to record the information of the program during installation: / var/lib/rpm, and use the rpm command to query the basis of the installed program.
How do you get rpm?
The official website of the program is available.
Officially certified rpm source warehouse
Third-party organizations: fedora-epel sourc
Several commonly used rpm package websites: http://rpm.pbone.net/
Https://www.rpmfind.net
Make it yourself, FPM: make rpm package tool
The RPM package manager is very powerful, but when there are calls and dependencies between packages, sometimes installing a package depends on many packages
Have to install one by one, the installation efficiency of this kind of package is defective, in order to solve the dependency, the yum manager is produced, which does not mean to replace the rpm command, the two are important to each other, and yum depends on the rpm program.
How do I use the yum (Yellowdog Update Modifier) package manager?
The yum manager is based on the yum architecture, and the server mainly stores rpm packages and metadata (metadata) describing the attributes of the rpm packages.
Client configuration:
/ etc/yum.conf: provide common configuration for all warehouses / etc/yum.repos.d/*.repo: provide configuration for the warehouse to point to the server address
Domestic yum sources:
1. Aliyun YumSource: http://mirrors.aliyun.com/repo/
two。 NetEase yum source: http://mirrors.163.com/
3. Sohu Yumyuan: http://mirrors.sohu.com/
Command to generate client-side yum configuration file: yum- config-manager-- add-repo= http://mirrors.sohu.com/centos/6.9/os/x86_64/yum- config-manager-- disable "warehouse name" disable warehouse yum- config-manager-- enable "warehouse name" enable the usage of the warehouse yum command: yum [options] [command] [package.] Yum repolist all shows what software is in the yum repository yum list shows the program name yum search finder whether there is a yum install installer, and installs the dependent program yum history to view the operation history of yum yum reinstall reinstall Some software installation prompts that the installation has been uninstalled unexpectedly during installation yum Update upgrade package yum check-update checks available upgrade yum remove | erase uninstalls the software, does not uninstall the dependent package yum provide installed during installation, which package provides yum clean all to clear the local cache, and each time changes the configuration file of the client to point to the address It is recommended to clear the yum makecache to establish a local cache
Several common options:
-- nogpgcheck: disable gpgcheck-y automatic answer "y"-Q silent mode
Log file history for yum operations: / var/log/yum.log
The variable available to the yum configuration file: $arch$basearch$releasever. If rpm is uninstalled, how can I solve the need to install software?
The third way to manage the software package: source code compilation, compilation and installation, the advantages can also be installed according to the characteristics of the platform to achieve the best performance.
General installation steps (only installation): source code-- > preprocessing-- > compilation-- > assembly-- > link-- > execute
1. Decompress the source code xxx.tar.bz2 or other types
2. Cd enters the directory compiled by the source code
3. / configure-- prefix=/PATH/INSTALL/ generates MakeFile template files (pre-processing)
4. Make compilation
5. Make install compilation and installation
Let's do some actual combat and familiarize ourselves with the knowledge above.
Compile and install apache service program httpd in centos 6, and try to automate batch compilation and installation?
1. Analyze the program on which the httpd-2.2.32 source code is compiled (the version may be different) and install it first.
(1) apr-1.5.2
(2) apr-util-1.5.4
(3) apr-iconv-1.2.1
(4) .pcre-8.40: install this dependency package through testing, which requires a gcc,gcc-c++ compiler. Install it first in the previous step.
two。 After analyzing the main dependency package, I am here is the centos6 version, depending on the situation may have no shortage, first install the dependency package.
The first dependency package is also dependent on the second or third dependency packages, so install the first dependency package first.
Installation of 1.apr-1.5.2.
Wget http://www-eu.apache.org/dist/apr/apr-1.5.2.tar.bz2 tar jxf apr-1.5.2.tar.bz2 # decompress the dependency package cd apr-1.5.2.tar.bz2
. / configure-- prefix=/home/apache/apr
Make # compilation
Make instal # compilation and installation
2. Installation of apr-util
Wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.bz2
Tar jxf apr-util-1.5.4.tar.bz2 # decompress the dependency package cd apr-util-1.5.4. / configure-- with-apr=/home/apache/apr/-- prefix=/home/apache/apr-util make # compile and install the dependency package make install
Installation of 3.apr-iconv
Wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-iconv-1.2.1.tar.bz2
Tar jxf apr-iconv-1.2.1.tar.bz2 # compile and install dependency package
Cd apr-iconv-1.2.1
. / configure-- prefix=/home/apache/apr-iconv
Make
Make install
Compilation and installation of 4.pcre-8.40
Install gcc and gcc-c++ before installing him, need them to compile, here I directly use yum to install gcc and gcc-c++, if there is really no rpm program, we should consider the source code to install these two compilers.
Wget-c https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.bz2 tar jxf pcre-8.40.tar.bz2 # compile and install the dependency package cd pcre-8.40. / configure-- prefix=/home/apache/pcre & > / dev/null make & > / dev/null make install
3. After installing the dependency package, begin to install the main program httpd.
Wget-c https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.2.32.tar.bz2 tar jxf httpd-2.2.32.tar.bz2 cd httpd-2.2.32. / configure-- prefix=/home/apache/httpd-- with-apr=/home/apache/apr-- sysconfdir=/etc/apache # I indicate the installation path and the configuration file path here It is easy to find make & > / dev/null # to compile and install httpd program make install
4. When the installation is complete, start the Apache httpd program at an exciting time.
/ home/apache/httpd/bin/apachectl start # start command of the httpd program
5. Open port 80 of the Linux firewall or turn it off temporarily (I'll turn it off here).
Iptables-F
6. Enter my Linux host ip address in the browser and see It works! The word proves that it is done and has successfully owned its own website!
According to the above idea, start to automate batch compilation and installation? #! / bin/bash # # version 0.9 # OLDPWD=$ (pwd) # save the path of the current program echo-e "\ 033 [31mWARNING:The operation is will be uninstall old httpd!\ 033 [0minstalling apache site on centos6] Wating please... "echo-e" [# #] 10 "rpm-qa | grep apr-util & > / dev/null & & yum-y remove apr-util & > / dev/null # erase the previously installed apr-util program rpm-qa | grep apr-icon & > / dev/null & & yum-y remove apr-icon & > / dev/null # clear the previously installed apr-icon program rpm-qa | grep apr & > / dev/null & & yum-y remove apr & > / dev/null # clears the previously installed apr program rpm-qa | grep httpd & > / dev/null & & yum-y remove httpd & > / dev/null # clears the previously installed httpd program if [!-e. / apr-1.5.2.tar.bz2] Then # determines whether wget-c http://www-eu.apache.org/dist/apr/apr-1.5.2.tar.bz2 & > / dev/nullfi tar jxf apr-1.5.2.tar.bz2 cd apr-1.5.2. / configure-- prefix=/home/apache/apr & > / dev/null # compiles and installs the apr dependency package make & > / dev / null make install & > / dev/null cd "$OLDPWD" echo-e "[#] 20%" if [!-e. / apr-util-1.5.4.tar.bz2] Then # determines whether wget-c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.bz2 & > / dev/nullfi tar jxf apr-util-1.5.4.tar.bz2 # decompresses the dependency package cd apr-util-1.5.4 # compiles and installs the dependency package. / configure-- with-apr=/home / apache/apr/-- prefix=/home/apache/apr-util & > / dev/null make & > / dev/null make install & > / dev/null cd "$OLDPWD" echo-e "[#] 30%" if [!-e. / apr-iconv-1.2.1.tar.bz2] Then # compilation and installation dependent package wget-c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-iconv-1.2.1.tar.bz2 & > / dev/nullfi tar jxf apr-iconv-1.2.1.tar.bz2 cd apr-iconv-1.2.1. / configure-- with-apr=/home/apache/apr-- prefix=/home/apache/apr-iconv & > / dev/null make & > / dev/null Make install & > / dev/null cd "$OLDPWD" echo-e "[#] 40%" yum install-y gcc gcc-c++ & > / dev/null # dependent package pcre compilation and installation requires gcc and gcc-c++if [!-e. / pcre-8.40.tar.bz2] Then wget-c https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.bz2 & > / dev/nullfi tar jxf pcre-8.40.tar.bz2 # compile and install dependency package cd pcre-8.40. / configure-- prefix=/home/apache/pcre & > / dev/null make & > / dev/null make install & > / dev/null cd "$OLDPWD" echo-e "[# # #] 60% "if [!-e. / httpd-2.2.32.tar.bz2] Then wget-c https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.2.32.tar.bz2 & > / dev/nullfi tar jxf httpd-2.2.32.tar.bz2 cd httpd-2.2.32. / configure-- prefix=/home/apache/httpd-- with-apr=/app/apache/apr-- sysconfdir=/etc/apache\-- with-apr -util=/app/apache/apr-util-- with-pcre=/app/apache/pcre & > / dev/null make & > / dev/null # compile and install the httpd program make install & > / dev/nullecho-e "[#] 100% install complete" echo-e "staring site...\ nEnter your IP address in browser." / home/apache/httpd/bin / apachectl start & > / dev/null # launch the apache program echo "apache server is installed at `date +% Fmuri% T` You can see / home/apache/install.log "echo-e" Install_Package: apr-1.5.2.tar.bz2 Install_Path: / home/apache/apr\ nInstall_Package: apr-util-1.5.4.tar.bz2 Install_Path: / home/apache/apr-util\ nInstall_Package: apr-iconv-1.2.1.tar.bz2 Install_Path: / home/apache/apr-iconv\ nInstall_Package: pcre-8.40.tar.bz2 Install _ Path: / home/apache/pcre\ nInstall_Package: httpd-2.2.32.tar.bz2 Install_Path: / home/apache/httpd Configfile_dir: / etc/apache "> > / home/apache/install.log # generate a log to let you know how the program is installed
The above script I implemented on centos6 Everthing, other distributions have not been tested. Recently, there are some problems in passing the miniinstall test, and some changes have been made. You can also modify the installation path and version according to your own situation. Here, only the main function has been completed, and some of the functional experience may not be optimized, which can be optimized and adjusted according to your situation. Apache server implemented in this way is not managed by service httpd start. In later study, I will continue to write management scripts using service commands. If you are an apache configuration rookie directly copy the above shell code finished running, you can access the page!
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.