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

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帮助手册。


本文名称:Debian、Ubuntu系统中开机启动设置
浏览路径:http://hxwzsj.com/article/ccdphhc.html
Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 成都网站建设 温江网站设计 成都网站建设 成都响应式网站建设 成都网站建设 四川成都网站建设 网站建设推广 成都网站设计 营销型网站建设 成都网站建设 成都网站建设 响应式网站建设 网站设计制作 外贸网站建设 成都网站建设 成都网站制作 网站制作报价 成都h5网站建设 营销型网站建设 网站设计 成都网站建设 成都网站制作