Setting up AdGuard Home with Alpine Linux

Deploying AdGuard Home with Alpine Linux can be done with OpenRC, as Alpine Linux uses OpenRC for its init system instead of systemd. The manual steps are shown below. I created a script and uploaded it to my GitHub repository as well.

Manual Installation

  1. Head on over to the rmyeleases page for the AdGuard Home over on GitHub.
  2. Download the release for your architecture. You can find out which architecture you are on by running the command uname -m. I download it using wget to my home directory.
  3. Extract the folder to the /opt/ directory. You can do this by running the following command.
doas tar -xvf AdGuardHome*.tar.gz -C /opt/

4.  Create a file  /etc/init.d/AdGuardHome. Change the file permissions to 755 afterwards by running the following command.

doas chmod 755 /etc/init.d/AdGuardHome

#!/sbin/openrc-run

description="AdGuard Home"

pidfile="/run/$RC_SVCNAME.pid"
command="/opt/AdGuardHome/AdGuardHome"
command_args="-s run"
command_background=true

extra_commands="checkconfig"

depend() {
  need net
  provide dns
  after firewall
}

checkconfig() {
  "$command" --check-config || return 1
}

stop() {
  if [ "${RC_CMD}" = "restart" ] ; then
    checkconfig || return 1
  fi

  ebegin "Stopping $RC_SVCNAME"
  start-stop-daemon --stop --exec "$command" \
    --pidfile "$pidfile" --quiet
  eend $?
}
Script created by https://vladislav.xyz/posts/adguard-on-alpine-linux/

Tip: The files in the /etc/init.d/ directory have the same file permissions. A quick way to get the octal file permissions is by running the stat command. You can get the file permissions for the files by running the following command.

stat -c '%a' /etc/init.d/*

5. Enable the service by running doas rc-update add AdGuardHome

6. Start the service by running doas rc-service AdGuardHome start

AdGuardHome should be running now and you can configure it by accessing it via its IP address on port 3000.

Install with a script

I created a script and added it to my GitHub repository. The repository and instructions can be found here.