不止于安装:Ubuntu 22.04.3 装完后必做的10件事(从换源到开发环境)
刚完成Ubuntu 22.04.3安装的兴奋感消退后,面对一个"裸"系统,许多用户会陷入"接下来该做什么"的迷茫。这篇文章将带你跳过摸索阶段,直接进入高效使用状态。从基础配置到开发环境搭建,我们整理了10项关键任务,帮你把新系统从"能用"变成"好用"。
1. 更换国内软件源:解决下载龟速问题
刚安装的Ubuntu默认使用国外软件源,更新和安装软件时速度可能慢得令人抓狂。更换为国内镜像源是最优先的优化项。
推荐源列表:
| 镜像源 | 地址 | 运营商 |
|---|---|---|
| 阿里云 | mirrors.aliyun.com/ubuntu | 阿里 |
| 腾讯云 | mirrors.tencent.com/ubuntu | 腾讯 |
| 华为云 | mirrors.huaweicloud.com/ubuntu | 华为 |
| 清华源 | mirrors.tuna.tsinghua.edu.cn/ubuntu | 教育网 |
更换步骤:
# 备份原有源列表 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 使用sed命令替换源(以阿里云为例) sudo sed -i 's|http://.*archive.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list sudo sed -i 's|http://.*security.ubuntu.com|https://mirrors.aliyun.com|g' /etc/apt/sources.list # 更新软件包索引 sudo apt update && sudo apt upgrade -y注意:不同Ubuntu版本代号不同(22.04是Jammy),确保镜像源支持你的版本。如果手动编辑sources.list文件,记得替换所有出现的版本代号。
2. 安装基础工具包:开发者的瑞士军刀
系统自带的工具有限,这些基础工具能大幅提升工作效率:
必备命令行工具:
vim:比nano更强大的文本编辑器git:版本控制工具curl/wget:网络请求工具htop:增强型系统监控tree:目录树状展示
开发辅助工具:
build-essential:包含gcc/g++等编译工具链cmake:跨平台构建工具python3-pip:Python包管理
安装命令:
sudo apt install -y vim git curl wget htop tree build-essential cmake python3-pip3. 中文环境完美配置
对于中文用户,这些配置能让系统更友好:
1. 中文输入法安装(推荐Fcitx5框架):
sudo apt install -y fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk3 fcitx5-frontend-qt5安装后需要:
- 在系统设置→区域和语言→输入法中添加Fcitx5
- 重启后配置中文输入法
2. 字体优化:
# 安装常用中文字体 sudo apt install -y fonts-noto-cjk fonts-wqy-microhei fonts-wqy-zenhei3. 时区设置:
sudo timedatectl set-timezone Asia/Shanghai4. 网络与共享配置
基础网络工具安装:
sudo apt install -y net-tools openssh-serverSSH服务启用:
sudo systemctl enable --now sshSamba文件共享配置(如果需要与Windows共享文件):
sudo apt install -y samba编辑配置文件/etc/samba/smb.conf,在末尾添加:
[share] path = /path/to/your/folder browseable = yes read only = no guest ok = yes重启服务:
sudo systemctl restart smbd5. Python开发环境搭建
1. 安装Python虚拟环境工具:
sudo apt install -y python3-venv python3-pip2. 创建虚拟环境:
python3 -m venv ~/venv/myproject source ~/venv/myproject/bin/activate3. 常用开发工具安装:
pip install ipython pylint autopep8 jupyterlab4. 配置VS Code Python扩展:
- 安装VS Code(见第7节)
- 安装Python扩展
- 设置Python解释器路径为虚拟环境中的python
6. C++开发环境配置
1. 安装完整工具链:
sudo apt install -y g++ gdb make cmake clang clang-tools2. 验证安装:
// 创建test.cpp #include <iostream> using namespace std; int main() { cout << "Hello C++ on Ubuntu!" << endl; return 0; }编译运行:
g++ test.cpp -o test && ./test3. 推荐IDE:
- VS Code + C/C++扩展
- CLion(商业软件)
- Qt Creator(适合GUI开发)
7. Java开发环境搭建
1. 安装OpenJDK:
sudo apt install -y openjdk-17-jdk2. 环境变量配置:
echo 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64' >> ~/.bashrc echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc source ~/.bashrc3. 验证安装:
java -version javac -version4. IDE选择:
- IntelliJ IDEA(社区版免费)
- Eclipse
- VS Code + Java扩展包
8. 必备应用安装
1. 现代浏览器(替代Firefox):
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install -y ./google-chrome-stable_current_amd64.deb2. VS Code安装:
sudo apt install -y wget gpg wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' sudo apt update sudo apt install -y code3. 其他实用工具:
# 压缩解压工具 sudo apt install -y unzip p7zip-full # 截图工具 sudo apt install -y flameshot # 录屏工具 sudo apt install -y simplescreenrecorder9. 系统美化与个性化
1. GNOME扩展安装:
sudo apt install -y gnome-shell-extensions chrome-gnome-shell访问 https://extensions.gnome.org/ 安装扩展,推荐:
- Dash to Panel
- Arc Menu
- User Themes
2. 主题安装:
sudo apt install -y gnome-tweaks然后下载喜欢的GTK主题,解压到~/.themes目录
3. 图标主题更换:
sudo apt install -y papirus-icon-theme在GNOME Tweaks中选择新图标主题
10. 安全与备份基础
1. 防火墙配置:
sudo apt install -y ufw sudo ufw enable sudo ufw allow ssh2. 定期更新:
# 设置自动安全更新 sudo apt install -y unattended-upgrades sudo dpkg-reconfigure -plow unattended-upgrades3. Timeshift系统备份:
sudo apt install -y timeshift首次运行建议选择RSYNC模式,备份到外部存储设备