jointrashposs/content/it/docs/3.for-admin/install/guides/ubuntu-manual.md

620 lines
18 KiB
Markdown
Raw Normal View History

New Crowdin updates (#40) * New translations announcement.md (English) * New translations announcement.md (Indonesian) * New translations ftt.md (French) * New translations ftt.md (Italian) * New translations ftt.md (Korean) * New translations ftt.md (Polish) * New translations ftt.md (Chinese Simplified) * New translations ftt.md (English) * New translations ftt.md (Indonesian) * New translations role.md (French) * New translations role.md (Italian) * New translations role.md (Korean) * New translations role.md (Polish) * New translations role.md (Chinese Simplified) * New translations role.md (Chinese Traditional) * New translations role.md (English) * New translations role.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations bash.md (French) * New translations bash.md (Italian) * New translations bash.md (Korean) * New translations bash.md (Polish) * New translations bash.md (Chinese Simplified) * New translations bash.md (Chinese Traditional) * New translations bash.md (English) * New translations bash.md (Indonesian) * New translations docker.md (French) * New translations docker.md (Italian) * New translations docker.md (Korean) * New translations docker.md (Polish) * New translations docker.md (Chinese Simplified) * New translations docker.md (Chinese Traditional) * New translations docker.md (English) * New translations docker.md (Indonesian) * New translations kubernetes.md (French) * New translations kubernetes.md (Italian) * New translations kubernetes.md (Korean) * New translations kubernetes.md (Polish) * New translations kubernetes.md (Chinese Simplified) * New translations kubernetes.md (Chinese Traditional) * New translations kubernetes.md (English) * New translations kubernetes.md (Indonesian) * New translations manual.md (French) * New translations manual.md (Italian) * New translations manual.md (Korean) * New translations manual.md (Polish) * New translations manual.md (Chinese Simplified) * New translations manual.md (English) * New translations manual.md (Indonesian) * New translations ubuntu-manual.md (French) * New translations ubuntu-manual.md (Italian) * New translations ubuntu-manual.md (Korean) * New translations ubuntu-manual.md (Polish) * New translations ubuntu-manual.md (Chinese Simplified) * New translations ubuntu-manual.md (English) * New translations ubuntu-manual.md (Indonesian) * New translations cdn.md (French) * New translations cdn.md (Italian) * New translations cdn.md (Korean) * New translations cdn.md (Polish) * New translations cdn.md (Chinese Simplified) * New translations cdn.md (English) * New translations cdn.md (Indonesian) * New translations nginx.md (French) * New translations nginx.md (Italian) * New translations nginx.md (Korean) * New translations nginx.md (Polish) * New translations nginx.md (Chinese Simplified) * New translations nginx.md (Chinese Traditional) * New translations nginx.md (English) * New translations nginx.md (Indonesian) * New translations push-docker-hub.md (French) * New translations push-docker-hub.md (Italian) * New translations push-docker-hub.md (Korean) * New translations push-docker-hub.md (Polish) * New translations push-docker-hub.md (Chinese Simplified) * New translations push-docker-hub.md (Chinese Traditional) * New translations push-docker-hub.md (English) * New translations push-docker-hub.md (Indonesian) * New translations scale-out.md (French) * New translations scale-out.md (Italian) * New translations scale-out.md (Korean) * New translations scale-out.md (Polish) * New translations scale-out.md (Chinese Simplified) * New translations scale-out.md (English) * New translations scale-out.md (Indonesian) * New translations troubleshooting.md (French) * New translations troubleshooting.md (Italian) * New translations troubleshooting.md (Korean) * New translations troubleshooting.md (Polish) * New translations troubleshooting.md (Chinese Simplified) * New translations troubleshooting.md (English) * New translations troubleshooting.md (Indonesian) * New translations disable-timelines.md (French) * New translations disable-timelines.md (Italian) * New translations disable-timelines.md (Korean) * New translations disable-timelines.md (Polish) * New translations disable-timelines.md (Chinese Simplified) * New translations disable-timelines.md (English) * New translations disable-timelines.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations libraries.md (French) * New translations libraries.md (Italian) * New translations libraries.md (Korean) * New translations libraries.md (Polish) * New translations libraries.md (Chinese Simplified) * New translations libraries.md (Chinese Traditional) * New translations libraries.md (English) * New translations libraries.md (Indonesian) * New translations permission.md (French) * New translations permission.md (Italian) * New translations permission.md (Korean) * New translations permission.md (Polish) * New translations permission.md (Chinese Simplified) * New translations permission.md (Chinese Traditional) * New translations permission.md (English) * New translations permission.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations global-timeline.md (French) * New translations global-timeline.md (Italian) * New translations global-timeline.md (Korean) * New translations global-timeline.md (Polish) * New translations global-timeline.md (Chinese Simplified) * New translations global-timeline.md (Chinese Traditional) * New translations global-timeline.md (English) * New translations global-timeline.md (Indonesian) * New translations home-timeline.md (French) * New translations home-timeline.md (Italian) * New translations home-timeline.md (Korean) * New translations home-timeline.md (Polish) * New translations home-timeline.md (Chinese Simplified) * New translations home-timeline.md (Chinese Traditional) * New translations home-timeline.md (English) * New translations home-timeline.md (Indonesian) * New translations hybrid-timeline.md (French) * New translations hybrid-timeline.md (Italian) * New translations hybrid-timeline.md (Korean) * New translations hybrid-timeline.md (Polish) * New translations hybrid-timeline.md (Chinese Simplified) * New translations hybrid-timeline.md (Chinese Traditional) * New translations hybrid-timeline.md (English) * New translations hybrid-timeline.md (Indonesian) * New translations index.md (French) * New translations index.md (Italian) * New translations index.md (Korean) * New translations index.md (Polish) * New translations index.md (Chinese Simplified) * New translations index.md (Chinese Traditional) * New translations index.md (English) * New translations index.md (Indonesian) * New translations local-timeline.md (French) * New translations local-timeline.md (Italian) * New translations local-timeline.md (Korean) * New translations local-timeline.md (Polish) * New translations local-timeline.md (Chinese Simplified) * New translations local-timeline.md (Chinese Traditional) * New translations local-timeline.md (English) * New translations local-timeline.md (Indonesian) * New translations main.md (French) * New translations main.md (Italian) * New translations main.md (Korean) * New translations main.md (Polish) * New translations main.md (Chinese Simplified) * New translations main.md (Chinese Traditional) * New translations main.md (English) * New translations main.md (Indonesian) * New translations note-capture-events.md (French) * New translations note-capture-events.md (Italian) * New translations note-capture-events.md (Korean) * New translations note-capture-events.md (Polish) * New translations note-capture-events.md (Chinese Simplified) * New translations note-capture-events.md (Chinese Traditional) * New translations note-capture-events.md (English) * New translations note-capture-events.md (Indonesian) * New translations token.md (French) * New translations token.md (Italian) * New translations token.md (Korean) * New translations token.md (Polish) * New translations token.md (Chinese Simplified) * New translations token.md (Chinese Traditional) * New translations token.md (English) * New translations token.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations create-plugin.md (French) * New translations create-plugin.md (Italian) * New translations create-plugin.md (Korean) * New translations create-plugin.md (Polish) * New translations create-plugin.md (Chinese Simplified) * New translations create-plugin.md (Chinese Traditional) * New translations create-plugin.md (English) * New translations create-plugin.md (Indonesian) * New translations plugin-api-reference.md (French) * New translations plugin-api-reference.md (Italian) * New translations plugin-api-reference.md (Korean) * New translations plugin-api-reference.md (Polish) * New translations plugin-api-reference.md (Chinese Simplified) * New translations plugin-api-reference.md (Chinese Traditional) * New translations plugin-api-reference.md (English) * New translations plugin-api-reference.md (Indonesian) * New translations publish-on-your-website.md (French) * New translations publish-on-your-website.md (Italian) * New translations publish-on-your-website.md (Korean) * New translations publish-on-your-website.md (Polish) * New translations publish-on-your-website.md (Chinese Simplified) * New translations publish-on-your-website.md (Chinese Traditional) * New translations publish-on-your-website.md (English) * New translations publish-on-your-website.md (Indonesian) * New translations 5.releases.md (French) * New translations 5.releases.md (Italian) * New translations 5.releases.md (Korean) * New translations 5.releases.md (Polish) * New translations 5.releases.md (Chinese Simplified) * New translations 5.releases.md (Chinese Traditional) * New translations 5.releases.md (English) * New translations 5.releases.md (Indonesian)
2023-12-01 15:02:12 +01:00
# Ubuntu版Misskeyインストール方法詳説
## その他のMisskeyインストール方法
- [基本版 Misskey構築の手引き (manual)](./manual/)
- [その他のインストール方法一覧](/docs/for-admin/install/guides/#インストール方法一覧)
## シェルスクリプトのお知らせ
コピペばかりならシェルスクリプトでいいじゃん、と言うことで**シェルスクリプトでほぼ全部やってくれるやつを作ってみました!**\
[**シェルスクリプトの詳細と使用方法はこちらから!**](./bash/)
:::tip
シェルスクリプトでの開発環境へのインストールは想定されていません。
:::
:::tip
ドメインの購入とCloudflareのセットアップ、サーバーの確保についてはご自身でご準備ください。
:::
不具合があれば[ @aqz@p1.a9z.dev へのメンション](https://p1.a9z.dev/@aqz)にてお知らせいただければと思います。
## この記事について
この記事では、[Misskey構築の手引き (manual)](./manual/)で紹介されている通り、systemdでMisskeyを動作させています。
[docker-compose](./docker/)なら、手作業でももうちょっと簡単に実行できるはずです。
:::danger
一度使用を始めたサーバーのドメイン・ホスト名では、データベースを作り直さないでください!
:::
## はじめに
この記事では、[Misskey構築の手引き (manual)](./manual/)を基に、一般的なUbuntuサーバーへMisskeyをインストールし公開する方法の一挙手一投足を解説する。
Bashのコマンド入力、いくつかの設定ファイルの編集、そしてブラウザの操作だけで設定が完了するようにしている。インストールするソフトウェアについて簡単に説明しているが、気にする必要はない。
この記事では、具体性を重視し、特定の環境に特化した記述をしている。
OSの違い、Misskey本体や依存するソフトウェアのバージョンアップで変わってしまった部分等があるかもしれないが、ご容赦いただきたく思う。
わからない単語については、[『「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典』](https://wa3.i-3-i.info/) で調べて分かった気になってほしい。
## 環境と条件
- OSは**Ubuntu 22.04.1 LTS**を利用する。
- ハードウェア要件としては、CPUは最近のものなら最小限で動く。アーキテクチャはamd64及びarm64を想定している。
- メモリは1.5GB程度あればよい。Viteの導入等により、1.5GB程度でもビルド可能になった)
- 独自のドメインを購入し、CloudFlareを使用する。
- ドメインは[Google Domains](https://domains.google/intl/ja_jp/)などで予め用意しておくこと。
- ここではドメインをexample.tldとして解説を進めるので、自分が買ったドメインに適宜置き換えて読むこと。開発環境の場合はlocalhostと読み替えます設定ファイルの項で別途説明
:::danger
一度使用を始めたサーバーのドメイン・ホスト名は、決して変更しないでください!
:::
## nanoの使い方
今回はテキストエディターにnanoを使う。次のように起動する。
```sh
nano /path/to/file
```
一般的な矢印ボタンやHome/Endなどを利用してカーソルを移動できる。
終了はCtrl+Xで、変更を保存するか聞かれた場合Y(Yes)を入力しEnterすると保存できる。
下部にコマンド一覧が表示されるので、^をCtrl、M-をAltと読み替えて参考にしよう。
## ユーザーの作成
Misskeyはrootで実行しない方がよいため、専用のユーザーを作成する。
```sh
sudo adduser --disabled-password --disabled-login misskey
```
:::tip
開発環境の場合はユーザーを分ける必要はありません
:::
## 基本的なソフトウェアのインストールと設定
基本的なソフトウェアのインストールを行う。
### Node.js
Node.jsは、サーバーサイドJavaScript環境であり、Misskeyの基本的な実行環境である。
```sh
sudo apt install -y curl
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Node.jsがインストールされたので、バージョンを確認する。
node -v
# corepack enable
sudo corepack enable
```
v20.x.xなどと表示されればOK。v8.x.xのように低いバージョンが表示された場合は、正しくインストールが行えていないため、サーバーを再起動してもう一度インストールし直すなどしてみよう。
### PostgreSQL
PostgreSQLは、オブジェクト関係データベース管理システムであり、Misskeyの種々のデータを保存するために必要不可欠なソフトだ。
#### インストール
シェルスクリプトを実行し、最新バージョンv15をインストールしよう。
```sh
sudo apt install -y postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -i -v 15;
# systemctlでデーモンの状態を確認。
systemctl status postgresql
```
activeならOK。
#### ユーザーとデータベースの作成
psqlを起動。
```sh
sudo -u postgres psql
```
Misskeyで使うユーザーを作成する。\
ユーザー名をmisskey、パスワードをhogeとする場合は次のようになる。\
LinuxのユーザーとPostgreSQLのユーザーは別物なので、混同しないよう注意すること。
```sql
CREATE ROLE misskey LOGIN PASSWORD 'hoge';
```
データベースを作成。データベース名をmk1としている。
```sql
CREATE DATABASE mk1 OWNER misskey;
¥q
```
### Redis
Redisは、NoSQLのインメモリデータベースソフトであり、データベースや連合との通信を管理するなどのために必要だ。
redis.ioのドキュメントに従いインストールする。 https\://redis.io/docs/getting-started/installation/install-redis-on-linux/
```sh
sudo apt install -y curl ca-certificates gnupg2 lsb-release
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 -y redis
```
systemctlでデーモンの状態を確認。
```sh
systemctl status redis-server
```
activeならOK。
### nginx
nginxは、主としてリバースプロキシに用いられるWebサーバーソフトである。Misskeyには必須ではないが、キャッシュ等をするとパフォーマンスが向上したり、httpからhttpsへの転送などをするために、インストールしておこう。
:::tip
開発環境の場合はnginxのセットアップは不要です
:::
New Crowdin updates (#67) * New translations 1.about-misskey.md (French) * New translations 1.about-misskey.md (Italian) * New translations 1.about-misskey.md (Korean) * New translations 1.about-misskey.md (Polish) * New translations 1.about-misskey.md (Chinese Simplified) * New translations 1.about-misskey.md (Chinese Traditional) * New translations 1.about-misskey.md (Indonesian) * New translations pages.md (Chinese Traditional) * New translations share-form.md (French) * New translations share-form.md (Italian) * New translations share-form.md (Korean) * New translations share-form.md (Polish) * New translations share-form.md (Chinese Simplified) * New translations share-form.md (Chinese Traditional) * New translations share-form.md (English) * New translations share-form.md (Indonesian) * New translations timeline.md (French) * New translations timeline.md (Italian) * New translations timeline.md (Korean) * New translations timeline.md (Polish) * New translations timeline.md (Chinese Simplified) * New translations timeline.md (Chinese Traditional) * New translations timeline.md (English) * New translations timeline.md (Indonesian) * New translations bash.md (French) * New translations bash.md (Italian) * New translations bash.md (Korean) * New translations bash.md (Polish) * New translations bash.md (Chinese Simplified) * New translations bash.md (Chinese Traditional) * New translations bash.md (English) * New translations bash.md (Indonesian) * New translations kubernetes.md (French) * New translations kubernetes.md (Italian) * New translations kubernetes.md (Korean) * New translations kubernetes.md (Polish) * New translations kubernetes.md (Chinese Traditional) * New translations kubernetes.md (English) * New translations ubuntu-manual.md (French) * New translations ubuntu-manual.md (Italian) * New translations ubuntu-manual.md (Korean) * New translations ubuntu-manual.md (Polish) * New translations ubuntu-manual.md (Chinese Simplified) * New translations ubuntu-manual.md (Chinese Traditional) * New translations ubuntu-manual.md (English) * New translations ubuntu-manual.md (Indonesian) * New translations endpoints.md (English) * New translations 5.releases.md (French) * New translations 5.releases.md (Italian) * New translations 5.releases.md (Korean) * New translations 5.releases.md (Polish) * New translations 5.releases.md (Chinese Simplified) * New translations 5.releases.md (Chinese Traditional) * New translations 5.releases.md (English) * New translations 5.releases.md (Indonesian) * New translations ja-jp.yml (Chinese Traditional) * New translations ja-jp.yml (French) * New translations ja-jp.yml (Italian) * New translations ja-jp.yml (Korean) * New translations ja-jp.yml (Polish) * New translations ja-jp.yml (Chinese Simplified) * New translations ja-jp.yml (English) * New translations ja-jp.yml (Indonesian)
2023-12-23 15:38:47 +01:00
nginx.orgのドキュメント http\://nginx.org/en/linux_packages.html#Ubuntu に従ってインストールする。
New Crowdin updates (#40) * New translations announcement.md (English) * New translations announcement.md (Indonesian) * New translations ftt.md (French) * New translations ftt.md (Italian) * New translations ftt.md (Korean) * New translations ftt.md (Polish) * New translations ftt.md (Chinese Simplified) * New translations ftt.md (English) * New translations ftt.md (Indonesian) * New translations role.md (French) * New translations role.md (Italian) * New translations role.md (Korean) * New translations role.md (Polish) * New translations role.md (Chinese Simplified) * New translations role.md (Chinese Traditional) * New translations role.md (English) * New translations role.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations bash.md (French) * New translations bash.md (Italian) * New translations bash.md (Korean) * New translations bash.md (Polish) * New translations bash.md (Chinese Simplified) * New translations bash.md (Chinese Traditional) * New translations bash.md (English) * New translations bash.md (Indonesian) * New translations docker.md (French) * New translations docker.md (Italian) * New translations docker.md (Korean) * New translations docker.md (Polish) * New translations docker.md (Chinese Simplified) * New translations docker.md (Chinese Traditional) * New translations docker.md (English) * New translations docker.md (Indonesian) * New translations kubernetes.md (French) * New translations kubernetes.md (Italian) * New translations kubernetes.md (Korean) * New translations kubernetes.md (Polish) * New translations kubernetes.md (Chinese Simplified) * New translations kubernetes.md (Chinese Traditional) * New translations kubernetes.md (English) * New translations kubernetes.md (Indonesian) * New translations manual.md (French) * New translations manual.md (Italian) * New translations manual.md (Korean) * New translations manual.md (Polish) * New translations manual.md (Chinese Simplified) * New translations manual.md (English) * New translations manual.md (Indonesian) * New translations ubuntu-manual.md (French) * New translations ubuntu-manual.md (Italian) * New translations ubuntu-manual.md (Korean) * New translations ubuntu-manual.md (Polish) * New translations ubuntu-manual.md (Chinese Simplified) * New translations ubuntu-manual.md (English) * New translations ubuntu-manual.md (Indonesian) * New translations cdn.md (French) * New translations cdn.md (Italian) * New translations cdn.md (Korean) * New translations cdn.md (Polish) * New translations cdn.md (Chinese Simplified) * New translations cdn.md (English) * New translations cdn.md (Indonesian) * New translations nginx.md (French) * New translations nginx.md (Italian) * New translations nginx.md (Korean) * New translations nginx.md (Polish) * New translations nginx.md (Chinese Simplified) * New translations nginx.md (Chinese Traditional) * New translations nginx.md (English) * New translations nginx.md (Indonesian) * New translations push-docker-hub.md (French) * New translations push-docker-hub.md (Italian) * New translations push-docker-hub.md (Korean) * New translations push-docker-hub.md (Polish) * New translations push-docker-hub.md (Chinese Simplified) * New translations push-docker-hub.md (Chinese Traditional) * New translations push-docker-hub.md (English) * New translations push-docker-hub.md (Indonesian) * New translations scale-out.md (French) * New translations scale-out.md (Italian) * New translations scale-out.md (Korean) * New translations scale-out.md (Polish) * New translations scale-out.md (Chinese Simplified) * New translations scale-out.md (English) * New translations scale-out.md (Indonesian) * New translations troubleshooting.md (French) * New translations troubleshooting.md (Italian) * New translations troubleshooting.md (Korean) * New translations troubleshooting.md (Polish) * New translations troubleshooting.md (Chinese Simplified) * New translations troubleshooting.md (English) * New translations troubleshooting.md (Indonesian) * New translations disable-timelines.md (French) * New translations disable-timelines.md (Italian) * New translations disable-timelines.md (Korean) * New translations disable-timelines.md (Polish) * New translations disable-timelines.md (Chinese Simplified) * New translations disable-timelines.md (English) * New translations disable-timelines.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations libraries.md (French) * New translations libraries.md (Italian) * New translations libraries.md (Korean) * New translations libraries.md (Polish) * New translations libraries.md (Chinese Simplified) * New translations libraries.md (Chinese Traditional) * New translations libraries.md (English) * New translations libraries.md (Indonesian) * New translations permission.md (French) * New translations permission.md (Italian) * New translations permission.md (Korean) * New translations permission.md (Polish) * New translations permission.md (Chinese Simplified) * New translations permission.md (Chinese Traditional) * New translations permission.md (English) * New translations permission.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations global-timeline.md (French) * New translations global-timeline.md (Italian) * New translations global-timeline.md (Korean) * New translations global-timeline.md (Polish) * New translations global-timeline.md (Chinese Simplified) * New translations global-timeline.md (Chinese Traditional) * New translations global-timeline.md (English) * New translations global-timeline.md (Indonesian) * New translations home-timeline.md (French) * New translations home-timeline.md (Italian) * New translations home-timeline.md (Korean) * New translations home-timeline.md (Polish) * New translations home-timeline.md (Chinese Simplified) * New translations home-timeline.md (Chinese Traditional) * New translations home-timeline.md (English) * New translations home-timeline.md (Indonesian) * New translations hybrid-timeline.md (French) * New translations hybrid-timeline.md (Italian) * New translations hybrid-timeline.md (Korean) * New translations hybrid-timeline.md (Polish) * New translations hybrid-timeline.md (Chinese Simplified) * New translations hybrid-timeline.md (Chinese Traditional) * New translations hybrid-timeline.md (English) * New translations hybrid-timeline.md (Indonesian) * New translations index.md (French) * New translations index.md (Italian) * New translations index.md (Korean) * New translations index.md (Polish) * New translations index.md (Chinese Simplified) * New translations index.md (Chinese Traditional) * New translations index.md (English) * New translations index.md (Indonesian) * New translations local-timeline.md (French) * New translations local-timeline.md (Italian) * New translations local-timeline.md (Korean) * New translations local-timeline.md (Polish) * New translations local-timeline.md (Chinese Simplified) * New translations local-timeline.md (Chinese Traditional) * New translations local-timeline.md (English) * New translations local-timeline.md (Indonesian) * New translations main.md (French) * New translations main.md (Italian) * New translations main.md (Korean) * New translations main.md (Polish) * New translations main.md (Chinese Simplified) * New translations main.md (Chinese Traditional) * New translations main.md (English) * New translations main.md (Indonesian) * New translations note-capture-events.md (French) * New translations note-capture-events.md (Italian) * New translations note-capture-events.md (Korean) * New translations note-capture-events.md (Polish) * New translations note-capture-events.md (Chinese Simplified) * New translations note-capture-events.md (Chinese Traditional) * New translations note-capture-events.md (English) * New translations note-capture-events.md (Indonesian) * New translations token.md (French) * New translations token.md (Italian) * New translations token.md (Korean) * New translations token.md (Polish) * New translations token.md (Chinese Simplified) * New translations token.md (Chinese Traditional) * New translations token.md (English) * New translations token.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations create-plugin.md (French) * New translations create-plugin.md (Italian) * New translations create-plugin.md (Korean) * New translations create-plugin.md (Polish) * New translations create-plugin.md (Chinese Simplified) * New translations create-plugin.md (Chinese Traditional) * New translations create-plugin.md (English) * New translations create-plugin.md (Indonesian) * New translations plugin-api-reference.md (French) * New translations plugin-api-reference.md (Italian) * New translations plugin-api-reference.md (Korean) * New translations plugin-api-reference.md (Polish) * New translations plugin-api-reference.md (Chinese Simplified) * New translations plugin-api-reference.md (Chinese Traditional) * New translations plugin-api-reference.md (English) * New translations plugin-api-reference.md (Indonesian) * New translations publish-on-your-website.md (French) * New translations publish-on-your-website.md (Italian) * New translations publish-on-your-website.md (Korean) * New translations publish-on-your-website.md (Polish) * New translations publish-on-your-website.md (Chinese Simplified) * New translations publish-on-your-website.md (Chinese Traditional) * New translations publish-on-your-website.md (English) * New translations publish-on-your-website.md (Indonesian) * New translations 5.releases.md (French) * New translations 5.releases.md (Italian) * New translations 5.releases.md (Korean) * New translations 5.releases.md (Polish) * New translations 5.releases.md (Chinese Simplified) * New translations 5.releases.md (Chinese Traditional) * New translations 5.releases.md (English) * New translations 5.releases.md (Indonesian)
2023-12-01 15:02:12 +01:00
```sh
sudo apt install ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
```
このとき出力に 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 とあるか確認する。
```sh
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | sudo tee /etc/apt/preferences.d/99nginx
sudo apt update
sudo apt install -y nginx
```
systemctlでデーモンの状態を確認。
```sh
systemctl status nginx
```
activeならOK。そうでなければ、次のコマンドを実行。
```sh
sudo systemctl start nginx
sudo systemctl enable nginx
```
http\://localhost にアクセスし、\*Welcome to nginx!\*と表示されればOK。\
curlで確認するのもよいだろう。
```sh
curl http://localhost
```
### その他
Gitバージョン管理ソフトおよびbuild-essentialMisskeyのビルド時に必要をインストールする。
```sh
sudo apt update
sudo apt install -y git build-essential
```
## 追加の設定とインストール
サーバーをインターネットに公開する準備をする。
:::tip
開発環境の場合はファイヤーウォールやCloudFlare、Certbotの設定は不要です
:::
### ファイヤーウォール
今回は、ファイヤーウォールとしてufwを使用する。
次では、接続許可をホワイトリスト形式とし、22番SSHポートを接続回数制限を設けながら開放、80番HTTPポート及び443番HTTPSポートを開放とした。
```sh
sudo ufw enable
sudo ufw default deny
sudo ufw limit 22
sudo ufw allow 80
sudo ufw allow 443
```
ufwのステータスを確認しておく。
```sh
sudo ufw status
```
systemctlで永続化する。
```sh
sudo systemctl enable ufw
```
:::tip
ufwは、netfilter(iptables)を人間が操作しやすいようにするアプリだ。インストールスクリプトは、OCI環境ではnetfilterを直接操作する。
:::
### CloudFlare
CloudFlareは、自分のドメインに対してDNSサーバー・リバースプロキシ・CDNをいっぺんに提供してくれるたいへん便利なサービスである。\
CloudFlareを経由せずにサーバーを公開することも可能だが、たいへん便利なので導入することをお勧めする。
[**→ CDNの設定**](../resources/cdn/)
[CloudFlareにサインアップ](https://dash.cloudflare.com/sign-up) し、購入したドメインを案内に従って登録する。
DNSの登録画面でサーバーのIPアドレスを入力しておくとよい。
ドメインを購入した所によっては適用に3日程度かかる場合がある。
### Certbot (Lets Encrypt) の設定
HTTPS・WSS通信に使用する証明書をCloudFlareを使う方式でLets Encryptから取得する。
certbotとCloudFlareプラグインをインストール
```sh
sudo apt install -y certbot python3-certbot-dns-cloudflare
```
CloudflareのAPIキーを取得する。以下の手順で取得されたい。
1. https\://dash.cloudflare.com/profile/api-tokens にアクセス
2. Global API KeyのViewを選択
3. パスワードを入力しhCaptchaを解除、Viewを選択
CloudFlareの情報を記載した設定ファイル/etc/cloudflare/cloudflare.iniを作成する。
```sh
mkdir /etc/cloudflare
nano /etc/cloudflare/cloudflare.ini
```
New Crowdin updates (#67) * New translations 1.about-misskey.md (French) * New translations 1.about-misskey.md (Italian) * New translations 1.about-misskey.md (Korean) * New translations 1.about-misskey.md (Polish) * New translations 1.about-misskey.md (Chinese Simplified) * New translations 1.about-misskey.md (Chinese Traditional) * New translations 1.about-misskey.md (Indonesian) * New translations pages.md (Chinese Traditional) * New translations share-form.md (French) * New translations share-form.md (Italian) * New translations share-form.md (Korean) * New translations share-form.md (Polish) * New translations share-form.md (Chinese Simplified) * New translations share-form.md (Chinese Traditional) * New translations share-form.md (English) * New translations share-form.md (Indonesian) * New translations timeline.md (French) * New translations timeline.md (Italian) * New translations timeline.md (Korean) * New translations timeline.md (Polish) * New translations timeline.md (Chinese Simplified) * New translations timeline.md (Chinese Traditional) * New translations timeline.md (English) * New translations timeline.md (Indonesian) * New translations bash.md (French) * New translations bash.md (Italian) * New translations bash.md (Korean) * New translations bash.md (Polish) * New translations bash.md (Chinese Simplified) * New translations bash.md (Chinese Traditional) * New translations bash.md (English) * New translations bash.md (Indonesian) * New translations kubernetes.md (French) * New translations kubernetes.md (Italian) * New translations kubernetes.md (Korean) * New translations kubernetes.md (Polish) * New translations kubernetes.md (Chinese Traditional) * New translations kubernetes.md (English) * New translations ubuntu-manual.md (French) * New translations ubuntu-manual.md (Italian) * New translations ubuntu-manual.md (Korean) * New translations ubuntu-manual.md (Polish) * New translations ubuntu-manual.md (Chinese Simplified) * New translations ubuntu-manual.md (Chinese Traditional) * New translations ubuntu-manual.md (English) * New translations ubuntu-manual.md (Indonesian) * New translations endpoints.md (English) * New translations 5.releases.md (French) * New translations 5.releases.md (Italian) * New translations 5.releases.md (Korean) * New translations 5.releases.md (Polish) * New translations 5.releases.md (Chinese Simplified) * New translations 5.releases.md (Chinese Traditional) * New translations 5.releases.md (English) * New translations 5.releases.md (Indonesian) * New translations ja-jp.yml (Chinese Traditional) * New translations ja-jp.yml (French) * New translations ja-jp.yml (Italian) * New translations ja-jp.yml (Korean) * New translations ja-jp.yml (Polish) * New translations ja-jp.yml (Chinese Simplified) * New translations ja-jp.yml (English) * New translations ja-jp.yml (Indonesian)
2023-12-23 15:38:47 +01:00
dns_cloudflare_email下の例ではbar\@fuga.fooにはCloudFlareで登録しているメールアドレスを設定する。
New Crowdin updates (#40) * New translations announcement.md (English) * New translations announcement.md (Indonesian) * New translations ftt.md (French) * New translations ftt.md (Italian) * New translations ftt.md (Korean) * New translations ftt.md (Polish) * New translations ftt.md (Chinese Simplified) * New translations ftt.md (English) * New translations ftt.md (Indonesian) * New translations role.md (French) * New translations role.md (Italian) * New translations role.md (Korean) * New translations role.md (Polish) * New translations role.md (Chinese Simplified) * New translations role.md (Chinese Traditional) * New translations role.md (English) * New translations role.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations bash.md (French) * New translations bash.md (Italian) * New translations bash.md (Korean) * New translations bash.md (Polish) * New translations bash.md (Chinese Simplified) * New translations bash.md (Chinese Traditional) * New translations bash.md (English) * New translations bash.md (Indonesian) * New translations docker.md (French) * New translations docker.md (Italian) * New translations docker.md (Korean) * New translations docker.md (Polish) * New translations docker.md (Chinese Simplified) * New translations docker.md (Chinese Traditional) * New translations docker.md (English) * New translations docker.md (Indonesian) * New translations kubernetes.md (French) * New translations kubernetes.md (Italian) * New translations kubernetes.md (Korean) * New translations kubernetes.md (Polish) * New translations kubernetes.md (Chinese Simplified) * New translations kubernetes.md (Chinese Traditional) * New translations kubernetes.md (English) * New translations kubernetes.md (Indonesian) * New translations manual.md (French) * New translations manual.md (Italian) * New translations manual.md (Korean) * New translations manual.md (Polish) * New translations manual.md (Chinese Simplified) * New translations manual.md (English) * New translations manual.md (Indonesian) * New translations ubuntu-manual.md (French) * New translations ubuntu-manual.md (Italian) * New translations ubuntu-manual.md (Korean) * New translations ubuntu-manual.md (Polish) * New translations ubuntu-manual.md (Chinese Simplified) * New translations ubuntu-manual.md (English) * New translations ubuntu-manual.md (Indonesian) * New translations cdn.md (French) * New translations cdn.md (Italian) * New translations cdn.md (Korean) * New translations cdn.md (Polish) * New translations cdn.md (Chinese Simplified) * New translations cdn.md (English) * New translations cdn.md (Indonesian) * New translations nginx.md (French) * New translations nginx.md (Italian) * New translations nginx.md (Korean) * New translations nginx.md (Polish) * New translations nginx.md (Chinese Simplified) * New translations nginx.md (Chinese Traditional) * New translations nginx.md (English) * New translations nginx.md (Indonesian) * New translations push-docker-hub.md (French) * New translations push-docker-hub.md (Italian) * New translations push-docker-hub.md (Korean) * New translations push-docker-hub.md (Polish) * New translations push-docker-hub.md (Chinese Simplified) * New translations push-docker-hub.md (Chinese Traditional) * New translations push-docker-hub.md (English) * New translations push-docker-hub.md (Indonesian) * New translations scale-out.md (French) * New translations scale-out.md (Italian) * New translations scale-out.md (Korean) * New translations scale-out.md (Polish) * New translations scale-out.md (Chinese Simplified) * New translations scale-out.md (English) * New translations scale-out.md (Indonesian) * New translations troubleshooting.md (French) * New translations troubleshooting.md (Italian) * New translations troubleshooting.md (Korean) * New translations troubleshooting.md (Polish) * New translations troubleshooting.md (Chinese Simplified) * New translations troubleshooting.md (English) * New translations troubleshooting.md (Indonesian) * New translations disable-timelines.md (French) * New translations disable-timelines.md (Italian) * New translations disable-timelines.md (Korean) * New translations disable-timelines.md (Polish) * New translations disable-timelines.md (Chinese Simplified) * New translations disable-timelines.md (English) * New translations disable-timelines.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations libraries.md (French) * New translations libraries.md (Italian) * New translations libraries.md (Korean) * New translations libraries.md (Polish) * New translations libraries.md (Chinese Simplified) * New translations libraries.md (Chinese Traditional) * New translations libraries.md (English) * New translations libraries.md (Indonesian) * New translations permission.md (French) * New translations permission.md (Italian) * New translations permission.md (Korean) * New translations permission.md (Polish) * New translations permission.md (Chinese Simplified) * New translations permission.md (Chinese Traditional) * New translations permission.md (English) * New translations permission.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations global-timeline.md (French) * New translations global-timeline.md (Italian) * New translations global-timeline.md (Korean) * New translations global-timeline.md (Polish) * New translations global-timeline.md (Chinese Simplified) * New translations global-timeline.md (Chinese Traditional) * New translations global-timeline.md (English) * New translations global-timeline.md (Indonesian) * New translations home-timeline.md (French) * New translations home-timeline.md (Italian) * New translations home-timeline.md (Korean) * New translations home-timeline.md (Polish) * New translations home-timeline.md (Chinese Simplified) * New translations home-timeline.md (Chinese Traditional) * New translations home-timeline.md (English) * New translations home-timeline.md (Indonesian) * New translations hybrid-timeline.md (French) * New translations hybrid-timeline.md (Italian) * New translations hybrid-timeline.md (Korean) * New translations hybrid-timeline.md (Polish) * New translations hybrid-timeline.md (Chinese Simplified) * New translations hybrid-timeline.md (Chinese Traditional) * New translations hybrid-timeline.md (English) * New translations hybrid-timeline.md (Indonesian) * New translations index.md (French) * New translations index.md (Italian) * New translations index.md (Korean) * New translations index.md (Polish) * New translations index.md (Chinese Simplified) * New translations index.md (Chinese Traditional) * New translations index.md (English) * New translations index.md (Indonesian) * New translations local-timeline.md (French) * New translations local-timeline.md (Italian) * New translations local-timeline.md (Korean) * New translations local-timeline.md (Polish) * New translations local-timeline.md (Chinese Simplified) * New translations local-timeline.md (Chinese Traditional) * New translations local-timeline.md (English) * New translations local-timeline.md (Indonesian) * New translations main.md (French) * New translations main.md (Italian) * New translations main.md (Korean) * New translations main.md (Polish) * New translations main.md (Chinese Simplified) * New translations main.md (Chinese Traditional) * New translations main.md (English) * New translations main.md (Indonesian) * New translations note-capture-events.md (French) * New translations note-capture-events.md (Italian) * New translations note-capture-events.md (Korean) * New translations note-capture-events.md (Polish) * New translations note-capture-events.md (Chinese Simplified) * New translations note-capture-events.md (Chinese Traditional) * New translations note-capture-events.md (English) * New translations note-capture-events.md (Indonesian) * New translations token.md (French) * New translations token.md (Italian) * New translations token.md (Korean) * New translations token.md (Polish) * New translations token.md (Chinese Simplified) * New translations token.md (Chinese Traditional) * New translations token.md (English) * New translations token.md (Indonesian) * New translations 1.index.md (French) * New translations 1.index.md (Italian) * New translations 1.index.md (Korean) * New translations 1.index.md (Polish) * New translations 1.index.md (Chinese Simplified) * New translations 1.index.md (Chinese Traditional) * New translations 1.index.md (English) * New translations 1.index.md (Indonesian) * New translations create-plugin.md (French) * New translations create-plugin.md (Italian) * New translations create-plugin.md (Korean) * New translations create-plugin.md (Polish) * New translations create-plugin.md (Chinese Simplified) * New translations create-plugin.md (Chinese Traditional) * New translations create-plugin.md (English) * New translations create-plugin.md (Indonesian) * New translations plugin-api-reference.md (French) * New translations plugin-api-reference.md (Italian) * New translations plugin-api-reference.md (Korean) * New translations plugin-api-reference.md (Polish) * New translations plugin-api-reference.md (Chinese Simplified) * New translations plugin-api-reference.md (Chinese Traditional) * New translations plugin-api-reference.md (English) * New translations plugin-api-reference.md (Indonesian) * New translations publish-on-your-website.md (French) * New translations publish-on-your-website.md (Italian) * New translations publish-on-your-website.md (Korean) * New translations publish-on-your-website.md (Polish) * New translations publish-on-your-website.md (Chinese Simplified) * New translations publish-on-your-website.md (Chinese Traditional) * New translations publish-on-your-website.md (English) * New translations publish-on-your-website.md (Indonesian) * New translations 5.releases.md (French) * New translations 5.releases.md (Italian) * New translations 5.releases.md (Korean) * New translations 5.releases.md (Polish) * New translations 5.releases.md (Chinese Simplified) * New translations 5.releases.md (Chinese Traditional) * New translations 5.releases.md (English) * New translations 5.releases.md (Indonesian)
2023-12-01 15:02:12 +01:00
```sh
dns_cloudflare_email = bar@fuga.foo
dns_cloudflare_api_key = xxxxxxxxxxxxxxxxxxxxxxxxxx
```
これを保存し、パーミッションを600に設定。
```sh
sudo chmod 600 /etc/cloudflare/cloudflare.ini
```
準備ができたのでコマンドを実行する。**途中の2箇所のexample.tldは自分のものに置き換えること**。
```sh
sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare/cloudflare.ini --dns-cloudflare-propagation-seconds 60 --server https://acme-v02.api.letsencrypt.org/directory -d example.tld -d *.example.tld
```
\*Congratulations!\*と表示されたらOK。生成された.pemファイルのパスは今後使うので記録しておくこと。
自動更新の設定はインストールと同時に行われているため不要。
## Misskeyのインストール
これで前準備はあらかた終わったので、Misskeyを準備していく。
misskeyユーザーに変更。
```sh
sudo su - misskey
```
Gitでファイル類を展開。
```sh
git clone -b master https://github.com/misskey-dev/misskey.git --recurse-submodules
cd misskey
git checkout master
```
必要なnpmパッケージをインストール。
```sh
NODE_ENV=production pnpm install --frozen-lockfile
```
## Misskeyを設定する
### default.yml
設定ファイル.config/default.ymlを作成。
```sh
nano .config/default.yml
```
次の内容を貼り付け、適宜置き換える。設定値の変更が必要な箇所は●で、これまでの流れの中で設定した値を用いる箇所は〇で示した。
この設定ファイルはYAML形式で書かれており、行頭のスペースの数などを間違えるとMisskeyが動かないので、特に注意すること。
設定できる値と記述方法は[.config/example.yml](https://github.com/syuilo/misskey/blob/develop/.config/example.yml)に書かれている。
:::tip
開発環境の場合、urlは`url: http://localhost:3000`と指定します。
:::
```yml
# ● Misskeyを公開するURL
url: https://example.tld/
# ポートを3000とする。
port: 3000
# ● PostgreSQLの設定。
db:
host: localhost
port: 5432
db : mk1 # PostgreSQLのデータベース名
user: misskey # PostgreSQLのユーザー名
pass: hoge # ● PostgreSQLのパスワード
#   Redisの設定。
redis:
host: localhost
port: 6379
#   IDタイプの設定。
id: 'aid'
#   syslog
syslog:
host: localhost
port: 514
```
指定できたら保存する。
### nginxの設定
nginxの設定を行う。
ルート権限で行う。
```sh
exit
```
/etc/nginx/conf.d/misskey.confを作成する。
```sh
sudo nano /etc/nginx/conf.d/misskey.conf
```
[Misskey Hub](https://misskey-hub.net/docs/admin/nginx/)の設定例をnanoへコピーペーストし、次の部分を自分のものに書き換える。
- 18行目と30行目のドメイン名
- 34-35行目の証明書へのパスをCertbotで取得したものに (基本的にexample.tldを置き換えるだけでOK)
- 56行目 (If it's behind another reverse proxy or CDN, remove the following.) から4行を削除
変更を保存する。
設定ファイルがきちんと機能するか確認。
```sh
sudo nginx -t
```
OKならば、nginxデーモンを再起動。
```sh
sudo systemctl restart nginx
```
ステータスを確認。
```sh
sudo systemctl status nginx
```
activeであればOK。
## Misskeyのビルド
misskeyユーザーにログインし直す。
```sh
sudo su - misskey
```
ビルドをする。yes we can…
```sh
cd misskey
NODE_ENV=production pnpm run build
```
:::tip
開発環境の場合、`NODE_ENV=production`は不要です。以降のコマンドでも同様に削除してください。
:::
### サーバーでビルドできない場合
RAMの不足が考えられる。
Misskeyのビルドやデータベースのマイグレーション初期化を含むには、RAMが2GB以上必要になっている。\
RAMが足りない場合、以下のような解決策が考えられる。
- サーバーにスワップを追加する
- ローカルでビルドしたものbuiltディレクトリをsftpで転送する
## データベースの初期化
```sh
pnpm run init
```
## Misskeyを起動する
```sh
NODE_ENV=production pnpm run start
```
**Now listening on port 3000 on** [**http://example.tld**](http://example.tld) と表示されたら、設定したURLにアクセスする。
Misskeyのウェルカムページが表示されるはずだ。
アカウントの作成、ノートの作成やファイルのアップロードといった一通りの操作が正しく行えるか確認しよう。
### アクセスできない場合
#### CloudFlareのDNSを確認する
CloudFlareのDNS設定が正しいIPアドレスになっているかもう一度確認しよう。
#### ルーターの設定を確認する
自宅サーバーの場合、ルーターがサーバーと外部との80ポート・443ポートの通信を許可する設定になっているかどうか確認しよう。
クラウドの場合でも、ネットワーク設定でポート開放が必要な場合が多い。
## Misskeyのデーモンを作成
:::tip
開発環境の場合、デーモンの作成は不要です。
:::
いったんCtrl+Cでプロセスをキルし、Misskeyをデーモンで起動する設定をしよう。
ルート権限で行う。
```sh
exit
```
/etc/systemd/system/misskey.serviceを作成する。
```sh
sudo nano /etc/systemd/system/misskey.service
```
次の内容を貼り付け、保存する。
```ini
[Unit]
Description=Misskey daemon
[Service]
Type=simple
User=misskey
ExecStart=/usr/bin/npm start
WorkingDirectory=/home/misskey/misskey
Environment="NODE_ENV=production"
TimeoutSec=60
StandardOutput=journal
StandardError=journal
SyslogIdentifier=misskey
Restart=always
[Install]
WantedBy=multi-user.target
```
systemdを設定し、misskeyデーモンを開始。
```sh
sudo systemctl daemon-reload
sudo systemctl enable misskey
sudo systemctl start misskey
```
systemctlでデーモンの状態を確認。起動に少し時間がかかるため、15秒程度待ってからのほうが良い。
```sh
sudo systemctl status misskey
```
activeならOK。
**これでMisskeyのインストールはほぼ完了だ。**
Misskeyサーバーに自分のアカウントを登録・ログインし、設定を続けよう。
## Misskeyの設定を続ける
- [**Misskeyサーバーで最初に設定するべきサーバー設定とその他設定の説明**](https://hide.ac/articles/Y504SIabp)
- [**Squidプロキシを設定してMisskeyを守る**](https://hide.ac/articles/MC7WsPDqw)
- [**Misskeyのデータベースをバックアップしよう【OCIオブジェクトストレージ編】**](https://hide.ac/articles/E2Ea3cauk)
## Misskeyのアップデート
[Misskeyのアップデート方法](./manual/#misskeyのアップデート方法)
作業中はMisskeyを使うことができません。
```sh
sudo systemctl stop misskey
su - misskey
git pull;
NODE_ENV=production pnpm install --frozen-lockfile
pnpm run clean;
NODE_ENV=production pnpm run build;
pnpm run migrate;
exit
```
### Case 1: apt upgradeをする場合
```sh
sudo apt update -y
sudo apt full-upgrade -y
sudo reboot
```
再起動後はMisskeyは自動で起動します。
### Case 2: そのまま起動
```sh
sudo systemctl start misskey
```