In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces RedHat 7 how to install HTTPD, the content is very detailed, interested friends can refer to, hope to be helpful to you.
1. View operating system version
[root@aws srclib] # cat / etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
two。 Install apr first. This example is version 1.6.3.
Wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
After download, it will be decompressed.
Tar-xzvf apr-1.6.3.tar.gz
Go to the apr directory and execute the configure command, which is a parameter in this example and sets the installation directory
Cd / usr/local/src/apr-1.6.3
. / configure-- prefix=/usr/local/apr
Once configured, execute make and make install
Make & & make install
3. Install apr-util, the version of this example is 1.6.1
Wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2
You may encounter an error during decompression:
[root@aws src] # tar-jxvf apr-util-1.6.1.tar.bz2
Tar (child): bzip2: Cannot exec: No such file or directory
Tar (child): Error is not recoverable: exiting now
Tar: Child returned status 2
Tar: Error is not recoverable: exiting now
The solution is:
Yum-y install bzip2
Next, just like installing apr, run the configure command first
. / configure-prefix=/usr/local/apr-util-with-apr=/usr/local/apr
Then execute the installation command:
Make & & make install
You may encounter the following errors during installation:
Pr_xml.lo-c xml/apr_xml.c & & touch xml/apr_xml.lo
Xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
# include
^
Compilation terminated.
Make [1]: * * [xml/apr_xml.lo] Error 1
Make [1]: Leaving directory `/ usr/local/src/apr-util-1.6.1
The solution is to install the expat library
Yum install expat-devel
4. Install httpd
This example uses version 2.4.29
Wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
Similarly, after download, it will be decompressed.
Tar-xvzf httpd-2.4.29.tar.gz
Enter the directory and execute the configure command
/ configure-- prefix=/usr/local/apache2.4-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util-- enable-so-- enable-mods-shared=most-- with-included-apr
Enable-so means to enable DSO, that is, to present certain functions in the form of so
-- enable-mods-shared=most means that most functional modules are installed in a shared manner, which you will see in the modules directory after installation.
If you encounter the following error:
Checking for gcc option to accept ISO C99... -std=gnu99
Checking for pcre-config... False
Configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
The solution is:
Yum install-y pcre pcre-devel
Finally compile and install
Make
Make install
Either of the above steps can be done with the command echo $? To check whether the execution was successful.
An error may be reported in make as follows:
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'
/ usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'
Collect2: error: ld returned 1 exit status
Make [2]: * * [htpasswd] Error 1
Make [2]: Leaving directory `/ usr/local/src/httpd-2.4.29/support'
Make [1]: * * [all-recursive] Error 1
Make [1]: Leaving directory `/ usr/local/src/httpd-2.4.29/support'
Make: * * [all-recursive] Error 1
The solution is:
Cp-rf / usr/local/src/apr-1.6.3 / usr/local/src/httpd-2.4.29/srclib/apr
Cp-rf / usr/local/src/apr-util-1.6.1 / usr/local/src/httpd-2.4.29/srclib/apr-util
5. At this point, the httpd installation is complete.
You can view which modules are installed with the following command:
[root@aws srclib] # / usr/local/apache2.4/bin/apachectl-M
Loaded Modules:
Core_module (static)
So_module (static)
Http_module (static)
Mpm_event_module (static)
Authn_file_module (shared)
Authn_core_module (shared)
Authz_host_module (shared)
Authz_groupfile_module (shared)
Authz_user_module (shared)
Authz_core_module (shared)
Access_compat_module (shared)
Auth_basic_module (shared)
Reqtimeout_module (shared)
Filter_module (shared)
Mime_module (shared)
Log_config_module (shared)
Env_module (shared)
Headers_module (shared)
Setenvif_module (shared)
Version_module (shared)
Unixd_module (shared)
Status_module (shared)
Autoindex_module (shared)
Dir_module (shared)
Alias_module (shared)
Php5_module (shared)
The word shared indicates that the module is a dynamic sharing module; static is a static module.
The difference between dynamic and static is that static modules are directly bound to the main program (/ usr/local/apache2.4/bin/httpd), which we cannot see, while dynamic modules are independent files, that is, .so files in the modules directory.
6. Configure httpd to support php
a. Edit the httpd.conf file (/ usr/local/apache2.4/conf/httpd.conf), search for ServerName, and remove the # before ServerName www.example.com:80
b. Find the following
AllowOverride none
Require all denied
Modify to
AllowOverride none
Require all granted
c. Search the following line again.
AddType application/x-gzip .gz .tgz
Add at the bottom of the line above
AddType application/x-httpd-php .php
d. Find the following paragraph
DirectoryIndex index.html
Modify to
DirectoryIndex index.html index.php
7. Check whether the configuration file is correct before startup. Syntax OK appears, indicating that there is no problem.
[root@aws php-5.6.30] # / usr/local/apache2.4/bin/apachectl-t
Syntax OK
8. The command to start httpd is as follows:
/ usr/local/apache2.4/bin/apachectl start
9. The command to see if it starts is as follows:
[root@aws srclib] # netstat-lnp | grep httpd
Tcp6 0 0: 80: * LISTEN 30298/httpd
10. Do a simple test, and the appearance of It works indicates that the test is successful
[root@aws srclib] # curl localhost
It works!
About RedHat 7 how to install HTTPD to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.