Enable /etc/rc.local with Systemd

If you are running a Linux distro that uses Systemd, then you may find that your command in /etc/rc.local file would not run at system boot time. This guide explains how to enable /etc/rc.local script to run on system startup.

As root user

  • systemctl status rc-local

if it says – Active: inactive (dead)

then you need to enable

  • systemctl enable rc-local

if you get – The unit files have no installation config

The unit file have no Install section. As such Systemd can not enable it. First we need to create a file:

  • nano /etc/systemd/system/rc-local.service

Add the following

[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

To exit the file, Press Ctrl+X.

  • chmod +x /etc/rc.local

Make a rc-local file

  • printf ‘%s\n’ ‘#!/bin/bash’ ‘exit 0’ |  tee -a /etc/rc.local

add execute permission to /etc/rc.local file.

  • chmod +x /etc/rc.local

enable the service on system boot:

  • systemctl enable rc-local

Output should be – Created symlink /etc/systemd/system/multi-user.target.wants/rc-local.service -> /etc/systemd/system/rc-local.service.

Start the service and check its status

  • systemctl start rc-local.service
  • systemctl status rc-local.service

The output should be – Active: active (exited) since Fri 2022-07-15 15:57:31 UTC; 7s ago

Now you can – nano /etc/rc.local – edit as needed

Build your own PRIVATE search engine – Using SearXNG

Setup a server running Ubuntu 20.04 or Debian 11

We was using Debian 11 in a Container hosted in Proxmox

Login as root and update.

  • apt install && sudo apt upgrade -y

Install Docker

  • curl -fsSL https://get.docker.com -o get-docker.sh
  • sudo sh get-docker.sh

Install docker-compose

  • apt install docker-compose -y

Now we can move to the directory where we want to install Searx and using git
NOTE: if you don’t have git installed install it – apt install git

  • cd /usr/local
  • git clone https://github.com/searxng/searxng-docker.git

Verify that it copied correctly in to your current directory

  • ls

Now change in to the new directory

  • cd searxng-docker

adjust the content of the .env file

  • nano .env

Add you host name to SEARXING_HOSTNAME= your_host_name_here

If you want to use a SSL remove the # on the LETSENCRYPT= <email> and add you email address

exit the file using Ctrl+X hit “Y” and then “Enter”

Run this command to generate a key

sed -i “s|ultrasecretkey|$(openssl rand -hex 32) |g” searxng/settings.yml

Now to start SearX run this command

sudo docker-compose up -d

If you want to auto restart your on a reboot you will need to edit the docker-compose.yaml file

  • nano docker-compose.yaml

add restart: always after the followsing

environment:
– SEARXNG_HOSTNAME=${SEARXNG_HOSTNAME:-http://localhost:80}
– SEARXNG_TLS=${LETSENCRYPT_EMAIL:-internal}

…….

tmpfs:
– /var/lib/redis

……..

environment:
– SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/

 

now restart SearX

  • sudo docker-compose up -d