最小化安装 ubuntu

最小化安装 ubuntu

从 ubuntu-server 构建 ubuntu-unity

下面是 20.04 为例

  • 替换 apt 源

    sudo sed -i '/[#]/ s|http://us.archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|' /etc/apt/sources.list

  • 卸载系统自带的 snapd

    列出所有已安装的 snap

    snap list

    按照列表逐一卸载(必须先卸载应用,最后卸载 core)

    常见的包卸载顺序参考:

    sudo snap remove --purge lxd
    sudo snap remove --purge core20
    sudo snap remove --purge snapd

    卸载服务

    sudo systemctl stop snapd
    sudo apt purge snapd -y

    文件夹

    rm -rf ~/snap
    sudo rm -rf /snap
    sudo rm -rf /var/snap
    sudo rm -rf /var/lib/snapd

  • 安装 ubuntu-unity-desktop

    sudo apt-get install ubuntu-unity-desktop --no-install-recommends --no-upgrade

  • 安装 unity-tweak-tool (可以对系统的icon, theme, font配置)

    sudo apt-get install unity-tweak-tool --no-install-recommends --no-upgrade
    sudo apt-get install unity-gtk3-module hud
    unity-lens-files unity-lens-applications
    unity-schemas indicator-appmenu indicator-session
    --no-install-recommends --no-upgrade

上述的 hud, indicator-session, unity-lens-files, unity-lens-applications 分别是解决下面的问题:

复制代码
hud (com.canonical.indicator.appmenu.hud)
indicator-session (com.canonical.indicator.session)
unity-lens-files (com.canonical.Unity.FilesLens)
unity-lens-applications (com.canonical.Unity.ApplicationLens)
  • 安装 中文包 (解决中文乱码问题)

    安装依赖

    sudo apt-get install check-language-support -l zh-hans fcitx-config-gtk
    --no-install-recommends --no-upgrade

    Language Support 当中修改输入法 fcitx, 应用中文, 地区选择中文.

这里已经安装了输入法框架 fcitx, 与后面 sogoupinyin 进行对应.

  • 系统语言配置(可选).

在文件 /var/lib/locales/supported.d 目录下的文件增加 local 文件:

复制代码
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

然后使用 locale-gendpkg-reconfigure locales 生成系统语言.

  • 增加安装 courier 10 patch 字体.

将下载好的字体放置到 /usr/local/share/fonts 目录新建文件夹下, 然后执行命令:

复制代码
# 字体安装
sudo fc-cache -fv

# tweak 当中进行字体设置
  • 安装 sougoupinyin

    卸载 fcitx-ui-qimpanel

    sudo apt purge fcitx-ui-qimpanel

    安装 sogoupinyin

    sudo dpkg -i sogoupinyin.deb

    依赖解决

    sudo apt-get install -f

sogoupinyin 安装好之后, 在 fcitx configuration 当中配置.

启动优化配置

  • tweak 优化配置项

    1. General 当中硬件加速改为 'fast'

    2. General 当中 Window 动画 '关闭'

  • 启动项配置优化

    在 /etc/xdg/autostar 目录下列出对文件移动到 /etc/xdg/autostart_backup

    tracker-extract.desktop # 持续扫描文件并建立索引
    tracker-miner-fs.desktop # Tracker 索引服务
    update-notifier.desktop # 软件包更新通知

    禁用 GNOME Online Accounts

    sudo chmod -x /usr/libexec/goa-daemon

    禁用 Evolution 相关服务

    停止并禁用 Evolution 相关后台服务

    systemctl --user mask evolution-addressbook-factory.service
    evolution-calendar-factory.service
    evolution-source-registry.service
    evolution-user-prompter.service
    evolution-alarm-notify.service

    禁用自动更新检查, 编辑文件

    sudo vim /etc/apt/apt.conf.d/20auto-upgrades

    将所有值改为 "0":

    APT::Periodic::Update-Package-Lists "0";
    APT::Periodic::Unattended-Upgrade "0";

    禁用通知

    sudo systemctl disable unattended-upgrades
    sudo chmod -x /usr/lib/update-notifier/update-notifier

  • grub 优化

    编辑 Grub 配置文件:

    sudo vim /etc/default/grub

    找到 GRUB_CMDLINE_LINUX_DEFAULT 这一行, 在引号内添加 mitigations=off

    eg GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mitigations=off"

    更新配置

    sudo update-grub

  • swap 优化

    调低 Swappiness: 默认值为 60, 意味着系统会较早地把内存数据置换到磁盘

    sudo sysctl -w vm.swappiness=10

  • 删除不必要对内核

    列出不使用对内核

    dpkg --list | grep linux-image

    删除内核

    sudo apt-get purge linux-image-X.X.X-X-generic

    sudo apt-get purge linux-headers-X.X.X-X
    sudo apt-get purge linux-headers-X.X.X-X-generic

    sudo apt-get purge linux-modules-X.X.X-X-generic
    sudo apt-get purge linux-modules-extra-X.X.X-X-generic

    更新内核

    sudo update-grub

  • 进一步优化内存

    查看内存占用前 10 的服务

    ps -e -o pid,ppid,cmd,%mem --sort=-%mem | head -n 11

    进行对相关不使用对内存优化

可选工具安装

  • 安装开发工具 git, ssh

    sudo apt-get install git
    sudo apt-get install openssh-server

  • 安装常用工具 google-stable, thunderbird

google-stable, thunderbird 需要到各自官方下载最新版本, 然后使用 dpkg 进行安装.

  • 安装系统工具 gedit(文本编辑), gnome-system-monitor(监控), deepin-screenshot(截屏), deepin-image-viewer(图片查看器),
    mpv 或 smplayer(视频播放器)

    sudo apt-get install gedit
    sudo apt-get install gnome-system-monitor
    sudo apt-get install deepin-screenshot
    sudo apt-get install deepin-image-viewer

    audo apt-get install mpv --no-install-recommends --no-upgrade
    audo apt-get install smplayer --no-install-recommends --no-upgrade

deepin-screenshot 安装好之后, 最好设置下快捷键.

  • 安装可选工具 wireshark(抓包工具), ffmpeg(视频处理工具)

    sudo apt-get install wireshark
    sudo apt-get install ffmpeg

  • 安装可选工具 SingleNote(桌面笔记, 随时备份工具)

deb 下载地址: https://github.com/Automattic/simplenote-electron/releases

桌面图标: https://github.com/Automattic/simplenote-electron/blob/develop/resources/images/icon_128x128.png

simplenote.desktop 文件:

复制代码
[Desktop Entry]
Comment=simplenote
Exec=/opt/local/simplenote/simplenote
Icon=/opt/local/simplenote/simplenote.png
Name=SimpleNote
StartupNotify=false
Terminal=false
Type=Application
Categories=Office;WordProcessor;Qt;
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
InitialPreference=3
  • 安装 wps-office (Office套件)

deb 下载地址: https://github.com/tiechui1994/jobs/releases/download/wps-office-2019-zh-CN/wps-office_11.1.0.8392_amd64.deb

中文语言安装: https://gist.github.com/tiechui1994/2912e4d5990a0ab26ddd8db75c42ae57

问题

  1. dbus-daemon[987]: [system] Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)

这个是 bluetooth(蓝牙) 服务无法启动, 可以禁用该服务.

复制代码
systemctl stop bluetooth.service
systemctl disable bluetooth.service
  1. Exiting GPU process due to errors during initialization

这个是在 virtualbox 虚拟机当中使用 google-chrome 浏览器, Google 浏览器默认是启用 GPU 的, 但是 virtualbox 某些版本是无法使用到宿主机的GPU, 因此需要在禁用掉 GPU, 使用参数 --disable-gpu

相关推荐
qq_452396234 小时前
第十五篇:《UI自动化中的稳定性优化:解决flaky tests的七种武器》
运维·ui·自动化
j_xxx404_4 小时前
Linux:静态链接与动态链接深度解析
linux·运维·服务器·c++·人工智能
_只道当时是寻常5 小时前
【Codex】Ubuntu 安装 Codex CLI 并解决 Clash 代理与账号认证问题
linux·ubuntu·chatgpt
Elastic 中国社区官方博客5 小时前
Elastic-caveman : 在不损失 Elastic 最佳效果的情况下,将 AI 响应 tokens 减少64%
大数据·运维·数据库·人工智能·elasticsearch·搜索引擎·全文检索
brucelee1865 小时前
Claude Code 安装教程(Windows / Linux / macOS)
linux·windows·macos
jsons16 小时前
给每台虚拟机设置独立控制台密码
linux·运维·服务器
嵌入式×边缘AI:打怪升级日志6 小时前
全志T113 Tina-SDK 配套工具链开发应用(从Makefile到CMake再到Autotools)
linux
嵌入式×边缘AI:打怪升级日志6 小时前
全志T113嵌入式Linux开发环境搭建(VMware + Ubuntu 18.04)详细步骤
linux·ubuntu
云栖梦泽7 小时前
Linux内核与驱动:14.SPI子系统
linux·运维·服务器·c++
福大大架构师每日一题7 小时前
openclaw v2026.4.24 发布:Google Meet 深度集成、DeepSeek V4 上线、浏览器自动化与插件架构全面升级
运维·架构·自动化·openclaw