我正在学习网络知识,所以我正在看一本书。
目前,我正在我的 EC2 实例中设置一个 Web 服务器。当我sudo chkconfig --list httpd
按照书中的建议运行时,我收到一条错误消息
[ec2-user@ip-10-0-1-10 ~]$ sudo chkconfig --list httpd
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
error reading information on service httpd: No such file or directory
所以我尝试了一下sudo chkconfig --list
,结果给了我这个
[ec2-user@ip-10-0-1-10 ~]$ sudo chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
似乎错误发生在我期望的时候
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
但我得到的却是
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
这对我来说似乎很奇怪,我找不到原因。因此,我想问
问题
- 为什么这里
httpd
没有被调用network
?我之前已经创建过 LAMP 实例(使用不同的命令),实际上从未遇到过问题。 - 为什么
systemctl
不被使用chkconfig
?
附言
版本信息
[ec2-user@ip-10-0-1-10 ~]$ yum list httpd
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
httpd.x86_64 2.4.39-1.amzn2.0.1 @amzn2-core
答案1
我想到了!
因为我当时正在使用Amazon Linux 2 AMI (HVM),SSD 卷类型。我通过使用 **Amazon Linux AMI 2018.03.0 (HVM)、SSD 卷类型** 解决了这个问题
在 Linux 2 实例中,chkconfig 的使用似乎已经被 systemctl 取代。