目次

共通設定

ホスト名の設定

システムのホスト名や関連する設定を照会・変更できるhostnamectlというコマンドがある。(Ubuntu 22.04.1 LTSで確認)

$ hostnamectl
 Static hostname: sstx
       Icon name: computer-laptop
         Chassis: laptop
      Machine ID: 0435c0d2684641d491ef7a8c69295556
         Boot ID: f964fbe42b7a4e429f37c304c53674a7
Operating System: Ubuntu 22.04.1 LTS                
          Kernel: Linux 5.15.0-46-generic
    Architecture: x86-64
 Hardware Vendor: Micro-Star International Co., Ltd.
  Hardware Model: GF63 Thin 10SCXR
$

ホスト名を変更するには、

$ hostnamectl hostname ssty
$ hostnamectl
 Static hostname: ssty
       Icon name: computer-laptop
         Chassis: laptop
      Machine ID: 0435c0d2684641d491ef7a8c69295556
         Boot ID: f964fbe42b7a4e429f37c304c53674a7
Operating System: Ubuntu 22.04.1 LTS                
          Kernel: Linux 5.15.0-46-generic
    Architecture: x86-64
 Hardware Vendor: Micro-Star International Co., Ltd.
  Hardware Model: GF63 Thin 10SCXR
$

タイムゾーンの設定

kimi@sstx:~$ timedatectl 
               Local time: Wed 2022-08-24 07:12:56 UTC
           Universal time: Wed 2022-08-24 07:12:56 UTC
                 RTC time: Wed 2022-08-24 07:12:56
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
kimi@sstx:~$ sudo timedatectl set-timezone Asia/Tokyo
kimi@sstx:~$ timedatectl 
               Local time: Wed 2022-08-24 16:13:26 JST
           Universal time: Wed 2022-08-24 07:13:26 UTC
                 RTC time: Wed 2022-08-24 07:13:26
                Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
              NTP service: active

言語の設定

kimi@sstx:~$ localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: jp
       X11 Model: pc105
kimi@sstx:~$ localectl list-locales 
C.UTF-8
en_US.UTF-8
ja_JP.UTF-8
kimi@sstx:~$ sudo apt -y install language-pack-ja-base language-pack-ja^C
kimi@sstx:~$ sudo localectl set-locale ja_JP.UTF-8
kimi@sstx:~$ localectl
   System Locale: LANG=ja_JP.UTF-8
       VC Keymap: n/a
      X11 Layout: jp
       X11 Model: pc105