iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🔧

Setting up a Misskey Development Server on Ubuntu

に公開

Just a memo for future reference.
Since I'm still learning, some steps might be unnecessary.

Preparing the Repository

Fork from the Misskey Repo and git clone it to your local environment.
Run git submodule update --init to fetch assets like Fluent Emojis.

Various Dependencies

Installing Miscellaneous Items

sudo apt update
sudo apt upgrade
# Install build-essential
sudo apt install build-essential -y
# Install Node.js
sudo apt install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt update
sudo apt install nodejs -y

In my case, I got an error here:

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_20.5.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I resolved this with sudo apt remove libnode-dev.

# Install npm
sudo apt install npm

I also got an error here:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 npm : Depends: node-agent-base but it is not going to be installed
       Depends: node-aproba but it is not going to be installed
       Depends: node-archy but it is not going to be installed
       Depends: node-cacache but it is not going to be installed
       Depends: node-chalk but it is not going to be installed
       Depends: node-cli-table3

I ran sudo aptitude install npm and answered "y" to everything, and it worked.

# PostgreSQL
wget https://salsa.debian.org/postgresql/postgresql-common/raw/master/pgdg/apt.postgresql.org.sh
sudo sh apt.postgresql.org.sh -i -v 16
sudo /etc/init.d/postgresql restart
# Redis
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt update
sudo apt install redis -y
sudo systemctl start redis

Setting up PostgreSQL

sudo -u postgres psql
CREATE ROLE misskey LOGIN CREATEDB PASSWORD 'hoge';
CREATE DATABASE mk1 OWNER misskey;

Create the user and the database with these commands.
In this example, the username is misskey, the password is hoge, and the database name is mk1.
Exit with \q.

Installing npm packages

Change directory (cd) into the cloned repository and run:

sudo corepack enable
pnpm install

Building Misskey

Create a default.yml file under the .config/ directory of the cloned repository and copy the contents of example.yml.

Update and save the file as follows:

url: http://localhost:3000
port: 3000

db:
  host: localhost
  port: 5432
  db  : mk1      # PostgreSQL database name
  user: misskey  # PostgreSQL username
  pass: hoge     # PostgreSQL password

redis:
  host: localhost
  port: 6379

Once that's done, run:

pnpm build
pnpm run init
pnpm start

Then Misskey will be available at localhost:3000.

References

Let's start Misskey development on Windows using WSL2 | aqz/tamaina

Discussion