仮想マシンを作る
VPS 2G
- 石狩/CPU 3Core/RAM 2GB/HDD 100GB
- 公開鍵を登録する (インストール後、ubuntuユーザの公開鍵になる)
- 鍵ペアの作成 (PowerShell に ssh-keygen コマンドがあるよ)
C:\Users\atsus\> ssh-keygen
- id_rsa.sakura (秘密鍵)
- id_ras.pub.sakura (公開鍵)
- 鍵ペアの作成 (PowerShell に ssh-keygen コマンドがあるよ)
- ubuntuユーザのパスワードを自動生成してダウンロードしておく
初期作業
Windows端末の設定
- C:\Users\atsus\.ssh\config
Host sakura User ubuntu HostName at-sushi.com IdentityFile C:\Users\atsus\.ssh\id_rsa.sakura
ログインしてアップデート
ubuntu@www4250uj:~$ sudo -s [sudo] password for ubuntu: root@www4250uj:/home/ubuntu# apt-get update && apt-get -y upgrade
Swapfile の設定
- メモリ2GBだと、さすがになんも動かんので 6GB の Swap ファイルを作る
# dd if=/dev/zero of=/swapfile bs=1M count=6144 # chmod 600 /swapfile # mkswap /swapfile # swapon /swapfile # free -mh total used free shared buffers cached Mem: 2.0G 1.9G 77M 51M 103M 1.4G -/+ buffers/cache: 375M 1.6G Swap: 8.0G 0B 8.0G
- 起動時に自動的にマウントするように設定 /etc/fstab に次の設定を追加
/swapfile swap swap defaults 0 0
- いったん再起動
# reboot