Ubuntuの日本語化

こちらも備忘録となります。

普段インストールしている限りでは日本語環境が入っているのですが、たまに日本語環境が設定されていないUbuntuで出会うことがあります。
今回そういう場面に出くわしたので行った作業を備忘録として残しておきます。

とりあえずはパッケージリストのアップデートを行います。

```:
nomura@ubuntu-linux-2404:~$ sudo apt update
[sudo] password for nomura: 
Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease
Get:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease [126 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease [126 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease [126 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 Packages [1,069 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports noble-updates/main Translation-en [227 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 Components [159 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports noble-updates/main Icons (48x48) [34.7 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports noble-updates/main Icons (64x64) [49.6 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 c-n-f Metadata [13.2 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports noble-updates/restricted arm64 Packages [1,298 kB]
Get:12 http://ports.ubuntu.com/ubuntu-ports noble-updates/restricted Translation-en [220 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports noble-updates/restricted arm64 Components [212 B]
Get:14 http://ports.ubuntu.com/ubuntu-ports noble-updates/restricted arm64 c-n-f Metadata [440 B]
Get:15 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 Packages [1,029 kB]
Get:16 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe Translation-en [268 kB]
Get:17 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 Components [375 kB]
Get:18 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe Icons (48x48) [226 kB]
Get:19 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe Icons (64x64) [350 kB]
Get:20 http://ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 c-n-f Metadata [25.4 kB]
Get:21 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse arm64 Packages [17.1 kB]
Get:22 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse Translation-en [4,788 B]
Get:23 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse arm64 Components [212 B]
Get:24 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse Icons (48x48) [1,867 B]
Get:25 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse Icons (64x64) [2,497 B]
Get:26 http://ports.ubuntu.com/ubuntu-ports noble-updates/multiverse arm64 c-n-f Metadata [408 B]
Get:27 http://ports.ubuntu.com/ubuntu-ports noble-backports/main arm64 Packages [39.1 kB]
Get:28 http://ports.ubuntu.com/ubuntu-ports noble-backports/main Translation-en [8,676 B]
Get:29 http://ports.ubuntu.com/ubuntu-ports noble-backports/main arm64 Components [3,584 B]
Get:30 http://ports.ubuntu.com/ubuntu-ports noble-backports/main Icons (48x48) [9,518 B]
Get:31 http://ports.ubuntu.com/ubuntu-ports noble-backports/main Icons (64x64) [11.2 kB]
Get:32 http://ports.ubuntu.com/ubuntu-ports noble-backports/main arm64 c-n-f Metadata [272 B]
Get:33 http://ports.ubuntu.com/ubuntu-ports noble-backports/restricted arm64 Components [216 B]
Get:34 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe arm64 Packages [27.1 kB]
Get:35 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe Translation-en [16.5 kB]
Get:36 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe arm64 Components [16.4 kB]
Get:37 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe Icons (48x48) [20.4 kB]
Get:38 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe Icons (64x64) [28.7 kB]
Get:39 http://ports.ubuntu.com/ubuntu-ports noble-backports/universe arm64 c-n-f Metadata [1,300 B]
Get:40 http://ports.ubuntu.com/ubuntu-ports noble-backports/multiverse arm64 Components [212 B]
Get:41 http://ports.ubuntu.com/ubuntu-ports noble-security/main arm64 Packages [794 kB]
Get:42 http://ports.ubuntu.com/ubuntu-ports noble-security/main Translation-en [147 kB]
Get:43 http://ports.ubuntu.com/ubuntu-ports noble-security/main arm64 Components [18.4 kB]
Get:44 http://ports.ubuntu.com/ubuntu-ports noble-security/main Icons (48x48) [13.4 kB]
Get:45 http://ports.ubuntu.com/ubuntu-ports noble-security/main Icons (64x64) [20.0 kB]
Get:46 http://ports.ubuntu.com/ubuntu-ports noble-security/main arm64 c-n-f Metadata [6,816 B]
Get:47 http://ports.ubuntu.com/ubuntu-ports noble-security/restricted arm64 Packages [1,123 kB]
Get:48 http://ports.ubuntu.com/ubuntu-ports noble-security/restricted Translation-en [191 kB]
Get:49 http://ports.ubuntu.com/ubuntu-ports noble-security/restricted arm64 Components [212 B]
Get:50 http://ports.ubuntu.com/ubuntu-ports noble-security/restricted arm64 c-n-f Metadata [416 B]
Get:51 http://ports.ubuntu.com/ubuntu-ports noble-security/universe arm64 Packages [807 kB]
Get:52 http://ports.ubuntu.com/ubuntu-ports noble-security/universe Translation-en [181 kB]
Get:53 http://ports.ubuntu.com/ubuntu-ports noble-security/universe arm64 Components [52.3 kB]
Get:54 http://ports.ubuntu.com/ubuntu-ports noble-security/universe Icons (48x48) [45.0 kB]
Get:55 http://ports.ubuntu.com/ubuntu-ports noble-security/universe Icons (64x64) [70.7 kB]
Get:56 http://ports.ubuntu.com/ubuntu-ports noble-security/universe arm64 c-n-f Metadata [16.6 kB]
Get:57 http://ports.ubuntu.com/ubuntu-ports noble-security/multiverse arm64 Packages [15.3 kB]
Get:58 http://ports.ubuntu.com/ubuntu-ports noble-security/multiverse Translation-en [3,792 B]
Get:59 http://ports.ubuntu.com/ubuntu-ports noble-security/multiverse arm64 Components [212 B]
Get:60 http://ports.ubuntu.com/ubuntu-ports noble-security/multiverse arm64 c-n-f Metadata [368 B]
Fetched 9,441 kB in 5s (2,060 kB/s)      
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
544 packages can be upgraded. Run 'apt list --upgradable' to see them.
```

パッケージリストが最新になったら、日本語パッケージをインストールします。

```
nomura@ubuntu-linux-2404:~$ sudo apt install language-pack-ja
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  language-pack-ja-base
The following NEW packages will be installed:
  language-pack-ja language-pack-ja-base
0 upgraded, 2 newly installed, 0 to remove and 544 not upgraded.
Need to get 1,580 kB of archives.
After this operation, 7,354 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 language-pack-ja-base all 1:24.04+20250130 [1,578 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 language-pack-ja all 1:24.04+20250130 [1,900 B]
Fetched 1,580 kB in 3s (538 kB/s)            
Selecting previously unselected package language-pack-ja-base.
(Reading database ... 171833 files and directories currently installed.)
Preparing to unpack .../language-pack-ja-base_1%3a24.04+20250130_all.deb ...
Unpacking language-pack-ja-base (1:24.04+20250130) ...
Selecting previously unselected package language-pack-ja.
Preparing to unpack .../language-pack-ja_1%3a24.04+20250130_all.deb ...
Unpacking language-pack-ja (1:24.04+20250130) ...
Setting up language-pack-ja (1:24.04+20250130) ...
Setting up language-pack-ja-base (1:24.04+20250130) ...
Generating locales (this might take a while)...
  ja_JP.UTF-8... done
Generation complete.
Scanning processes...                                                           
Scanning linux images...                                                        

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
```

次に設定を行っていきます。

```
nomura@ubuntu-linux-2404:~$ sudo dpkg-reconfigure locales
```

設定アプリが立ち上がり以下のような画面になります。

![スクリーンショット 2025-05-04 9.52.18.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/28184/7cfad66b-0869-4170-98da-73f83691d05f.png)

この画面でja_JP.UTF-8を選択して<OK>を選択します。
項目移動はTABキーでできます。

![スクリーンショット 2025-05-04 9.52.55.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/28184/522b1264-0a5f-407c-b3a7-8c61f2c78a04.png)

設定アプリが終了して、以下のようなメッセージが表示されます。
en_US.UTF-8とja_JP.UTF-8のロケールが生成されます。

```
Generating locales (this might take a while)...
  en_US.UTF-8... done
  ja_JP.UTF-8... done
Generation complete.
```

以上です。