My dotfiles, keep it simple.
注意:本脚本专为 Debian / Ubuntu (Deb 系) 系统设计,仅支持 Deb 系 Linux 发行版。
所有环境配置均整合在 dot 交互式管理菜单中(含首次完整初始化、APT 软件包、Bash/Fish 与 Aliases 更新、多款编程字体、Starship、Rime / Fcitx5-Rime 输入法、Docker、SSH/UFW/Fail2ban、备份与回滚等)。
1. 安装 dot 命令至 /usr/local/bin/dot(推荐):
# GitHub 源
curl -fsSL https://raw.githubusercontent.com/eallion/dotfiles/main/setup.sh | bash -s -- --install
# CNB 国内镜像
curl -fsSL https://cnb.cool/eallion/dotfiles/-/git/raw/main/setup.sh | bash -s -- --install
# 安装后直接运行 dot 启动交互菜单
dot2. 直接在线运行(不安装全局命令):
# GitHub 源
curl -fsSL https://raw.githubusercontent.com/eallion/dotfiles/main/setup.sh | bash
# CNB 国内镜像
curl -fsSL https://cnb.cool/eallion/dotfiles/-/git/raw/main/setup.sh | bash3. dot 命令自管理选项:
| 命令 | 说明 |
|---|---|
dot |
打开交互式管理菜单 |
dot --install |
安装或修复 /usr/local/bin/dot |
dot --update |
升级 dot 至最新版本 |
dot --remove / dot --uninstall |
卸载 /usr/local/bin/dot(保留所有个人配置与备份) |
dot --purge / dot --remove --purge |
彻底卸载并清理 dot、~/.config/dotfiles 备份与本地克隆仓库,并二次询问是否清理已部署个人配置文件 |
dot --help |
查看帮助信息 |
git clone https://github.com/eallion/dotfiles.git && cd dotfiles
./install.sh如需同时安装全局命令:
./install.sh --install运行 dot 或 ./install.sh 后,会依次引导:
- 用户与权限检查:若以
root运行,可选择创建新用户、切换到已有普通用户或继续以root运行(密码、sudo组、NOPASSWD免密与是否继续拉起dot均可自由选择)。 - 来源模式与目标 Shell(首次引导并自动保存):首次运行选择配置来源(远程在线 / 本地克隆)与目标 Shell(
fish/bash)后,会自动保存至~/.config/dotfiles/config,后续再次运行dot将直接沿用默认选择进入主菜单;如需变更,可随时在主菜单[2]与[14]中修改。
配置文件备份与偏好保存在 ~/.config/dotfiles/ 目录下(备份按时间戳子目录归档);可在交互菜单的「配置文件备份与回滚」分支中创建备份、从最新备份恢复或清除历史备份。
共同特性:
- 统一别名管理:
~/.aliases跨 Shell 共享,一致的操作体验。 - 现代化工具链:集成
btop、zoxide、ripgrep、trash-cli等常用工具。 - 安全防护:
mv/cp/rm增加安全提示,rm自动关联trash-cli。 - sudo 免密码配置 (可选)。
- 安装 Starship 及 Gruvbox Rainbow Preset。
- 支持安装与配置 Rime / Fcitx5-Rime / IBus-Rime 输入法:可选五笔·拼音 (
wubi_pinyin)、五笔 86 (wubi86)、袖珍拼音、朙月拼音、双拼与雾凇拼音,支持从eallion/rime在线拉取同步或使用内置通用模板。 - 可选安装 Git 配置。
Bash 特性 (Server):
- Oh My Bash:可选轻量增强。
- 精简工具链:服务器环境仅提供
trash-cli、ripgrep、zoxide、btop,保留原生ls/cat/grep行为。
Fish 特性 (Desktop/Dev):
- 原生配置:使用
~/.config/fish/config.fish和functions目录管理配置。 - 现代工具链:同样接入
starship,zoxide,fzf,mise,eza,bat。 - 别名迁移:把常用别名翻译成 Fish 函数和
abbr,保留原有使用习惯。
以下内容由 setup.sh 自动处理,仅供参考。
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
curl -sSL https://raw.githubusercontent.com/eallion/dotfiles/refs/heads/main/.bashrc -o "$HOME/.bashrc"curl -sS https://starship.rs/install.sh | sh
starship preset gruvbox-rainbow -o ~/.config/starship.toml
sed -i '1s/^/eval "$(starship init bash)"\n/' ~/.bashrc
source ~/.bashrcwget https://github.com/SpaceTimee/Fusion-JetBrainsMapleMono/releases/latest/download/JetBrainsMapleMono-NF-XX-XX-XX.zip
unzip JetBrainsMapleMono-NF-XX-XX-XX.zip
mkdir -p ~/.local/share/fonts
mv *.ttf ~/.local/share/fonts/
rm JetBrainsMapleMono-NF-XX-XX-XX.zip LICENSE.txt
fc-cache -f -vwget https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip
unzip smiley-sans-v2.0.1.zip
mkdir -p ~/.fonts
mv SmileySans-* ~/.fonts
rm smiley-sans-v2.0.1.zip
fc-cache -f -vhttps://mise.jdx.dev/
Dev tools manager (Node.js, Python, etc.)
# APT 安装
sudo apt-get update -y && sudo apt-get install -y gpg curl
sudo install -dm 755 /etc/apt/keyrings
curl -fSs https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64,arm64,armhf] https://mise.jdx.dev/deb stable main" | sudo tee /etc/apt/sources.list.d/mise.list > /dev/null
sudo apt-get update -y
sudo apt-get install -y mise
# 添加到 shell 配置
# Bash:
echo 'eval "$(mise activate bash)"' >> ~/.bashrc
# Fish:
echo 'mise activate fish | source' >> ~/.config/fish/config.fish
# 使用 mise 安装 Node.js 和 pnpm
mise use --global node@lts
mise use --global pnpm@latest# 使用官方安装脚本
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# 添加用户到 docker 组
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# 配置 Docker 服务(可选)
sudo systemctl disable docker.service
sudo systemctl disable docker.socket
sudo systemctl disable containerd.service# 安装 UFW
sudo apt-get install -y ufw
# 配置默认策略
sudo ufw default deny incoming
sudo ufw default allow outgoing
# 允许 SSH
sudo ufw allow ssh
# 启用 UFW
sudo ufw --force enable
# 查看状态
sudo ufw status# 下载 ufw-docker 脚本
sudo wget -O /usr/local/bin/ufw-docker https://github.com/chaifeng/ufw-docker/raw/master/ufw-docker
sudo chmod +x /usr/local/bin/ufw-docker
# 配置 UFW Docker 规则
sudo tee -a /etc/ufw/after.rules > /dev/null <<EOF
# ufw-docker
*filter
:ufw-user-forward - [0:0]
:DOCKER-USER - [0:0]
-A DOCKER-USER -j UFW-USER-FORWARD
-A UFW-USER-FORWARD -j RETURN -s 10.0.0.0/8
-A UFW-USER-FORWARD -j RETURN -s 172.16.0.0/12
-A UFW-USER-FORWARD -j RETURN -s 192.168.0.0/16
-A UFW-USER-FORWARD -p tcp -d 127.0.0.1 --dport 2375 -j RETURN
-A UFW-USER-FORWARD -p tcp -d 127.0.0.1 --dport 2376 -j RETURN
COMMIT
EOF
# 重新加载 UFW
sudo ufw reload
# 使用示例
ufw-docker allow nginx
ufw-docker allow mysql# 下载并安装 Ghostty (根据你的系统选择合适的包)
# Ubuntu/Debian:
curl -fsSL https://github.com/ghostty-org/ghostty/releases/latest/download/ghostty_amd64.deb -o ghostty.deb
sudo dpkg -i ghostty.deb
# 或者从源码编译 (需要 Go)
git clone https://github.com/ghostty-org/ghostty
cd ghostty
sudo apt install libgtk-4-dev libadwaita-1-dev
go build -o ghostty ./cmd/ghostty
# 配置 Ghostty
mkdir -p ~/.config/ghostty
# 下载配置文件
curl -fsSL https://raw.githubusercontent.com/eallion/dotfiles/main/.config/ghostty/config.ghostty -o ~/.config/ghostty/config.ghostty
curl -fsSL https://raw.githubusercontent.com/eallion/dotfiles/main/.config/ghostty/auto/theme.ghostty -o ~/.config/ghostty/auto/theme.ghostty