On the latest debian/ubuntu version the /etc/rc.local file is deprecated, but we can add it back using systemd for those scripts or applications that still depend on it.
1. Should be logged in as root or run this command in your console:
2. Update and upgrade the VPS, run this command in your console:
3.Now open your console and run this commands:
4. Now open your console and run this commands; set the permissions:
5. Now open your console and run this commands:
6. Now open your console and run this commands:
7. Test if your rc.local is working, run this command in your console:
You can now add what you want back into the rc.local file.
1. Should be logged in as root or run this command in your console:
Code:
sudo su
2. Update and upgrade the VPS, run this command in your console:
Code:
apt-get update -y && apt-get upgrade -y && apt autoclean -y && apt autoremove
3.Now open your console and run this commands:
Code:
nano /etc/systemd/system/rc-local.service
Code:
[Unit]
Description=/etc/rc.local
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
Code:
nano /etc/rc.local
Code:
#!/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
4. Now open your console and run this commands; set the permissions:
Code:
chmod +x /etc/rc.local
5. Now open your console and run this commands:
Code:
systemctl enable rc-local
6. Now open your console and run this commands:
Code:
systemctl start rc-local
7. Test if your rc.local is working, run this command in your console:
Code:
systemctl status rc-local
You can now add what you want back into the rc.local file.