Would you like to learn how to enable rc.local on Ubuntu Linux? In this tutorial, we are going to show you how to enable the rc.local service on Ubuntu linux version 17.
Hardware List:
The following section presents the list of equipment used to create this Ubuntu Linux tutorial.
Every piece of hardware listed above can be found at Amazon website.
Ubuntu Playlist:
On this page, we offer quick access to a list of videos related to Ubuntu Linux.
Don’t forget to subscribe to our youtube channel named FKIT.
Ubuntu Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Ubuntu linux.
Tutorial – Enable rc.local
On the Linux console, use the following commands to create the rc.local file and change its permission to become an executable file
# touch /etc/rc.local
# chmod 755 /etc/rc.local
After creating the rc.local file, we need to create the rc.local service configuration startup file.
# vi /etc/systemd/system/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
Now, let’s enable the rc.local service.
# systemctl enable rc-local
As the last step, let’s edit the rc.local file and add a few commands just to make sure that our test works.
# vi /etc/rc.local
#!/bin/bash
echo “TEST OK” > /tmp/rc.local.status
Reboot the computer and check if the /tmp/rc.local.status file was created by the rc.local service.
# reboot
# cat /tmp/rc.local.status
If the rc.local.status file was created automatically, this means that your rc.local service is enabled.