Ubuntu 下没有chkconfig命令

问题

使用 chkconfig 使能一个服务自启动

root@iZbp1hdp3rovo0jog817s1Z:/etc/nginx# chkconfig --add nginx
chkconfig: command not found

无法找到该命令,自然想到安装该命令

root@iZbp1hdp3rovo0jog817s1Z:/etc/nginx# sudo apt-get install chkconfig
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package chkconfig is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'chkconfig' has no installation candidate

不存在该命令

解决方法

The command chkconfig is no longer available in Ubuntu.The equivalent
command to chkconfig is update-rc.d.This command nearly supports all
the new versions of ubuntu.

The similar commands are

update-rc.d <service> defaults 
update-rc.d <service> start 20 3 4
5 update-rc.d -f <service>  remove 

翻译一下

命令chkconfig在Ubuntu中不再可用。chkconfig的等效命令是update rc.d、这个命令几乎支持所有新版本的 ubuntu
类似的命令如下:

update-rc.d <service> defaults 
update-rc.d <service> start 20 3 4 5 
update-rc.d -f <service>  remove 

参考文档
https://stackoverflow.com/questions/20680050/how-do-i-install-chkconfig-on-ubuntu

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu上,可以使用`update-rc.d`命令代替`chkconfig`命令来管理服务的启动和停止。该命令提供了一种简单的方式来设置服务在不同运行级别下的启动顺序和停止顺序。 通过运行`update-rc.d`命令,你可以激活、禁用和删除服务,以及设置服务在不同运行级别下的启动和停止顺序。例如,要将`sshd`服务设置为默认运行级别下的启动服务,可以运行`update-rc.d sshd defaults`命令。 要禁用`sshd`服务,可以运行`update-rc.d -f sshd remove`命令。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu上支持chkconfig命令](https://download.csdn.net/download/fwl123456lwf/86399134)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [ubuntu无法使用chkconfig命令](https://blog.csdn.net/u012377393/article/details/54022251)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Ubuntu中的chkconfig命令](https://blog.csdn.net/chongsui7677/article/details/100805363)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值