# 8.8 LXDE

## LXDE 桌面环境概述

LXDE 是一款轻量级桌面环境，专注于资源利用效率与简洁的交互体验，在低配置硬件平台上表现优异。

## 安装 LXDE 桌面环境

* 使用 pkg 安装：

```sh
# pkg install lxde-meta xorg lightdm lightdm-gtk-greeter wqy-fonts xdg-user-dirs
```

* 或使用 Ports 安装：

```sh
# cd /usr/ports/x11/lxde-meta/ && make install clean
# cd /usr/ports/x11/xorg/ && make install clean
# cd /usr/ports/x11/lightdm/ && make install clean
# cd /usr/ports/x11/lightdm-gtk-greeter/ && make install clean
# cd /usr/ports/x11-fonts/wqy/ && make install clean
# cd /usr/ports/devel/xdg-user-dirs/ && make install clean
```

### 软件包说明

| 包名                    | 作用说明                                              |
| --------------------- | ------------------------------------------------- |
| `xorg`                | X 窗口系统                                            |
| `lxde-meta`           | LXDE 桌面环境的元包                                      |
| `lightdm`             | 轻量级显示管理器 LightDM                                  |
| `lightdm-gtk-greeter` | LightDM GTK+ 登录界面插件，LightDM 需要至少一个 greeter 才能正常工作 |
| `wqy-fonts`           | 文泉驿中文字体                                           |
| `xdg-user-dirs`       | 管理用户目录，如“桌面”、“下载”等                                |

## startx

编辑 **\~/.xinitrc** 文件，添加以下内容，以便通过 startx 命令启动 LXDE 桌面环境：

```sh
exec startlxde
```

## 启动项

设置 D-Bus 服务开机自启：

```sh
# service dbus enable
```

设置 LightDM 显示管理器开机自启：

```sh
# service lightdm enable
```

## 挂载 proc 文件系统

编辑 **/etc/fstab** 文件，加入下行：

```ini
proc           /proc       procfs  rw  0   0
```

### 中文配置

在 **/etc/rc.conf** 文件中加入：

```ini
lightdm_env="LC_MESSAGES=zh_CN.UTF-8"
```

设置 LightDM 环境变量，将系统消息语言指定为中文。

还需要编辑 **/etc/login.conf** 文件，找到 `default:\` 部分，将 `:lang=C.UTF-8` 修改为 `:lang=zh_CN.UTF-8`。最后根据 **/etc/login.conf** 文件重建能力数据库：

```sh
# cap_mkdb /etc/login.conf
```

## 桌面欣赏

![FreeBSD 安装 LXDE](/files/sLRpBhHJKK9l1zp5wg9A)

![FreeBSD 安装 LXDE](/files/uf24XiUacWmpASfCq4QC)

![FreeBSD 安装 LXDE](/files/gLQmgkspGTvCjjcBfnA7)

## 参考文献

* FreeBSD Project. Install & Configure a Desktop Environment: LXDE\[EB/OL]. \[2026-03-25]. <https://wiki.freebsd.org/LXDE>. LXDE 桌面环境安装与配置指南。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/di-8-zhang-zhuo-mian-huan-jing/di-8.8-jie-lxde.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
