Skip to content

Instantly share code, notes, and snippets.

@delfer
Last active October 29, 2024 12:57
Show Gist options
  • Save delfer/efa0a0bcf6393df255617ed8d1f3f14b to your computer and use it in GitHub Desktop.
Save delfer/efa0a0bcf6393df255617ed8d1f3f14b to your computer and use it in GitHub Desktop.
Instal Outline Server without Docker
# Tested on:
# - Ubuntu 20.04 LTS
# - Ubuntu 22.04.2 LTS
#
# Tested with https://github.com/Jigsaw-Code/outline-server/commit/9a3498112d5f7c59f7017e1666678e2921fad46f from May 16 2024
# Install prerequirements
# 7zip to extract zip
apt install p7zip-full
# task to run app
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
# Node.js
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source /root/.bashrc
nvm install 18
# Download latest code
wget https://github.com/Jigsaw-Code/outline-server/archive/refs/heads/master.zip
# Extract
7z x master.zip
# Go to folder
cd outline-server-master/
# Insatll JS dependencies
npm install # Ignore "go: not found" error, it's OK
# Build Node.JS app
task shadowbox:build # ignore "go": executable file not
# Move built app
mv build/shadowbox/linux/x86_64 /opt/outline
# download prebuilded outline-ss-server binary
wget https://github.com/Jigsaw-Code/outline-ss-server/releases/download/v1.5.0/outline-ss-server_1.5.0_linux_x86_64.tar.gz
tar -xvf outline-ss-server_1.5.0_linux_x86_64.tar.gz
mv outline-ss-server /opt/outline/bin/
# Generate cert
cd /opt/outline
mkdir persisted-state
openssl req -x509 -nodes -days 36500 -newkey rsa:4096 -subj "/CN=$(curl --silent https://ipinfo.io/ip)" -keyout /opt/outline/persisted-state/shadowbox-selfsigned.key -out /opt/outline/persisted-state/shadowbox-selfsigned.crt
# Create conf file
echo "{\"hostname\": \"$(curl --silent https://ipinfo.io/ip)\"}" > persisted-state/shadowbox_server_config.json
# Create access.json (just for remind)
# ATTENTION! Replace 32689 with your own port (1024..65535)
# ATTENTION! Replace mySuperSSprefix with your own prefix $(head -c 16 /dev/urandom | safe_base64)
echo "{apiUrl:\"https://$(curl --silent https://ipinfo.io/ip):32689/mySuperSSprefix\",certSha256:\"$(openssl x509 -in /opt/outline/persisted-state/shadowbox-selfsigned.crt -noout -sha256 -fingerprint | cut -d= -f2 | tr -d :)\"}" > /opt/outline/access.json
# Copy it to Outline Manager
cat /opt/outline/access.json
# ATTENTION! Replace 32689 and mySuperSSprefix with your own port exactly like previous
SB_CERTIFICATE_FILE=/opt/outline/persisted-state/shadowbox-selfsigned.crt SB_PRIVATE_KEY_FILE=/opt/outline/persisted-state/shadowbox-selfsigned.key SB_METRICS_URL="" SB_API_PORT=32689 SB_API_PREFIX=mySuperSSprefix SB_STATE_DIR=/opt/outline/persisted-state node /opt/outline/app/main.js
# Let's go to Outline Manager and use it!
# ### OPTIONAL ###
# Also you can add main.js to startup, for examlpe create systemd unit file
# For example:
# Check where is node binary located
which node
# Check where to crate service file
systemctl status sshd | grep loaded | grep service
# Create service file, use vim or nano or etc.
vim /lib/systemd/system/outline.service
# Do not forget to change:
# - service file location (/lib/systemd/system/)
# - node binary location (/root/.nvm/versions/node/v18.20.3/bin/node)
# - API port (32689)
# - Prefix (mySuperSSprefix)
#
# FILE:
[Unit]
Description=Outline server
After=network.target
[Service]
Environment="SB_CERTIFICATE_FILE=/opt/outline/persisted-state/shadowbox-selfsigned.crt"
Environment="SB_PRIVATE_KEY_FILE=/opt/outline/persisted-state/shadowbox-selfsigned.key"
Environment="SB_METRICS_URL="
Environment="SB_API_PORT=32689"
Environment="SB_API_PREFIX=mySuperSSprefix"
Environment="SB_STATE_DIR=/opt/outline/persisted-state"
ExecStart=/root/.nvm/versions/node/v18.20.3/bin/node /opt/outline/app/main.js
Restart=on-failure
[Install]
WantedBy=multi-user.target
#
# END OF FILE
systemctl daemon-reload
systemctl enable outline
systemctl start outline
systemctl status outline
journalctl -u outline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment