1.パッケージのアップデート
Windows PC からsshでログイン後、パッケージのアップデートを行う。
yuu@web2:~$ sudo apt update (中略) yuu@web2:~$ sudo apt upgrade |
2.localeの設定
language-pack-ja のインストール。
yuu@web2:~$ sudo apt-get install language-pack-ja |
locale に ja_JP.UTF-8 を設定。
yuu@web2:~$ sudo update-locale LANG=ja_JP.UTF-8 |
確認する。
yuu@web2:~$ sudo cat /etc/default/locale LANG=ja_JP.UTF-8 |
3.タイムゾーンの設定
dpkg-reconfigure tzdata コマンドを実⾏してインタラクティブウィンドウからtimezone を選択、設定する。
yuu@web2:~$ sudo dpkg-reconfigure tzdata |
地域はAsia を選択してTABキーで<Ok>をハイライトしてEnter。
都市名は”Hong Kong” を選択。(実際は中華人民共和国広州市在住)
同様に<Ok>をハイライトしてEnterで設定完了。
コマンドラインに設定されたデフォルトのタイムゾーンと現在時刻が表示されルので確認する。
Current default time zone: ‘Asia/Hong_Kong’ Local time is now: Tue Feb 9 10:17:46 HKT 2021. Universal Time is now: Tue Feb 9 02:17:46 UTC 2021. |
4.時刻の設定
ntp のインストール。
yuu@web2:~$ sudo apt-get install ntp |
時刻を取得するサーバーを設定するために ntp を停止する。
yuu@web2:~$ sudo service ntp stop |
/etc/ntp.conf を編集して時刻同期先のサーバーを設定する。
yuu@web2:~$ sudo nano /etc/ntp.conf |
yuu@web2:~$ sudo service ntp start yuu@web2:~$ sudo service ntp status |
サーバーを再起動して同様に、
sudo service ntp status
で確認。
Active: active (running) |
となっていれば自動起動が働いている。
5.パッケージの自動アップデート
unattended-upgradesをインストールする。
yuu@web2:~$ sudo apt-get install unattended-upgrades |
dpkg-reconfigure -plow unattended-upgrades を起動して自動更新を設定する。
yuu@web2:~$ sudo dpkg-reconfigure -plow unattended-upgrades |
/etc/apt/apt.conf.d/50unattended-upgrades ファイルで更新対象の設定を確認する。
yuu@web2:~$ sudo nano /etc/apt/apt.conf.d/50unattended-upgrades |
セキュリティ関係のみを自動アップデートに設定(デフォルトのまま)した。
項目 | 意味 |
security | 重要なセキュリティアップデート |
updates | 推奨アップデート |
proposed | プレリリースされたアップデート |
backport | サポートされていないアップデート |
その他、ポートやファイアウォールの設定は導入するパッケージの設定と併せて修正する。