1.yum安装httpd服务

1 [root@localhost ~]# yum install httpd 2 Loaded plugins: fastestmirror 3 mirrors.163.com_centos_7_os_x86_64_ | 3.6 kB 00:00:00 4 Determining fastest mirrors 5 Resolving Dependencies 6 --> Running transaction check 7 ---> Package httpd.x86_64 0:2.4.6-67.el7.centos will be installed 8 --> Processing Dependency: httpd-tools = 2.4.6-67.el7.centos for package: httpd-2.4.6-67.el7.centos.x86_64 9 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-67.el7.centos.x86_64 10 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.x86_64 11 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.x86_64 12 --> Running transaction check 13 ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed 14 ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed 15 ---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos will be installed 16 ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed 17 --> Finished Dependency Resolution 18 19 Dependencies Resolved 20 21 ============================================================================================================================================================================ 22 Package Arch Version Repository Size 23 ============================================================================================================================================================================ 24 Installing: 25 httpd x86_64 2.4.6-67.el7.centos mirrors.163.com_centos_7_os_x86_64_ 2.7 M 26 Installing for dependencies: 27 apr x86_64 1.4.8-3.el7 mirrors.163.com_centos_7_os_x86_64_ 103 k 28 apr-util x86_64 1.5.2-6.el7 mirrors.163.com_centos_7_os_x86_64_ 92 k 29 httpd-tools x86_64 2.4.6-67.el7.centos mirrors.163.com_centos_7_os_x86_64_ 87 k 30 mailcap noarch 2.1.41-2.el7 mirrors.163.com_centos_7_os_x86_64_ 31 k 31 32 Transaction Summary 33 ============================================================================================================================================================================ 34 Install 1 Package (+4 Dependent packages) 35 36 Total download size: 3.0 M 37 Installed size: 10 M 38 Is this ok [y/d/N]: y 39 Downloading packages: 40 (1/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00 41 (2/5): apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00:00 42 (3/5): httpd-tools-2.4.6-67.el7.centos.x86_64.rpm | 87 kB 00:00:01 43 (4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00 44 (5/5): httpd-2.4.6-67.el7.centos.x86_64.rpm | 2.7 MB 00:00:01 45 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 46 Total 1.7 MB/s | 3.0 MB 00:00:01 47 Running transaction check 48 Running transaction test 49 Transaction test succeeded 50 Running transaction 51 Installing : apr-1.4.8-3.el7.x86_64 1/5 52 Installing : apr-util-1.5.2-6.el7.x86_64 2/5 53 Installing : httpd-tools-2.4.6-67.el7.centos.x86_64 3/5 54 Installing : mailcap-2.1.41-2.el7.noarch 4/5 55 Installing : httpd-2.4.6-67.el7.centos.x86_64 5/5 56 Verifying : httpd-2.4.6-67.el7.centos.x86_64 1/5 57 Verifying : mailcap-2.1.41-2.el7.noarch 2/5 58 Verifying : apr-1.4.8-3.el7.x86_64 3/5 59 Verifying : httpd-tools-2.4.6-67.el7.centos.x86_64 4/5 60 Verifying : apr-util-1.5.2-6.el7.x86_64 5/5 61 62 Installed: 63 httpd.x86_64 0:2.4.6-67.el7.centos 64 65 Dependency Installed: 66 apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-67.el7.centos mailcap.noarch 0:2.1.41-2.el7 67 68 Complete!
### httpd服务依赖apr、apr-util、httpd-tools以及mailcap四个安装包
2.启动httpd服务
systemctl start httpd.service
3.查看httpd服务
[root@localhost ~]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2018-03-20 05:07:23 EDT; 1min 48s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 1271 (httpd) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─1271 /usr/sbin/httpd -DFOREGROUND ├─1272 /usr/sbin/httpd -DFOREGROUND ├─1273 /usr/sbin/httpd -DFOREGROUND ├─1274 /usr/sbin/httpd -DFOREGROUND ├─1275 /usr/sbin/httpd -DFOREGROUND └─1276 /usr/sbin/httpd -DFOREGROUND Mar 20 05:07:23 localhost systemd[1]: Starting The Apache HTTP Server... Mar 20 05:07:23 localhost httpd[1271]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' ...his message Mar 20 05:07:23 localhost systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full.