1. 系统准备与更新
bash
# 更新系统包列表 sudo apt update sudo apt upgrade -y # 安装基础工具 sudo apt install -y curl wget git vim build-essential
2. 终端工具配置
Zsh + Oh My Zsh
bash
# 安装 Zsh
sudo apt install -y zsh
# 设置为默认 shell
chsh -s $(which zsh)
# 安装 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 推荐插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. 编程语言环境
Python 开发环境
bash
# 安装 Python 和相关工具 sudo apt install -y python3 python3-pip python3-venv # 安装 pyenv(多版本 Python 管理) curl https://pyenv.run | bash # 添加到 ~/.zshrc echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Node.js 开发环境
bash
# 使用 nvm 安装 Node.js curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash # 重新加载配置后安装 Node.js nvm install --lts nvm use --lts
Java 开发环境
bash
# 安装 OpenJDK sudo apt install -y openjdk-17-jdk # 安装 Maven sudo apt install -y maven
C/C++ 开发环境
bash
# 安装编译工具链 sudo apt install -y gcc g++ gdb cmake
4. 数据库
PostgreSQL
bash
sudo apt install -y postgresql postgresql-contrib sudo systemctl start postgresql sudo systemctl enable postgresql
MySQL
bash
sudo apt install -y mysql-server sudo mysql_secure_installation
Redis
bash
sudo apt install -y redis-server sudo systemctl start redis sudo systemctl enable redis
5. 开发工具
VS Code
bash
# 通过 snap 安装 sudo snap install code --classic # 或通过官方仓库 wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list sudo apt update sudo apt install code
Docker
bash
# 安装 Docker sudo apt install -y docker.io sudo systemctl start docker sudo systemctl enable docker sudo usermod -aG docker $USER # 安装 Docker Compose sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
Git 配置
bash
git config --global user.name "Your Name" git config --global user.email "your.email@example.com" git config --global core.editor "code --wait"
6. 桌面应用增强
常用工具
bash
# 系统监控 sudo apt install -y htop neofetch # 文件比较工具 sudo apt install -y meld # API 测试工具 sudo apt install -y postman # 截图工具 sudo apt install -y flameshot
字体安装(编程字体)
bash
# 安装 JetBrains Mono 字体 wget -O /tmp/jetbrains-mono.zip https://download.jetbrains.com/fonts/JetBrainsMono-2.242.zip unzip /tmp/jetbrains-mono.zip -d /tmp/jetbrains-mono sudo cp /tmp/jetbrains-mono/fonts/ttf/*.ttf /usr/share/fonts/truetype/ fc-cache -f -v
7. 常用软件推荐
bash
# 浏览器 sudo apt install -y chromium-browser # 通讯工具 sudo snap install slack --classic sudo snap install discord # 设计工具 sudo snap install figma-linux # 笔记工具 sudo snap install obsidian --classic
8. 性能优化配置
调整 swappiness
bash
echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf sudo sysctl -p
禁用不必要的服务
bash
# 查看启动服务 systemctl list-unit-files --type=service --state=enabled # 根据需要禁用服务,例如蓝牙(如果不用) # sudo systemctl disable bluetooth.service
9. 开发环境备份
创建安装脚本备份
bash
# 将上述所有命令保存到 setup.sh # 添加执行权限:chmod +x setup.sh
10. 推荐配置
VS Code 扩展推荐
-
通用:GitLens、Prettier、ESLint
-
Python:Python、Pylance、Jupyter
-
Web:Live Server、Auto Rename Tag
-
数据库:SQLite、PostgreSQL
-
Docker:Docker、Remote - Containers
终端美化
bash
# 安装 starship 提示符 curl -sS https://starship.rs/install.sh | sh # 添加到 ~/.zshrc echo 'eval "$(starship init zsh)"' >> ~/.zshrc
快速检查清单
bash
# 检查各组件安装情况 python3 --version node --version java --version docker --version code --version git --version
注意事项
-
权限管理:谨慎使用
sudo,开发时尽量在用户目录操作 -
定期更新:每周运行
sudo apt update && sudo apt upgrade -
备份配置:将 dotfiles(如 .zshrc、.gitconfig)备份到 GitHub
-
磁盘空间:注意
/tmp和 Docker 镜像的清理 -
网络配置:如果使用代理,配置相应的环境变量
2827

被折叠的 条评论
为什么被折叠?



