Linux 如何在 Ubuntu 上安装 chkconfig?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20680050/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install chkconfig on Ubuntu?
提问by user1960836
I am running Ubuntu 13.10, and I'm pretty new to Linux. I tried:
我正在运行 Ubuntu 13.10,我对 Linux 还很陌生。我试过:
$ sudo apt-get install chkconfig
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
包 chkconfig 不可用,但被另一个包引用。这可能意味着软件包丢失、已过时或只能从其他来源获得
E: 包 'chkconfig' 没有安装候选
I manually downloaded the package and unzipped it. The resulting folder has a file called:
我手动下载了这个包并解压了它。生成的文件夹中有一个名为:
chkconfig.install
But how do I run this? I tried this, but it didn't work.
但是我该如何运行呢?我试过这个,但没有用。
$ sudo chkconfig.install
采纳答案by JERRY
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.
该命令chkconfig
在 Ubuntu 中不再可用。与 等效的命令chkconfig
是update-rc.d
。该命令几乎支持所有新版本的 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
回答by Claudio
Chkconfig is no longer available in Ubuntu.
Chkconfig在 Ubuntu 中不再可用。
Chkconfig is a script. You can download it from here.
Chkconfig 是一个脚本。你可以从这里下载。
回答by V H
alias chkconfig=sysv-rc-conf
chkconfig --list
syntax
句法
sysv-rc-conf command line usage:
sysv-rc-conf --list [service name]
sysv-rc-conf [--level <runlevels>] <service name> <on|off>
回答by Tharanga Abeyseela
sysv-rc-conf is an alternate option for Ubuntu.
sysv-rc-conf 是 Ubuntu 的替代选项。
sudo apt-get install sysv-rc-conf
sysv-rc-conf --list xxxx
回答by Dave Horner
But how do I run this? I tried typing:
sudo chkconfig.install
which doesn't work.
但是我该如何运行呢?我尝试打字:
sudo chkconfig.install
这不起作用。
I'm not sure where you got this package or what it contains; A url of download would be helpful. Without being able to look at the contents of chkconfig.install; I'm surprised to find a unix tool like chkconfig to be bundled in a zip archive, maybe it is still yet to be uncompressed, a tar.gz? but maybe it is a shell script?
我不确定你从哪里得到这个包或它包含什么;下载网址会有所帮助。无法查看 chkconfig.install 的内容;我很惊讶地发现像 chkconfig 这样的 unix 工具被捆绑在一个 zip 存档中,也许它还没有被解压缩,一个 tar.gz?但也许它是一个shell脚本?
I should suggest editing it and seeing what you are executing.
我应该建议编辑它并查看您正在执行的操作。
sh chkconfig.install
or ./chkconfig.install
; which might work....but my suggestion would be to learn to use update-rc.d as the other answers have suggested but do not speak directly to the question...which is pretty hard to answer without being able to look at the data yourself.
sh chkconfig.install
或./chkconfig.install
; 这可能有效......但我的建议是学习使用 update-rc.d 作为其他答案的建议,但不要直接回答这个问题......如果不看就很难回答自己的数据。
回答by rickfoosusa
In Ubuntu /etc/init.d has been replaced by /usr/lib/systemd. Scripts can still be started and stoped by 'service'. But the primary command is now 'systemctl'. The chkconfig command was left behind, and now you do this with systemctl.
在 Ubuntu 中 /etc/init.d 已被 /usr/lib/systemd 取代。脚本仍然可以通过“服务”启动和停止。但主要命令现在是“systemctl”。chkconfig 命令被抛在后面,现在您可以使用 systemctl 来执行此操作。
So instead of:
所以而不是:
chkconfig enable apache2
You should look for the service name, and then enable it
您应该查找服务名称,然后启用它
systemctl status apache2
systemctl enable apache2.service
Systemd has become more friendly about figuring out if you have a systemd script, or an /etc/init.d script, and doing the right thing.
Systemd 在判断您是否有 systemd 脚本或 /etc/init.d 脚本并做正确的事情方面变得更加友好。
回答by Shaik Amer
Install this package in Ubuntu
:
安装这个包Ubuntu
:
apt install sysv-rc-conf
its a substitute for chkconfig
cmd.
它是chkconfig
cmd的替代品。
After install run this cmd:
安装后运行这个cmd:
sysv-rc-conf --list
It'll show all services in all the runlevels. You can also run this:
它将显示所有运行级别中的所有服务。你也可以运行这个:
sysv-rc-conf --level (runlevel number ex:1 2 3 4 5 6 )
Now you can choose which service should be active in boot time.
现在您可以选择启动时应激活的服务。