From de13d68cddef5bb321469bcffb868f27ddd5390e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 12 Mar 2023 15:12:10 +0900 Subject: style: add .highlight class to pre tag --- .../setup-server-for-this-site/index.html | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'public/posts/2022-10-28/setup-server-for-this-site/index.html') 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 7f45478..6e002c3 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 @@ -73,7 +73,7 @@ ローカルマシンで鍵を生成する。

-
+              
                 $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key
   $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github2teika.key
               
@@ -89,7 +89,7 @@ .ssh/configに設定しておく。

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

-
+              
                 $ sudo adduser **********
     $ sudo adduser ********** sudo
     $ su **********
@@ -124,14 +124,14 @@
             
             

ホスト名を変える

-
+              
                 $ sudo hostname teika
               

公開鍵を置く

-
+              
                 $ 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 vi /etc/ssh/sshd_config
               
@@ -177,7 +177,7 @@ そして設定を反映。

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

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

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

-
+              
                 $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key
 $ cat ~/.ssh/github.key.pub
               
@@ -228,7 +228,7 @@ $ cat ~/.ssh/github.key.pub GitHub の設定画面から、この公開鍵を追加する。

-
+              
                 $ vi ~/.ssh/config
               
@@ -236,7 +236,7 @@ $ cat ~/.ssh/github.key.pub 設定はこう。

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

-
+              
                 ssh -T github.com
               

パッケージの更新

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

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

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

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

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

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

リポジトリのクローン

-
+              
                 $ cd
   $ git clone git@github.com:nsfisis/nsfisis.dev.git
   $ cd nsfisis.dev
@@ -313,7 +313,7 @@ IdentityFile ~/.ssh/github.key
             
             

certbot で証明書取得

-
+              
                 $ docker-compose up -d acme-challenge
   $ make setup
               
@@ -321,7 +321,7 @@ IdentityFile ~/.ssh/github.key

サーバを稼動させる

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