关于将tar、gcc等Ubuntu软件包打包为Zip文件并下载的技术咨询
Hey there! I get that you're trying to grab packages like tar and gcc as zip files—let me break down how to do this, since Ubuntu's official repos don't offer them directly in zip format.
Method 1: Download individual packages & zip them up
If you only need the main packages (not all their dependencies), follow these steps:
- First, use the
apt downloadcommand to fetch the.debpackage files (this is Ubuntu's native package format) directly to your current directory:
Note: You might need to run this withapt download gcc apt download tarsudoif you hit permission issues. - Once the
.debfiles are downloaded, use thezipcommand to bundle them into a single zip archive:
This will create a file namedzip ubuntu_packages.zip gcc*.deb tar*.debubuntu_packages.zipcontaining both packages.
Method 2: Download packages + all dependencies (for offline use)
If you need the full set of files required to install these packages offline (including all dependent libraries), here's what to do:
- Use
apt-getwith the--download-onlyflag to download all required.debfiles without installing them:sudo apt-get install --download-only gcc tar - All the downloaded
.debfiles will be stored in/var/cache/apt/archives/. Navigate to that directory and zip everything up:
The zip file will be saved to your home directory (cd /var/cache/apt/archives/ zip ~/full_ubuntu_packages.zip *.deb~/) for easy access.
For non-Ubuntu systems
If you're not on Ubuntu but still want to grab these packages, you can manually locate the .deb files in Ubuntu's package repository structure. Once you've downloaded the relevant .deb files, just use your system's zip tool to bundle them into a zip archive like we did above.
备注:内容来源于stack exchange,提问作者Hareshkumar

