yassy's note

なんかかきます

Guacamoleコンソールの文字化け解消

環境はCentOS7、Guacamole1.3.0。
Guacamoleでコンソールを使う際、デフォルトだと以下のように文字化けする。
日本語だけでなく、アルファベットも妙なサイズとなってしまう。

f:id:yassy_225:20211013182413p:plain

これを解消するためには、等幅フォントを設定する必要がある。
今回はdejavu-sans-mono-fontsと日本語対応としてvlgothic-fontsを使用する。

# yum install dejavu-sans-mono-fonts vlgothic-fonts

インストール後、fc-cacheコマンドでフォント一覧を更新する。

[root@ip-172-31-38-88 lib]# fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/dejavu: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/fonts/vlgothic: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/X11/fonts/Type1: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts/dejavu: skipping, looped directory detected
/usr/share/fonts/vlgothic: skipping, looped directory detected
/usr/lib/fontconfig/cache: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
/usr/bin/fc-cache-64: succeeded

fc-listコマンドでインストールしたフォントが登録されていることを確認する。

[root@ip-172-31-38-88 lib]# fc-list | grep -e VL-Gothic-Regular.ttf -e DejaVuSansMono.ttf
/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf: VL Gothic:style=regular

OS側のフォント導入完了後、Guacamole側に設定を行う。
以下のように、接続設定のフォント名を設定する。

f:id:yassy_225:20211013184537p:plain

実は、フォント名は複数設定可能であるため、今回インストールしたdejavu-sans-mono-fontsとvlgothic-fontsをカンマ区切りで設定する。
ここで設定するフォント名は、fc-listコマンドで表示されるフォントから、拡張子ttfを取ったものとなる。

例えば、/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Bookであれば、DejaVuSansMono
/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf: VL Gothic:style=regularであれば、VL-Gothic-Regularとなる。

設定後、コンソールにログインすると以下のように文字化けが解消されている。 f:id:yassy_225:20211013184528p:plain