温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Debian、Ubuntu系统中开机启动设置

发布时间:2020-02-28 00:10:22 来源:网络 阅读:1977 作者:往事_Jim_遗 栏目:系统运维

   Unix系统使用比较广泛的便是Linux系统,而基于Linux内核下也有很多衍生的其他的系统,其中就有Debian、Ubuntu这类的系统,在Linux系统下平时使用习惯的开机启动/etc/rc.local或/etc/rc.d/rc.local就没有了,那在Debian、Ubuntu下需要开启启动时就需要使用update-rc.d用来定义开机启动的命令 ,举一个简单的例子在Debian、Ubuntu开机启动iptables:

  在Debian、Ubuntu中iptables并没有被做成类似Linux下的服务,所以需要启动时就用到update-rc.d,通过man手册得知update-rc.d需要在/etc/init.d目录下有启动文件,所以在Debian、Ubuntu下开启iptables就可以通过以下方式:

root@localhost:/usr/local/scripts# vim iptables.sh
#!/bin/bash
/sbin/iptables-restore < /usr/local/scripts/iptables
root@localhost:/usr/local/scripts# ln -sv /usr/local/scripts/iptables.sh /etc/init.d/iptables
root@localhost:/usr/local/scripts# update-rc.d iptables defaults

这样就在开机启动时就会把自行定义写好的iptables文件导入启用,而在update-rc.d定义一些系统中的服务开机自启也很简单,如开启自启ssh服务:

root@localhost:/usr/local/scripts# update-rc.d ssh enable

这样就启用了开机自启ssh服务,类似于Linux系统下的chkconfig、systemctl,当然更多的使用方法可以参看man帮助手册。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI