零基础逆袭!72小时从Linux小白到开发大神(附保姆级代码)
刚装好Linux就懵逼?刷到这篇就对了!跟着本喵3天解锁开发全流程(建议收藏防丢)
Day 1:极速装机+基础配置
步骤1:虚拟机秒装Ubuntu
# VMware安装后执行
sudo apt update && sudo apt install open-vm-tools-desktop -y # 增强工具:ml-citation{ref="7" data="citationList"}
# 分辨率异常修复
xrandr --output Virtual1 --mode 1920x1080 # 适配显示器:ml-citation{ref="2" data="citationList"}
步骤2:开发全家桶安装
# 基础三件套
sudo apt install build-essential git curl -y # C/C++编译环境:ml-citation{ref="1,4" data="citationList"}
# 编程语言环境
sudo apt install python3.10 nodejs npm golang -y # 多语言支持:ml-citation{ref="1,3" data="citationList"}
避坑指南:
选Ubuntu LTS版避免兼容问题7
安装后立即执行sudo apt upgrade升级内核2
Day 2:开发环境深度定制
步骤3:Docker环境部署
# 安装容器引擎
curl -fsSL https://get.docker.com | bash -s docker # 一键脚本:ml-citation{ref="3" data="citationList"}
# 配置镜像加速
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl restart docker # 重启生效:ml-citation{ref="8" data="citationList"}
步骤4:IDE环境搭建
# VSCode安装
sudo snap install --classic code # 官方渠道:ml-citation{ref="3" data="citationList"}
# 必备插件
code --install-extension ms-vscode.cpptools # C++开发套件:ml-citation{ref="1" data="citationList"}
数据库配置示例:
sudo apt install mysql-server -y
sudo mysql_secure_installation # 安全初始化:ml-citation{ref="2" data="citationList"}
Day 3:高阶开发技能解锁
步骤5:Git版本控制实战
git config --global user.name "DevCat"
git config --global user.email "dev@meow.com" # 全局配置:ml-citation{ref="6" data="citationList"}
# 免密推送设置
ssh-keygen -t ed25519 -C "开发密钥" # 生成密钥对:ml-citation{ref="5" data="citationList"}
步骤6:自动化部署脚本
创建deploy.sh:
#!/bin/bash
# 自动编译部署
docker build -t myapp . && \
docker stop myapp_container || true && \
docker rm myapp_container || true && \
docker run -d --name myapp_container -p 8080:80 myapp # 滚动更新:ml-citation{ref="3,8" data="citationList"}
开发者必备骚操作:
1 终端分屏神器:
sudo apt install terminator # 支持多窗格:ml-citation{ref="2" data="citationList"}
Ctrl+Shift+E # 垂直分屏快捷键
2 进程监控仪表盘:
htop # 比top更直观:ml-citation{ref="3" data="citationList"}
F2进入设置界面自定义显示
3 系统资源可视化:
sudo apt install gnome-system-monitor # 图形化监控:ml-citation{ref="7" data="citationList"}
三大致命雷区预警:
慎用rm -rf /* → 替换为trash-cli
避免直接修改/etc → 先备份原文件
生产环境勿用测试证书 → 用Let's Encrypt
毕业考核任务:
用Vim编写HelloWorld程序
通过Git提交到Github仓库
使用Docker部署到本地服务器