昨天刚刚买完了阿里云,准备大干一场有点小小的激动。java
我选择的镜像系统式centos7,我原来使用过centos6.5 因此以为使用起来应该问题不大。linux
首先,就是先更新一下系统的软件,在更新以前先了解一下更新的方法的区别。centos
yum -y update 升级全部包,改变软件设置和系统设置,系统版本内核都升级 yum -y upgrade 升级全部包,不改变软件设置和系统设置,系统版本升级,内核不改变
第一个听起来有点吓人,可是想到我是刚刚新的系统上面没有什么软件因此大胆的开始干吧。服务器
执行了阿里云
yum -y update 执行就进行等待centos7
终于ok了spa
下一步我要启动httpd这个服务器看看个人公网ip能不能访问到个人云服务器上,我使用了code
service httpd start //注意:在centos 7 已经不是这个命令了,我已开始不知道遇到问题了ip
Redirecting to /bin/systemctl start httpd.service Failed to issue method call: Unit httpd.service failed to load: No such file or directory. 有两行问题 第一行告诉我 service httpd start 已经不用了要使用 systemctl start http.service 第二行告诉我 个人服务器上尚未httpd.service的文件。我还没装httpd的服务
好吧,这是怎么回事,我记得httpd应给是liunx系统自带了,因而去问问度娘。。。。it
找了一篇看了看经过运行 chkconfig --list发现没有linux服务列表中httpd,经过chkconfig --add httpd来添加,可是提示:服务 httpd 不支持 chkconfig。须要编辑/etc/rc.d/init.d/httpd,田间以下注释信息:(注意:是注释信息,一开始我没在觉得是直接配置进去就能够了,后来我发现我错了)。
# chkconfig: 345 85 15 # description: Activates/Deactivates Apache Web Server 第一行3个数字参数意义分别是:那些linux级别须要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行 chkconfig --add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的连接文件,其余运行级别路径中会出现K61httpd的连接文件。
再运行chkconfig –list httpd
aegis 0:关 1:关 2:开 3:开 4:开 5:开 6:关 agentwatch 0:关 1:关 2:开 3:开 4:开 5:开 6:关 httpd 0:关 1:关 2:关 3:开 4:开 5:开 6:关 netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 network 0:关 1:关 2:开 3:开 4:开 5:开 6:关
我觉得之下就大功搞成了,结果我又错了:-(
后来又看了一篇文章。
针对CentOS7,httpd有专门的版本,此版本提供了针对systemd的单元文件,以下所示
yum install httpd
等待安装
rpm -ql httpd | grep service
/usr/lib/systemd/system/htcacheclean.service /usr/lib/systemd/system/httpd.service 发现安装好了
执行一下
systemctl start httpd.service //启动httpd服务
systemctl enable httpd //关闭httpd服务