MayVaneDay Studios

Archive ⋙ Tutorials 

 

How to install Misskey on Debian 9

last updated: 9-21-2019

 

  1. Create a user for Misskey:

adduser --disabled-password --disabled-login misskey

adduser misskey sudo

passwd misskey

Give the misskey user a strong password. Write it down somewhere safe.

  1. Add the Node.js and PostgreSQL repositories:

curl -sL https://deb.nodesource.com/setup_12.x |bash

echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list

cd /tmp

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

apt-get update

  1. Install Misskey’s dependencies:

apt-get install -y nodejs postgresql redis-server build-essential python certbot byobu sudo

  1. Set up a password for PostgreSQL:

passwd postgres

Write this password down somewhere safe. You’ll need it later.

  1. Download Misskey:

su - misskey

git clone -b master git://github.com/syuilo/misskey.git

cd misskey

git checkout master

npm install

  1. Configure Misskey:

cp .config/example.yml .config/default.yml

Edit .config/default.yml with your terminal editor of choice.

url should be the URL of your server.

Assuming you don’t know what you’re doing, which is probably true if you’re reading this, uncomment the line that says port: 443. This will make Misskey start its own web server on port 443 (the HTTPS port).

Uncomment the key: and cert: lines. Replace example.tld in the file path with the same URL as you used above, omitting the https:// at the beginning.

Under the user: postgres line, there should be a password line. Make sure it is uncommented and put in the password that you set up earlier.

Uncomment the autoAdmin: true line. This will make the first user registrated on the instance the admin of the instance. Hopefully this is you!

  1. Set up PostgreSQL:

exit

su - postgres

You are now logged in as the postgres user. Type in psql and press enter. A different command prompt should show up. Type in CREATE DATABASE misskey; and follow whatever instructions it gives you.

  1. Set up SSL:

exit

certbot certonly -d example.tld

example.tld should be the URL you previously configured in the Misskey config file. Make sure that your DNS is properly set up to point to your server’s IP address.

Follow the instructions Certbot gives you.

  1. Compile Misskey:

su - misskey

cd misskey

NODE_ENV=production npm run build

Sit back for a hot minute while it compiles. If you have 2 GB of less of RAM, pick a god and pray. If you have less than 1 GB of RAM and you’ve somehow made it this far, nuke your server and give up now.

After that’s done, run npm run init to set up the Misskey database.

  1. Run Misskey:

cd ~

byobu

You are now in Byobu. This is a window manager for the command line. This will allow you to daemonize Misskey (run it in the background) without using systemd, which is an absolute pain in the ass to diagnose and fix.

cd misskey

sudo NODE_ENV=production npm start

If everything looks good (there are no fatal error messages), open your configured URL in a web browser and complete setup from the web interface.

When you want to close the terminal, press Ctrl and A at the same time. Pick the first option for whatever Byobu nags you about. Press Ctrl and A again, and then press D. You should get a “detached from session” message. Log out of the misskey user and then the root user until the terminal disconnects from the server.

If Misskey ever locks up or it uses more than 70% of the server’s CPU, either: