首页 > 信息技术 > 红帽认证 > systemctl enable --now开机

systemctl enable --now开机

红帽认证 · 考点例题与解析
📘 教材推导
📘 依据出处:该考点依据教材与考试大纲整理,无单一条款出处
单选题
运维工程师小张在RHEL 9上配置了httpd服务,希望该服务开机自启并立即启动。下列命令组合正确的是?
A. systemctl start --enable httpd
B. systemctl enable --now httpd
C. chkconfig httpd on && service httpd start
D. systemctl enable httpd && init httpd start
正确答案:B
依据 man page systemctl(1),systemctl enable --now 同时完成设置开机自启与立即启动两个动作。B 选项参数顺序不符合语法;chkconfig 与 service 属于 SysV 兼容工具,在 RHEL 9 中已被 systemctl 取代;init httpd start 语法错误,故B正确。
单选题
系统管理员小王发现RHEL 9服务器上的httpd服务未随系统启动而自动运行,他需要将该服务设置为开机自启并立即启动。下列哪组命令能同时完成这两项操作?
A. systemctl start --now httpd
B. chkconfig httpd on 后执行 systemctl start httpd
C. systemctl enable httpd 后执行 service httpd start
D. systemctl enable --now httpd
正确答案:D
systemctl(1) 手册说明 enable --now 等价于同时执行 enable 和 start,可一次性设置开机自启并立即启动;start --now 语法无效,service 命令为旧式兼容工具,chkconfig 在 RHEL 9 中已不再支持。

红帽认证·其他考点

进入「systemctl enable --now开机」专项练习 → 查看红帽认证全部题目 →
内容依据教材推导整理 · 智学通