182 lines
4.0 KiB
Markdown
182 lines
4.0 KiB
Markdown
# WSL2 Debian 开发环境配置
|
||
|
||
这是一个用于在 Windows 11 上配置 WSL2 Debian 开发环境的项目。该项目提供了一系列脚本来自动化安装和配置各种开发工具和环境。
|
||
|
||
## 功能特性
|
||
|
||
### 基础系统环境
|
||
- 安装 WSL2 Debian
|
||
- 系统更新和配置
|
||
- 配置镜像源
|
||
- 安装基础工具
|
||
- WSL2 环境检查(Windows 端)
|
||
- WSL2 环境检查(Linux 端)
|
||
|
||
### Shell 环境
|
||
- 安装和配置 Zsh
|
||
- 安装常用 Zsh 插件
|
||
- zsh-autosuggestions
|
||
- zsh-syntax-highlighting
|
||
- zsh-completions
|
||
- autojump
|
||
- fzf
|
||
- zsh-nvm
|
||
- pyenv
|
||
|
||
### 编辑器环境
|
||
- 安装和配置 Neovim
|
||
- 安装常用 Neovim 插件
|
||
- 配置 NvChad
|
||
|
||
### 开发工具链
|
||
- Docker 和 Docker Compose
|
||
- Go 语言环境
|
||
- Node.js 环境
|
||
- Python 环境
|
||
- PHP 开发环境(使用 DNMP)
|
||
|
||
### 系统工具
|
||
- Git 配置和工具
|
||
- 系统监控工具
|
||
- 网络工具
|
||
- 安全工具
|
||
- 终端工具
|
||
- 开发效率工具
|
||
|
||
## 项目结构
|
||
|
||
```
|
||
.
|
||
├── README.md
|
||
├── init.sh
|
||
└── scripts/
|
||
├── shell/
|
||
│ ├── zsh.sh
|
||
│ └── plugins.sh
|
||
├── editor/
|
||
│ ├── neovim.sh
|
||
│ └── nvchad.sh
|
||
├── devtools/
|
||
│ ├── docker.sh
|
||
│ ├── go.sh
|
||
│ ├── node.sh
|
||
│ └── python.sh
|
||
├── php/
|
||
│ └── dnmp.sh
|
||
├── system/
|
||
│ ├── check_windows_wsl.bat
|
||
│ └── check_wsl.sh
|
||
└── utils/
|
||
├── git.sh
|
||
└── tools.sh
|
||
```
|
||
|
||
## 使用方法
|
||
|
||
### 系统要求
|
||
- Windows 11
|
||
- WSL2
|
||
- Debian 12
|
||
|
||
### 安装步骤
|
||
|
||
1. 克隆项目
|
||
```bash
|
||
git clone https://github.com/yourusername/wsl2-debian-init.git
|
||
cd wsl2-debian-init
|
||
```
|
||
|
||
2. 检查 Windows 上的 WSL2 环境(在 CMD 中运行)
|
||
```cmd
|
||
scripts\system\check_windows_wsl.bat
|
||
```
|
||
|
||
3. 检查 WSL2 内部环境(在 WSL 终端中运行)
|
||
```bash
|
||
./scripts/system/check_wsl.sh
|
||
```
|
||
|
||
4. 运行初始化脚本
|
||
```bash
|
||
./init.sh
|
||
```
|
||
|
||
5. 按需运行各个模块的安装脚本
|
||
```bash
|
||
# 安装 Shell 环境
|
||
./scripts/shell/zsh.sh
|
||
./scripts/shell/plugins.sh
|
||
|
||
# 安装编辑器环境
|
||
./scripts/editor/neovim.sh
|
||
./scripts/editor/nvchad.sh
|
||
|
||
# 安装开发工具链
|
||
./scripts/devtools/docker.sh
|
||
./scripts/devtools/go.sh
|
||
./scripts/devtools/node.sh
|
||
./scripts/devtools/python.sh
|
||
|
||
# 安装 PHP 开发环境
|
||
./scripts/php/dnmp.sh
|
||
|
||
# 安装系统工具
|
||
./scripts/utils/git.sh
|
||
./scripts/utils/tools.sh
|
||
```
|
||
|
||
## 脚本说明
|
||
|
||
### 系统环境脚本
|
||
- `scripts/system/check_windows_wsl.bat`: 在 Windows 端检查 WSL2 环境,包括:
|
||
- Windows 版本检查
|
||
- WSL 安装检查
|
||
- WSL2 状态检查
|
||
- 虚拟化检查
|
||
- Debian 安装检查
|
||
- Windows 功能检查
|
||
|
||
- `scripts/system/check_wsl.sh`: 在 WSL 端检查环境,包括:
|
||
- Windows 版本检查
|
||
- WSL 版本检查
|
||
- 系统要求检查
|
||
- Debian 版本检查
|
||
- 系统更新检查
|
||
- 必要组件检查
|
||
- 网络连接检查
|
||
- WSL 配置检查
|
||
|
||
### Shell 环境脚本
|
||
- `scripts/shell/zsh.sh`: 安装和配置 Zsh
|
||
- `scripts/shell/plugins.sh`: 安装常用 Zsh 插件
|
||
|
||
### 编辑器环境脚本
|
||
- `scripts/editor/neovim.sh`: 安装和配置 Neovim
|
||
- `scripts/editor/nvchad.sh`: 配置 NvChad
|
||
|
||
### 开发工具链脚本
|
||
- `scripts/devtools/docker.sh`: 安装 Docker 和 Docker Compose
|
||
- `scripts/devtools/go.sh`: 安装 Go 语言环境
|
||
- `scripts/devtools/node.sh`: 安装 Node.js 环境
|
||
- `scripts/devtools/python.sh`: 安装 Python 环境
|
||
|
||
### PHP 开发环境脚本
|
||
- `scripts/php/dnmp.sh`: 安装和配置 PHP 开发环境(使用 DNMP)
|
||
|
||
### 系统工具脚本
|
||
- `scripts/utils/git.sh`: 配置 Git 和安装 Git 工具
|
||
- `scripts/utils/tools.sh`: 安装各种系统工具和开发效率工具
|
||
|
||
## 常见问题
|
||
|
||
1. 如果遇到权限问题,请使用 `sudo` 运行脚本
|
||
2. 如果遇到网络问题,请检查网络连接或使用代理
|
||
3. 如果遇到依赖问题,请先运行 `sudo apt-get update && sudo apt-get upgrade`
|
||
|
||
## 贡献指南
|
||
|
||
欢迎提交 Issue 和 Pull Request 来帮助改进这个项目。
|
||
|
||
## 许可证
|
||
|
||
MIT License |