Previously, I wrote the version up to Misskey v10, but the installation procedure has changed due to the use of Postgresql from v11 or later. This section describes how to install v11 or later.
Click here for v10 and earlier: https://qiita.com/YuzuRyo61/items/7105d16ac75c78899f1c
This article is based on Ubuntu and Debian series.
This is a routine procedure.
sudo apt update
sudo apt upgrade -y
Reboot is recommended after the upgrade.
Misskey requires Node.js (v11.10.1 or later), PostgreSQL (v10 or later), and Redis. Elasticsearch is also available as an option, but this time it is omitted. Since yarn is recommended, we will also introduce yarn.
Then use nginx as a reverse proxy.
Node.js
Install Node.js via Nodesource. For Linux on another package management system, such as CentOS, click See the README in this repository.
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
https://github.com/nodesource/distributions#installation-instructions
yarn
Introduced from the official yarn repository.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn
https://classic.yarnpkg.com/ja/docs/install#debian-stable
PostgreSQL
From the default repository.
sudo apt install postgresql-10 postgresql-server-dev-10
Redis
This is also pulled from the default repository as it is.
sudo apt install redis-server
nginx
From the official nginx repository. I'm not particular about it, so I'll put in a stable version.
sudo apt install curl gnupg2 ca-certificates lsb-release echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - sudo apt-key fingerprint ABF5BD827BD9BF62 #This is for confirmation. sudo apt update sudo apt install nginx
http://nginx.org/en/linux_packages.html#Ubuntu
Introduce build-essential.
sudo apt install build-essential
Start the service.
sudo systemctl start nginx postgresql redis-server
sudo systemctl enable nginx postgresql redis-server
Specify the user to start. The user name is arbitrary.
sudo adduser --disabled-password --disabled-login misskey
sudo su - misskey
Clone the repository and check out for the latest release.
git clone -b master https://github.com/syuilo/misskey.git
cd misskey
#The version is https://github.com/syuilo/misskey/releases/See latest
git checkout <12.x.x>
Install the package with yarn. Make sure that yarn.lock is not replaced.
yarn install --pure-lockfile
Create default.yml by copying example.yml.
cp .config/example.yml .config/default.yml
Set default.yml according to the comments inside.
Build Misskey. This can take some time.
NODE_ENV=production yarn build
Initialize the database so that it can be used.
yarn run init
You can check the startup with the following command. If you can confirm it, press Ctrl-C to stop the server.
NODE_ENV=production yarn start
/etc/systemd/system/misskey.service
[Unit]
Description=Misskey daemon
[Service]
Type=simple
User=misskey #If the user name is different, please change it
ExecStart=/usr/bin/npm start
WorkingDirectory=/home/misskey/misskey #Please change according to the environment
Environment="NODE_ENV=production"
TimeoutSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=misskey
Restart=always
[Install]
WantedBy=multi-user.target
After setting, execute systemctl daemon-reload
to update the service list.
systemctl enable misskey
will run misskey at startup.
Start it with systemctl start misskey
.
Finally, set up the nginx reverse proxy.
The file name is arbitrary. If there are any changes, please change accordingly.
nginx:/etc/nginx/conf.d/misskey.conf
# Sample nginx configuration for Misskey
#
# 1. Replace example.tld to your domain
# 2. Copy to /etc/nginx/sites-available/ and then symlink from /etc/nginx/sites-enabled/
# or copy to /etc/nginx/conf.d/
# For WebSocket
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off;
server {
listen 80;
listen [::]:80;
server_name example.tld;
# For SSL domain validation
root /var/www/html;
location /.well-known/acme-challenge/ { allow all; }
location /.well-known/pki-validation/ { allow all; }
location / { return 301 https://$server_name$request_uri; }
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.tld;
ssl_session_cache shared:ssl_session_cache:10m;
# To use Let's Encrypt certificate
ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
# To use Debian/Ubuntu's self-signed certificate (For testing or before issuing a certificate)
#ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
#ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
# SSL protocol settings
ssl_protocols TLSv1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:AES128-SHA;
ssl_prefer_server_ciphers on;
# Change to your upload limit
client_max_body_size 80m;
# Proxy to Node
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
proxy_redirect off;
# For WebSocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# Cache settings
proxy_cache cache1;
proxy_cache_lock on;
proxy_cache_use_stale updating;
add_header X-Cache $upstream_cache_status;
}
}
https://github.com/syuilo/misskey/blob/develop/docs/examples/misskey.nginx
Once set, apply the changes with systemctl restart nginx
.
This completes the settings: tada:
If there is an update, first move to the directory where Misskey is installed. Then enter the following commands in order from the top.
git fetch
git checkout <12.x.x> #Enter the latest version of the tag
yarn install --pure-lockfile
NODE_ENV=production yarn build
yarn migrate
Enter the above command, and if there are no errors, restart the misskey service. This completes the update.
Recommended Posts