Ubuntu Studio 22.04 LTS 发布及离线环境下Ubuntu 22.04 LTS工作站更新补丁方案咨询
Hey there! Let's tackle your air-gapped Ubuntu 22.04 LTS patching challenge—this is a super common scenario, so I’ve got a few reliable approaches to share with you, including the apt-offline method you asked about.
First: Yes, apt-offline is absolutely recommended
apt-offline is purpose-built for exactly this kind of offline update scenario, and it’s a lightweight, flexible tool that works great for small fleets like your three workstations. Here’s a step-by-step breakdown of how to use it:
- On a network-connected Ubuntu 22.04 machine (make sure it’s the same LTS version to avoid dependency mismatches), install the tool first:
sudo apt update && sudo apt install apt-offline - On your offline workstation, generate a request file that lists all needed updates and dependencies:
sudo apt-offline set /home/your-user/update-request.txt - Copy this
update-request.txtfile to the connected machine (via USB drive, external storage, etc.). - On the connected machine, download all required packages and bundle them up:
sudo apt-offline get /path/to/update-request.txt --bundle /path/to/update-bundle.zip - Move the
update-bundle.zipback to your offline workstation, then install the updates:sudo apt-offline install /path/to/update-bundle.zip
Pro tip: Repeat the request -> download -> install process for each of your three workstations, or generate a single request from one machine (assuming they’re all running the same software stack) to reuse the bundle across all three.
Alternative: Set up a local offline repository mirror
If you want a more scalable solution (great if you might add more machines later), setting up a local mirror is a solid choice. Here’s how it works:
- On a connected machine, use
apt-mirrorto download the Ubuntu 22.04 repository (you can limit it to only the components you need, likemain,universe, andupdatesto save space):sudo apt install apt-mirror # Edit /etc/apt/mirror.list to define which repos you want to mirror sudo apt-mirror - Copy the entire mirrored repository folder to one of your offline workstations (you’ll need plenty of storage—roughly 50-100GB for a full 22.04 mirror).
- Set up a simple web server on that offline machine (like Apache or Nginx) to serve the repository files over your local network.
- On your other two offline workstations, edit
/etc/apt/sources.listto replace all external repo URLs with your local web server’s address (e.g.,http://192.168.1.100/ubuntu/). - Now you can run standard update commands on all offline machines just like you would online:
sudo apt update && sudo apt upgrade
This method requires more upfront work and storage, but it’s way more efficient for multiple machines since you only download the updates once.
Extra tips to avoid headaches
- Always test updates on one workstation first before rolling out to all three—this catches any compatibility issues early.
- Use a tool like
timeshiftto take system snapshots before applying updates, so you can roll back if something goes wrong. - If you use third-party software (non-Ubuntu official repos), make sure to include those repos in your apt configuration before generating the apt-offline request or setting up your mirror.
备注:内容来源于stack exchange,提问作者Joren8

