linux服务器 中httpd Apache安装方法
[root@dnax_web /]#whereis httpd
httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz
[root@dnax_web /]# yum -y install httpd*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package httpd-2.4.6-67.el7.centos.6.x86_64 already installed and latest version
Package httpd-tools-2.4.6-67.el7.centos.6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package httpd-devel.x86_64 0:2.4.6-67.el7.centos.6 will be installed
--> Processing Dependency: apr-util-devel for package: httpd-devel-2.4.6-67.el7.centos.6.x86_64
--> Processing Dependency: apr-devel for package: httpd-devel-2.4.6-67.el7.centos.6.x86_64
---> Package httpd-itk.x86_64 0:2.4.7.04-2.el7 will be installed
---> Package httpd-manual.noarch 0:2.4.6-67.el7.centos.6 will be installed
--> Running transaction check
---> Package apr-devel.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util-devel.x86_64 0:1.5.2-6.el7 will be installed
--> Processing Dependency: openldap-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Processing Dependency: libdb-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Processing Dependency: expat-devel(x86-64) for package: apr-util-devel-1.5.2-6.el7.x86_64
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package libdb-devel.x86_64 0:5.3.21-20.el7 will be installed
--> Processing Dependency: libdb(x86-64) = 5.3.21-20.el7 for package: libdb-devel-5.3.21-20.el7.x86_64
---> Package openldap-devel.x86_64 0:2.4.44-5.el7 will be installed
--> Processing Dependency: openldap(x86-64) = 2.4.44-5.el7 for package: openldap-devel-2.4.44-5.el7.x86_64
--> Processing Dependency: cyrus-sasl-devel(x86-64) for package: openldap-devel-2.4.44-5.el7.x86_64
--> Running transaction check
---> Package cyrus-sasl-devel.x86_64 0:2.1.26-21.el7 will be installed
--> Processing Dependency: cyrus-sasl-lib(x86-64) = 2.1.26-21.el7 for package: cyrus-sasl-devel-2.1.26-21.el7.x86_64
--> Processing Dependency: cyrus-sasl(x86-64) = 2.1.26-21.el7 for package: cyrus-sasl-devel-2.1.26-21.el7.x86_64
---> Package libdb.x86_64 0:5.3.21-19.el7 will be updated
--> Processing Dependency: libdb(x86-64) = 5.3.21-19.el7 for package: libdb-utils-5.3.21-19.el7.x86_64
---> Package libdb.x86_64 0:5.3.21-20.el7 will be an update
---> Package openldap.x86_64 0:2.4.40-13.el7 will be updated
---> Package openldap.x86_64 0:2.4.44-5.el7 will be an update
--> Running transaction check
---> Package cyrus-sasl.x86_64 0:2.1.26-21.el7 will be installed
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-20.el7_2 will be updated
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-21.el7 will be an update
---> Package libdb-utils.x86_64 0:5.3.21-19.el7 will be updated
---> Package libdb-utils.x86_64 0:5.3.21-20.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================
Package Arch Version Repository Size
====================================================================================================================
Installing:
httpd-devel x86_64 2.4.6-67.el7.centos.6 updates 194 k
httpd-itk x86_64 2.4.7.04-2.el7 epel 22 k
httpd-manual noarch 2.4.6-67.el7.centos.6 updates 1.3 M
Installing for dependencies:
apr-devel x86_64 1.4.8-3.el7 base 188 k
apr-util-devel x86_64 1.5.2-6.el7 base 76 k
cyrus-sasl x86_64 2.1.26-21.el7 base 88 k
cyrus-sasl-devel x86_64 2.1.26-21.el7 base 310 k
expat-devel x86_64 2.1.0-10.el7_3 base 57 k
libdb-devel x86_64 5.3.21-20.el7 base 38 k
openldap-devel x86_64 2.4.44-5.el7 base 801 k
Updating for dependencies:
cyrus-sasl-lib x86_64 2.1.26-21.el7 base 155 k
libdb x86_64 5.3.21-20.el7 base 719 k
libdb-utils x86_64 5.3.21-20.el7 base 132 k
openldap x86_64 2.4.44-5.el7 base 354 k
Transaction Summary
====================================================================================================================
Install 3 Packages (+7 Dependent packages)
Upgrade ( 4 Dependent packages)
Total download size: 4.4 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/14): apr-util-devel-1.5.2-6.el7.x86_64.rpm | 76 kB 00:00:00
(2/14): cyrus-sasl-2.1.26-21.el7.x86_64.rpm | 88 kB 00:00:00
(3/14): apr-devel-1.4.8-3.el7.x86_64.rpm | 188 kB 00:00:00
(4/14): cyrus-sasl-lib-2.1.26-21.el7.x86_64.rpm | 155 kB 00:00:00
(5/14): expat-devel-2.1.0-10.el7_3.x86_64.rpm | 57 kB 00:00:00
(6/14): cyrus-sasl-devel-2.1.26-21.el7.x86_64.rpm | 310 kB 00:00:00
(7/14): libdb-devel-5.3.21-20.el7.x86_64.rpm | 38 kB 00:00:00
(8/14): httpd-itk-2.4.7.04-2.el7.x86_64.rpm | 22 kB 00:00:00
(9/14): libdb-utils-5.3.21-20.el7.x86_64.rpm | 132 kB 00:00:00
(10/14): httpd-devel-2.4.6-67.el7.centos.6.x86_64.rpm | 194 kB 00:00:00
(11/14): openldap-2.4.44-5.el7.x86_64.rpm | 354 kB 00:00:00
(12/14): libdb-5.3.21-20.el7.x86_64.rpm | 719 kB 00:00:00
(13/14): openldap-devel-2.4.44-5.el7.x86_64.rpm | 801 kB 00:00:00
(14/14): httpd-manual-2.4.6-67.el7.centos.6.noarch.rpm | 1.3 MB 00:00:00
--------------------------------------------------------------------------------------------------------------------
Total 4.7 MB/s | 4.4 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libdb-5.3.21-20.el7.x86_64 1/18
Updating : cyrus-sasl-lib-2.1.26-21.el7.x86_64 2/18
Updating : openldap-2.4.44-5.el7.x86_64 3/18
Installing : apr-devel-1.4.8-3.el7.x86_64 4/18
Installing : cyrus-sasl-2.1.26-21.el7.x86_64 5/18
Installing : cyrus-sasl-devel-2.1.26-21.el7.x86_64 6/18
Installing : openldap-devel-2.4.44-5.el7.x86_64 7/18
Installing : libdb-devel-5.3.21-20.el7.x86_64 8/18
Installing : expat-devel-2.1.0-10.el7_3.x86_64 9/18
Installing : apr-util-devel-1.5.2-6.el7.x86_64 10/18
Installing : httpd-devel-2.4.6-67.el7.centos.6.x86_64 11/18
Updating : libdb-utils-5.3.21-20.el7.x86_64 12/18
Installing : httpd-manual-2.4.6-67.el7.centos.6.noarch 13/18
Installing : httpd-itk-2.4.7.04-2.el7.x86_64 14/18
Cleanup : openldap-2.4.40-13.el7.x86_64 15/18
Cleanup : cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 16/18
Cleanup : libdb-utils-5.3.21-19.el7.x86_64 17/18
Cleanup : libdb-5.3.21-19.el7.x86_64 18/18
Verifying : cyrus-sasl-2.1.26-21.el7.x86_64 1/18
Verifying : apr-util-devel-1.5.2-6.el7.x86_64 2/18
Verifying : apr-devel-1.4.8-3.el7.x86_64 3/18
Verifying : libdb-utils-5.3.21-20.el7.x86_64 4/18
Verifying : cyrus-sasl-lib-2.1.26-21.el7.x86_64 5/18
Verifying : cyrus-sasl-devel-2.1.26-21.el7.x86_64 6/18
Verifying : openldap-2.4.44-5.el7.x86_64 7/18
Verifying : httpd-itk-2.4.7.04-2.el7.x86_64 8/18
Verifying : libdb-5.3.21-20.el7.x86_64 9/18
Verifying : libdb-devel-5.3.21-20.el7.x86_64 10/18
Verifying : httpd-devel-2.4.6-67.el7.centos.6.x86_64 11/18
Verifying : openldap-devel-2.4.44-5.el7.x86_64 12/18
Verifying : expat-devel-2.1.0-10.el7_3.x86_64 13/18
Verifying : httpd-manual-2.4.6-67.el7.centos.6.noarch 14/18
Verifying : openldap-2.4.40-13.el7.x86_64 15/18
Verifying : libdb-utils-5.3.21-19.el7.x86_64 16/18
Verifying : cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 17/18
Verifying : libdb-5.3.21-19.el7.x86_64 18/18
Installed:
httpd-devel.x86_64 0:2.4.6-67.el7.centos.6 httpd-itk.x86_64 0:2.4.7.04-2.el7
httpd-manual.noarch 0:2.4.6-67.el7.centos.6
Dependency Installed:
apr-devel.x86_64 0:1.4.8-3.el7 apr-util-devel.x86_64 0:1.5.2-6.el7 cyrus-sasl.x86_64 0:2.1.26-21.el7
cyrus-sasl-devel.x86_64 0:2.1.26-21.el7 expat-devel.x86_64 0:2.1.0-10.el7_3 libdb-devel.x86_64 0:5.3.21-20.el7
openldap-devel.x86_64 0:2.4.44-5.el7
Dependency Updated:
cyrus-sasl-lib.x86_64 0:2.1.26-21.el7 libdb.x86_64 0:5.3.21-20.el7 libdb-utils.x86_64 0:5.3.21-20.el7
openldap.x86_64 0:2.4.44-5.el7
Complete!
[root@dnax_web /]# httpd -1
httpd: illegal option -- 1
Usage: httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
[root@dnax_web /]# httpd -q
httpd: illegal option -- q
Usage: httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
[root@dnax_web /]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16
[root@dnax_web /]# httpd -k stop
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.31.235.251. Set the 'ServerName' directive globally to suppress this message
httpd (no pid file) not running
[root@dnax_web /]# httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.31.235.251. Set the 'ServerName' directive globally to suppress this message
[root@dnax_web /]# httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.31.235.251. Set the 'ServerName' directive globally to suppress this message
httpd (pid 21333) already running
开启apache后,此时可访问服务器IP地址,如果可看到下图内容,则表明安装成功!