This guide will cover the manual installation of Linkwarden (non-Docker). I will also be using an existing, external PostgreSQL database.
Install the following dependencies (guides linked for the more in-depth installations)
Git
apt install -y git
You should now be able to successfully verify the installation of all latter packages
git --version && \
node --version && \
yarn --version && \
monolith --version
Clone
git clone https://github.com/linkwarden/linkwarden.git /opt/linkwarden && \
cd /opt/linkwarden/
Install project dependencies
yarn && \
npx playwright install --with-deps chromium
Copy the example env file, set the NEXTAUTH_SECRET variable and build the PostgreSQL URL
cp .env.sample .env && \
(grep -qxF NEXTAUTH_SECRET= .env && sed -i "s/NEXTAUTH_SECRET=/NEXTAUTH_SECRET=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 64)/" .env) || echo "Secret already defined or missing variable!" && \
vim .env
Create PSQL user and database
CREATE USER linkwarden WITH PASSWORD '**************';
CREATE DATABASE linkwarden OWNER linkwarden;
Build and setup the database
yarn build && \
yarn prisma migrate deploy
Ensure the app starts and runs as expected
yarn start
Create a new service file
bash -c "cat > /etc/systemd/system/linkwarden.service" <<'EOF'
[Unit]
Description=Linkwarden
After=network.target
[Service]
Type=simple
Restart=on-falure
RestartSec=10
User=root
Group=root
WorkingDirectory=/opt/linkwarden
ExecStart=/usr/local/bin/yarn start
[Install]
WantedBy=multi-user.target
EOF
Reload systemd and start the service
systemctl daemon-reload && \
systemctl enable --now linkwarden.service