aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-03-28 13:40:45 -0400
committerEugene Triguba <hello@eugenetriguba.com>2026-03-28 13:40:45 -0400
commit792c1edc7cca37e22d3163b19aa8497d0aaf7b04 (patch)
tree75817fd0214f6771e8dffe1165551b69610bcc4a
parentUse env file and break out setup-plex into two scripts (diff)
downloadplex-setup-792c1edc7cca37e22d3163b19aa8497d0aaf7b04.zip
Add tailscale setup script
-rw-r--r--README.md15
-rwxr-xr-xsetup-tailscale.sh56
2 files changed, 69 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2ef26f6..68f49b5 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Server on Ubuntu. I run this on a Raspberry Pi 4B.
* [Install Docker](#install-docker)
* [Set up External Drive](#set-up-external-drive)
* [5. Start Plex](#5.-start-plex)
+* [Tailscale Setup](#tailscale-setup)
## Installation
@@ -45,7 +46,6 @@ cp .env.example .env
#### Install Docker
```sh
-chmod +x setup-docker.sh
sudo ./setup-docker.sh
```
@@ -55,7 +55,6 @@ If you're using an external hard drive for your media, set up the fstab entry
for it:
```sh
-chmod +x setup-drive.sh
sudo ./setup-drive.sh
```
@@ -77,3 +76,15 @@ sudo mount -a
```sh
docker compose up --detach
```
+
+## Tailscale Setup
+
+If you want to have access to your server outside of your home network, you can
+setup tailscale to do so.
+
+```sh
+scp setup-tailscale.sh <username>@<server>:/home/<username>/
+sudo ./setup-tailscale.sh
+```
+
+The script will print a URL to authenticate in a browser.
diff --git a/setup-tailscale.sh b/setup-tailscale.sh
new file mode 100755
index 0000000..9c360ab
--- /dev/null
+++ b/setup-tailscale.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+set -e
+
+main() {
+ parse_args "$@"
+ install_tailscale_gpg_key
+ add_tailscale_repository
+ install_tailscale
+ start_tailscale
+}
+
+parse_args() {
+ case "${1:-}" in
+ -h | --help) usage ;;
+ esac
+}
+
+usage() {
+ echo "Usage: sudo ./setup-tailscale.sh [-h]"
+ echo ""
+ echo "Installs Tailscale on Ubuntu."
+ exit 0
+}
+
+install_tailscale_gpg_key() {
+ _pkg_url=$(_get_tailscale_ubuntu_pkg_url)
+ _download_file "${_pkg_url}.noarmor.gpg" "/usr/share/keyrings/tailscale-archive-keyring.gpg"
+}
+
+add_tailscale_repository() {
+ _pkg_url=$(_get_tailscale_ubuntu_pkg_url)
+ _download_file "${_pkg_url}.tailscale-keyring.list" "/etc/apt/sources.list.d/tailscale.list"
+}
+
+_get_tailscale_ubuntu_pkg_url() {
+ # shellcheck disable=SC1091
+ _codename=$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
+ echo "https://pkgs.tailscale.com/stable/ubuntu/${_codename}"
+}
+
+_download_file() {
+ _url="$1"
+ _fs_location="$2"
+ sudo curl --fail --silent --show-error --location "$_url" --output "$_fs_location"
+}
+
+install_tailscale() {
+ sudo apt-get update
+ sudo apt-get install --yes tailscale
+}
+
+start_tailscale() {
+ sudo tailscale up
+}
+
+main "$@"