Files
game-driver/init_device.md
2025-09-25 11:48:51 +08:00

67 lines
1.6 KiB
Markdown

### ubuntu 24 开机慢优化
```bash
# 在 systemd-networkd-wait-online.service Service 加入 TimeoutStartSec=2sec
sudo EDITOR=vim systemctl edit systemd-networkd-wait-online.service
# 在打开的编辑器中添加:
# [Service]
# TimeoutStartSec=2sec
```
### 初始化设备
```bash
sudo apt update
sudo apt install curl gpg
sudo add-apt-repository ppa:xtradeb/apps
sudo add-apt-repository ppa:trzsz/ppa
sudo apt install -y ungoogled-chromium fontconfig fonts-noto-cjk fonts-noto-color-emoji unclutter xorg i3-wm libvlc-dev libasound2-dev alsa-utils trzsz wireguard wireguard-tools
sudo timedatectl set-timezone Asia/Shanghai
sudo usermod -aG audio,video,dialout $USER
```
### 配置 wireguard
从服务器获取配置文件,保存到 `/etc/wireguard/wg0.conf`,并修改配置文件
> Interface 的 DNS 移除掉,不要配置
```bash
sudo vim /etc/wireguard/wg0.conf
```
### 开启 wireguard
```bash
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0
```
### 自动启动 Xorg 和窗口管理器
编辑 `.bashrc`文件,在文件的末尾添加以下行:
```bash
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
startx
fi
```
这会在你登录后,自动启动 Xorg 和窗口管理器。该脚本检查当前是否在 tty1 控制台(默认终端)上
### 自动登录
使用 systemctl edit 修改 getty@tty1 服务:
```bash
sudo EDITOR=vim systemctl edit getty@tty1.service
# 在打开的编辑器中添加:
# [Service]
# ExecStart=
# ExecStart=-/sbin/agetty --autologin <your_username> --noclear %I $TERM
```
其中:
- <your_username>:替换为你想自动登录的用户名。