LXDE - FreeBSD 14.2 RELEASE - 環境構築

クラウディア 
1. 概要
2. インストール
3. SDDM カスタマイズ
4. シャットダウンユーザ設定
5. ユーザ用初期化ファイルの作成
6. ログインマネージャ起動

1. 概要

 下記のデスクトップ環境を構築する手順を記述します。
種  別 リソース・設定  備考 
ホスト Windows11 Version 24H2
VitualBox Version 7.1.4
仮想タイプ BSD
仮想サブタイプ FreeBSD
仮想バージョン FreeBSD(64bit)
ゲスト FreeBSD 14.2 RELEASE
ログインマネージャ SDDM
ハードディスク 180 GB
メモリ 4 GB
CPU 2コア
グラフィックスコントローラ VBoxSVGA 128MB 3D Disable

 ここまでの時点で、システムインストールと「VirtualBox Guest Additions」の設定は終わっているものとします。
 ぞれぞれのインストール・設定に関しては、

	「FreeBSD - デスクトップ環境構築 - 共通事項 - システムインストール」
	「FreeBSD - デスクトップ環境構築 - 共通事項 - VirtualBox Guest Additions」

 をご参照ください。

2. インストール

 「root」ユーザ権限で。

pkg install -y xorg ja-font-migmix numlockx
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme

pkg install -y x11/lxde-meta
 バージョンの推移です。 ・2020年11月 6日「FreeBSD 12.2 RLEASE」 「1.0_8」 ・2021年 6月 9日「FreeBSD 13.0 RLEASE」 「1.0_8」 ・2022年 1月 5日「FreeBSD 12.3 RLEASE」 「1.0_8」 ・2022年12月13日「FreeBSD 12.4 RLEASE」 「1.0_8」 ・2023年 4月19日「FreeBSD 13.2 RLEASE」 「1.0_8」 ・2024年 1月15日「FreeBSD 14.0 RLEASE」 「1.0_8」 ・2024年 3月26日「FreeBSD 13.3 RLEASE」 「1.0_8」 ・2024年 6月12日「FreeBSD 14.1 RLEASE」 「1.0_8」 ・2024年10月21日「FreeBSD 13.4 RLEASE」 「1.0_8」  「LXDE」の主力は、おそらく後継の「LXQt」へ移行しているので、バージョンアップは、ないものと思われます。  しかし、確か、10年間メンテナンスされないと「ports」から消えてしまうはず、心配になります。  2024年12月16日の時点で「LXDE」のバージョンは、下記の通りでした。

$ pkg info lxde-meta
lxde-meta-1.0_8
Name           : lxde-meta
Version        : 1.0_8
Installed on   : Mon Dec 16 11:49:31 2024 JST
Origin         : x11/lxde-meta
Architecture   : FreeBSD:14:*
Prefix         : /usr/local
Categories     : x11
Licenses       : NA
Maintainer     : ports@FreeBSD.org
WWW            : https://lxde.org/
Comment        : "meta-port" of the LXDE desktop slimmed down for FreeBSD releases
Annotations    :
        build_timestamp: 2024-11-28T01:24:54+0000
        built_by       : poudriere-git-3.4.2
        port_checkout_unclean: no
        port_git_hash  : 19fbadfb9
        ports_top_checkout_unclean: no
        ports_top_git_hash: 07b331c5e
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 243B
Description    :
LXDE is a small and lightweight X11 Desktop

3. SDDM カスタマイズ

 ログイン画面の解像度を「1366x768」とし、キーボードレイアウトを「jp.106」にします。  「root」ユーザ権限で。

cat << EOF >>  /usr/local/share/sddm/scripts/Xsetup

xrandr --output VGA-0 --mode 1366x768 --rate 60
setxkbmap -layout jp
EOF
 ログイン画面のテーマとカーソルを変更します。  「root」ユーザのまま。

sddm --example-config > /usr/local/etc/sddm.conf
vi /usr/local/etc/sddm.conf

[Theme]
# Current theme name
Current=breeze

# Cursor size used in the greeter
CursorSize=

# Cursor theme used in the greeter
CursorTheme=breeze_cursors
 を下記へ変更します。

[Theme]
# Current theme name
Current=sddm-freebsd-black-theme

# Cursor size used in the greeter
CursorSize=

# Cursor theme used in the greeter
CursorTheme=Neutral++_White

4. シャットダウンユーザの設定

 一般ユーザからもシャットダウンできるようにします。  逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。  「LXDE - Why does Mate system menu not have the Shutdown and Restart items? | The FreeBSD Forums」を参考にさせていただきました。

/usr/local/etc/polkit-1/rules.d/50-default.rules
 を編集します。  「root」ユーザ権限で。

sh
cat << 'EOF' >> /usr/local/etc/polkit-1/rules.d/50-default.rules

polkit.addRule(function (action, subject)
{
    if ((action.id == "org.freedesktop.consolekit.system.restart" ||
         action.id == "org.freedesktop.consolekit.system.stop")   &&
         subject.isInGroup("wheel"))
    {
        return polkit.Result.YES;
    }
});
EOF
exit
 「wheel」の箇所に、再起動・シャットダウンを許可したいユーザの所属する、グループ名を記述します。  わたしは、サスペンドを使いませんので、省略しています。  サスペンドを許可するには、「subject.isInGroup("wheel"))」の前に続けて、「|| action.id == "org.freedesktop.consolekit.system.suspend"」を追加します。

5. ユーザ用初期化ファイルの作成

 「root」ユーザ権限で。  日本語環境を有効にし、キーボードレイアウトを設定して、Num Lock を有効にします。

sh
cat << 'EOF' >> /etc/profile

export LC_ALL=ja_JP.UTF-8
export LANGUAGE=ja_JP.UTF-8
export LANG=ja_JP.UTF-8
EOF

cat << 'EOF' >> /etc/csh.cshrc

setenv LANG             ja_JP.UTF-8
setenv LANGUAGE         ja_JP.UTF-8
setenv LANG             ja_JP.UTF-8
EOF

cat - << EOF >> /usr/share/skel/dot.xsession
#!/bin/sh
# set locale
#
setxkbmap -layout jp
numlockx &
EOF
exit

chmod +x /usr/share/skel/dot.xsession
 既存のログインユーザで

cp /usr/share/skel/dot.xsession ~/.xsession

6. ログインマネージャ起動

 前項までインストール・設定したものを有効にします。  「root」ユーザ権限で。

sysrc dbus_enable=YES
sysrc sddm_enable=YES
 起動。

service dbus start
service sddm start
 うまく設定できていれば、ログイン画面が表示されます。  ユーザ名・パスワードを入力してログインします。
「LXDE FreeBSD 14.2」-「ログイン画面」

AbemaTV 無料体験
世界最大級のオンライン英会話EF English Live
Amazonギフトカード