MATE - FreeBSD 14.0 RELEASE - 環境構築

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

1. 概要

 下記のデスクトップ環境を構築する手順を記述します。
 項目   内容   備考 
ホスト Windows11 Version 23H2
VitualBox Version 7.0.12
ゲスト FreeBSD 14.0 RELEASE
ログインマネージャ SDDM

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

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

 をご参照ください。

2. インストール

 「root」ユーザ権限で。

pkg install -y xorg numlockx ja-font-migmix
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme
pkg install -y mate brisk-menu dconf-editor
 2023年12月11日時点の「MATE」のバージョンは、下記の通りでした。

$ pkg info mate
mate-1.26.0_2
Name           : mate
Version        : 1.26.0_2
Installed on   : Mon Dec 11 16:57:11 2023 JST
Origin         : x11/mate
Architecture   : FreeBSD:14:*
Prefix         : /usr/local
Categories     : x11 mate
Licenses       : NA
Maintainer     : gnome@FreeBSD.org
WWW            : https://www.FreeBSD.org/gnome/
Comment        : "meta-port" for the MATE integrated X11 desktop
Annotations    :
        build_timestamp: 2023-12-06T13:03:46+0000
        built_by       : poudriere-git-3.3.0-1258-gbc38e2e6
        port_checkout_unclean: no
        port_git_hash  : 2b5c95373
        ports_top_checkout_unclean: no
        ports_top_git_hash: 84b4661ec
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 243B
Description    :
MATE is a fork of GNOME 2.

It provides an intuitive and attractive desktop to users using
traditional metaphors.

--

Where does the name come from?

The name "MATE" comes from yerba mate, a species of holly native
to subtropical South America. Its leaves contain caffeine and are
used to make infusions and a beverage called mate.

--

This metaport installs MATE base (lite, a lean desktop) plus
extras applications such as text editor, archiver manager and
etc. If you do not want to have the bloats, please install
x11/mate-base.
 「FreeBSD 12.2 RELEASE」「FreeBSD 12.2 RELEASE」へインストールしたときのバージョンが、「mate-1.24.1」でした。  2022年12月6日、「FreeBSD 12.4 RELEASE」へインストール、2023年4月13日、「FreeBSD 12.4 RELEASE」へインストール時のバージョンが「mate-1.26.0」だったので、微妙に変わっています。

3. SDDM カスタマイズ

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

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

xrandr --output VGA-0 --mode 1366x768 --rate 60
setxkbmap -layout jp
EOF
exit
 「xrandr」の設定値は、ハードウェア構成によって異なりますので、ご注意ください。  適切に設定しないと、デスクトップ上の文字が、異常に大きくなったりします。  ログイン画面のテーマとカーソルを変更します。  「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. シャットダウンユーザの設定

 一般ユーザからもシャットダウンできるようにします。  逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。  「MATE - 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
 を編集します。

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」ユーザ権限で。

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 LC_ALL   "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
#
setxkbmap -layout jp
EOF
exit

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

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

6. /etc/rc.conf 編集

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

sysrc polkitd_enable=YES
sysrc dbus_enable=YES
sysrc sddm_enable=YES

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

 「root」ユーザ権限で。

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

ハイスピードプランそれがだいじWi-Fi