Debian
1.创建rc.local文件
cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
EOF
2.添加权限
chmod 744 /etc/rc.local
3.启动
systemctl start rc-local
Centos8
将 rc.local 文件设置为可执行文件
chmod +x /etc/rc.d/rc.local
启动
systemctl start rc-local
设置为开机启动
systemctl enable rc-local