From 0766039bd9e6b9f5e6334e84666f5be698d41fc3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 17 Mar 2023 01:35:04 +0900 Subject: feat(nuldoc): implement syntax highlight --- .../setup-server-for-this-site/index.html | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'public/posts/2022-10-28') diff --git a/public/posts/2022-10-28/setup-server-for-this-site/index.html b/public/posts/2022-10-28/setup-server-for-this-site/index.html index e050bac..2f458ad 100644 --- a/public/posts/2022-10-28/setup-server-for-this-site/index.html +++ b/public/posts/2022-10-28/setup-server-for-this-site/index.html @@ -10,7 +10,7 @@ 【備忘録】 このサイト用の VPS をセットアップしたときのメモ | REPL: Rest-Eat-Program Loop - +
@@ -83,7 +83,7 @@ ローカルマシンで鍵を生成する。

-
$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key
+              
$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key
   $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github2teika.key

@@ -97,7 +97,7 @@ .ssh/configに設定しておく。

-
Host teika
+              
Host teika
   HostName **********
   User **********
   Port **********
@@ -120,7 +120,7 @@
                 管理者ユーザで作業すると危ないので、メインで使うユーザを作成する。sudoグループに追加してsudoできるようにし、suで切り替え。
               

-
$ sudo adduser **********
+              
$ sudo adduser **********
     $ sudo adduser ********** sudo
     $ su **********
     $ cd
@@ -128,12 +128,12 @@

ホスト名を変える

-
$ sudo hostname teika
+
$ sudo hostname teika

公開鍵を置く

-
$ mkdir ~/.ssh
+              
$ mkdir ~/.ssh
   $ chmod 700 ~/.ssh
   $ vi ~/.ssh/authorized_keys
@@ -148,7 +148,7 @@ SSH の設定を変更し、少しでも安全にしておく。

-
$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
+              
$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
   $ sudo vi /etc/ssh/sshd_config
    @@ -175,7 +175,7 @@ そして設定を反映。

    -
    $ sudo systemctl restart sshd
    +              
    $ sudo systemctl restart sshd
     $ sudo systemctl status sshd
@@ -185,7 +185,7 @@ $ sudo systemctl status sshd
今の SSH セッションは閉じずに、ターミナルを別途開いて疎通確認する。セッションを閉じてしまうと、SSH の設定に不備があった場合に締め出しをくらう。

-
$ ssh teika
+
$ ssh teika
@@ -194,7 +194,7 @@ $ sudo systemctl status sshd
デフォルトの 22 番を閉じ、設定したポートだけ空ける。

-
$ sudo ufw deny ssh
+              
$ sudo ufw deny ssh
   $ sudo ufw allow *******
   $ sudo ufw enable
   $ sudo ufw reload
@@ -211,20 +211,20 @@ $ sudo systemctl status sshd
GitHub に置いてある private リポジトリをサーバから clone したいので、SSH 鍵を生成して置いておく。

-
$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key
+              
$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key
 $ cat ~/.ssh/github.key.pub

GitHub の設定画面から、この公開鍵を追加する。

-
$ vi ~/.ssh/config
+
$ vi ~/.ssh/config

設定はこう。

-
Host github.com
+              
Host github.com
 HostName github.com
 User git
 IdentityFile ~/.ssh/github.key
@@ -233,12 +233,12 @@ IdentityFile ~/.ssh/github.key
最後に接続できるか確認しておく。

-
ssh -T github.com
+
ssh -T github.com

パッケージの更新

-
$ sudo apt update
+              
$ sudo apt update
   $ sudo apt upgrade
   $ sudo apt update
   $ sudo apt upgrade
@@ -257,12 +257,12 @@ IdentityFile ~/.ssh/github.key

使うソフトウェアのインストール

-
$ sudo apt install docker docker-compose git make
+
$ sudo apt install docker docker-compose git make

メインユーザが Docker を使えるように

-
sudo adduser ********** docker
+
sudo adduser ********** docker
@@ -271,7 +271,7 @@ IdentityFile ~/.ssh/github.key
80 番と 443 番を空ける。

-
$ sudo ufw allow 80/tcp
+              
$ sudo ufw allow 80/tcp
     $ sudo ufw allow 443/tcp
     $ sudo ufw reload
     $ sudo ufw status
@@ -279,7 +279,7 @@ IdentityFile ~/.ssh/github.key

リポジトリのクローン

-
$ cd
+              
$ cd
   $ git clone git@github.com:nsfisis/nsfisis.dev.git
   $ cd nsfisis.dev
   $ git submodule update --init
@@ -287,13 +287,13 @@ IdentityFile ~/.ssh/github.key

certbot で証明書取得

-
$ docker-compose up -d acme-challenge
+              
$ docker-compose up -d acme-challenge
   $ make setup

サーバを稼動させる

-
$ make serve
+
$ make serve
-- cgit v1.2.3-70-g09d2