1、创建rc.local
sudo touch /etc/systemd/system/rc-local.service
在rc-local.service填入下面内容:
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
然后
sudo touch /etc/rc.local
chmod 777 /etc/rc.local
在rc.local中填入以下内容