MATE - FreeBSD 13.1 RELEASE - 環境構築

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

1. 概要

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

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

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

 をご参照ください。

2. インストール

 「root」ユーザ権限で。

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

$ pkg info mate
mate-1.26.0
Name           : mate
Version        : 1.26.0
Installed on   : Thu May 19 19:42:40 2022 JST
Origin         : x11/mate
Architecture   : FreeBSD:13:*
Prefix         : /usr/local
Categories     : x11 mate
Licenses       :
Maintainer     : gnome@FreeBSD.org
WWW            : http://www.FreeBSD.org/gnome/
Comment        : "meta-port" for the MATE integrated X11 desktop
Annotations    :
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 0.00B
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.

WWW: http://www.FreeBSD.org/gnome/
 「FreeBSD 12.3 RELEASE」へインストールしたときが「mate-1.24.1」だったので、ぐっと上がった気がします。

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 theme used in the greeter
CursorTheme=breeze_cursors
 を下記へ変更します。

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

# 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
 を編集します。  「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」ユーザ権限で。

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
exit

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 13.1 RELEASE」-「ログイン画面」

 (う~ん、ログイン画面まで、日本語にしちゃったのは、どうなんだろう)

ハイスピードプラン