本文主要是介绍Cento OS7yum安装Apache,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
此次我使用yum命令安装apache http server,一般情况下安装好cento os后就自动安装了yum
我用MAC OS终端SSH到目标服务器后输入如下命令
[jerry@172 ~]$ yum install httpd
提示如下
已加载插件:fastestmirror, langpacks
您需要 root 权限执行此命令。
那么我们么用sudo
[jerry@172 ~]$ sudo yum install httpd
显示
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:#1) Respect the privacy of others.#2) Think before you type.#3) With great power comes great responsibility.[sudo] password for jerry:
输入密码后显示一堆软件安装信息看到如下键入y
Is this ok [y/d/N]: y
看到如下键入y
是否继续?[y/N]:y
直到看到如下
作为依赖被安装:httpd-tools.x86_64 0:2.4.6-40.el7.centos mailcap.noarch 0:2.1.41-2.el7
完毕!
接下来我们将http server安装成系统服务,这样可以在系统启动时自动启动http server
[jerry@172 ~]$ chkconfig --levels 235 httpd on
也可以禁止开机启动
[jerry@172 ~]$ chkconfig --levels 235 httpd off
现在我们启动服务
[jerry@172 ~]$ service httpd start
启动成功后在服务器浏览器中输入 http://localhost 可以看到欢迎页面
运行如下命令可以停止服务
[jerry@172 ~]$ service httpd stop
要注意的是安装服务、启动服务、停止服务都是需要输入密码
还有一个问题就是用yum安装的apache居然没办法和tomcat集成,如果需要做集群只能另外下载编译版的apache进行编译安装
这篇关于Cento OS7yum安装Apache的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!