How to install Misskey in Ubuntu 22.04 (Manual without Docker)
Misskey is an open-source social media platform that has been making waves in the world of fediverse enthusiasts. As someone who has recently discovered Misskey, I can confidently say that it has quickly become my favorite social media platform. From its customizable interface to its community-driven approach, Misskey offers a unique and refreshing experience for users.
In this article, I want to share my experience installing Misskey. There are several ways to create / deploy Misskey instance, from using Docker to manually install all required dependencies. In tis article I choose to use manual installation method.
why use the manual installation method, when there is an easier way using docker?
- Overhead. Because running a containerized app inside a containerized operating system can create additional layers of abstraction, which can lead to increased overhead and reduced performance. This is because each layer adds a small amount of overhead, and the more layers you have, the more overhead you will incur.
- I want to run multiple Misskey instance under one linux container. Imagine if I run 5 instances and in the same time I should install and run containerized NodeJS and PostgreSQL for each instance.
While running containerized apps inside a containerized operating system can be a convenient way to manage applications, it may not always be the most optimal approach from a performance perspective.
18.13.x(we will use NVM for this)
- PM2 (optional)
Install PostgreSQL 15
PostgreSQL 15 is not available in official Ubuntu 22.04, you need to enable it's official repository from PostgreSQL itself.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null sudo apt update sudo apt install postgresql postgresql-client -y
Don't forget to start PostgreSQL and make it run on system startup.
sudo systemctl status postgresql sudo systemctl enable postgresql
Install Redis and FFmpeg
Simply run :
sudo apt install redis ffmpeg
make sure to start Redis and make it run on system startup.
sudo systemctl start redis-server.service sudo systemctl enable redis-server.service
Install NodeJS 18 using NVM
Install NVM and nodeJS as regular user. Running commands below as root is not recommended!
Download and run NVM install script:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
When the script is executed, it clones the nvm repository to
~/.nvm, and attempts to add the
source lines your profile file (
Relogin to your server so you can use
Install required NodeJS version, in this article we need to use NodeJS 18.
nvm install 18
You also need to enable
npm install -g corepack corepack enable
Install and build Misskey
Clone the Misskey repository
git clone --recursive https://github.com/misskey-dev/misskey.git
Navigate to the repository, and check out the latest version of Misskey:
cd misskey git checkout master
Download submodules and install Misskey's dependencies.
git submodule update --init pnpm install --frozen-lockfile
Run this following command to build misskey. (
python is required).
NODE_ENV=production pnpm run build
You need to create the appropriate PostgreSQL users with respective passwords, and an empty database for Misskey. The encoding of the database should be
sudo -u postgres psql CREATE DATABASE <your_db_name> WITH ENCODING = 'UTF8'; CREATE USER <your_misskey_db_user> WITH ENCRYPTED PASSWORD '<YOUR_PASSWORD>'; GRANT ALL PRIVILEGES ON DATABASE <your_db_name> TO <your_misskey_db_user>; GRANT ALL ON SCHEMA public TO <your_misskey_db_user>; \q
IMPORTANT: In PostgreSQL 15, a fundamental change took place which is relevant to every user who happens to work with permissions: The default permissions of the public schema have been modified.
GRANT ALL ON SCHEMA public TO ...is needed, otherwise you'll find :
ERROR: permission denied for schema publicmessage when running database initialisation.
After that, copy
.config/default.yml under your Misskey repository.
.config/default.yml to fit with your need and environment.
Finally, run the database initialisation:
pnpm run init
Auto start Misskey
Last, but not least, we need to start Misskey when the system start. You can auto start Misskey with systemd as described on it's official documentation.
Using PM2 to manage Misskey
Because I love to use PM2 as my NodeJS application manager, I'll use that instead of
systemd. To install PM2:
npm install pm2 -g
To auto run PM2 at startup as your current user, run
pm2 startup and follow the output insruction.
Then to run Misskey using PM2:
pm2 start "NODE_ENV=production pnpm run start" --name <your_process_name>
Dont forget to save managed process by PM2 using
pm2 save command.
That's it, and welcome to another awesome Fediverse project! Take a look my Fediverse account @[email protected] from Misskey.