mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-22 23:00:57 +08:00
commit
403c9a8ec4
@ -1,75 +0,0 @@
|
|||||||
(translating by runningwater)
|
|
||||||
Linux FAQs with Answers--How to install 7zip on Linux
|
|
||||||
================================================================================
|
|
||||||
> **Question**: I need to extract files from an ISO image, and for that I want to use 7zip program. How can I install 7zip on [insert your Linux distro]?
|
|
||||||
|
|
||||||
7zip is an open-source archive program originally developed for Windows, which can pack or unpack a variety of archive formats including its native format 7z as well as XZ, GZIP, TAR, ZIP and BZIP2. 7zip is also popularly used to extract RAR, DEB, RPM and ISO files. Besides simple archiving, 7zip can support AES-256 encryption as well as self-extracting and multi-volume archiving. For POSIX systems (Linux, Unix, BSD), the original 7zip program has been ported as p7zip (short for "POSIX 7zip").
|
|
||||||
|
|
||||||
Here is how to install 7zip (or p7zip) on Linux.
|
|
||||||
|
|
||||||
### Install 7zip on Debian, Ubuntu or Linux Mint ###
|
|
||||||
|
|
||||||
Debian-based distributions come with three packages related to 7zip.
|
|
||||||
|
|
||||||
- **p7zip**: contains 7zr (a minimal 7zip archive tool) which can handle its native 7z format only.
|
|
||||||
- **p7zip-full**: contains 7z which can support 7z, LZMA2, XZ, ZIP, CAB, GZIP, BZIP2, ARJ, TAR, CPIO, RPM, ISO and DEB.
|
|
||||||
- **p7zip-rar**: contains a plugin for extracting RAR files.
|
|
||||||
|
|
||||||
It is recommended to install p7zip-full package (not p7zip) since this is the most complete 7zip package which supports many archive formats. In addition, if you want to extract RAR files, you also need to install p7zip-rar package as well. The reason for having a separate plugin package is because RAR is a proprietary format.
|
|
||||||
|
|
||||||
$ sudo apt-get install p7zip-full p7zip-rar
|
|
||||||
|
|
||||||
### Install 7zip on Fedora or CentOS/RHEL ###
|
|
||||||
|
|
||||||
Red Hat-based distributions offer two packages related to 7zip.
|
|
||||||
|
|
||||||
- **p7zip**: contains 7za command which can support 7z, ZIP, GZIP, CAB, ARJ, BZIP2, TAR, CPIO, RPM and DEB.
|
|
||||||
- **p7zip-plugins**: contains 7z command and additional plugins to extend 7za command (e.g., ISO extraction).
|
|
||||||
|
|
||||||
On CentOS/RHEL, you need to enable [EPEL repository][1] before running yum command below. On Fedora, there is not need to set up additional repository.
|
|
||||||
|
|
||||||
$ sudo yum install p7zip p7zip-plugins
|
|
||||||
|
|
||||||
Note that unlike Debian based distributions, Red Hat based distributions do not offer a RAR plugin. Therefore you will not be able to extract RAR files using 7z command.
|
|
||||||
|
|
||||||
### Create or Extract an Archive with 7z ###
|
|
||||||
|
|
||||||
Once you installed 7zip, you can use 7z command to pack or unpack various types of archives. The 7z command uses other plugins to handle the archives.
|
|
||||||
|
|
||||||
![](https://farm8.staticflickr.com/7583/15874000610_878a85b06a_b.jpg)
|
|
||||||
|
|
||||||
To create an archive, use "a" option. Supported archive types for creation are 7z, XZ, GZIP, TAR, ZIP and BZIP2. If the specified archive file already exists, it will "add" the files to the existing archive, instead of overwriting it.
|
|
||||||
|
|
||||||
$ 7z a <archive-filename> <list-of-files>
|
|
||||||
|
|
||||||
To extract an archive, use "e" option. It will extract the archive in the current directory. Supported archive types for extraction are a lot more than those for creation. The list includes 7z, XZ, GZIP, TAR, ZIP, BZIP2, LZMA2, CAB, ARJ, CPIO, RPM, ISO and DEB.
|
|
||||||
|
|
||||||
$ 7z e <archive-filename>
|
|
||||||
|
|
||||||
Another way to unpack an archive is to use "x" option. Unlike "e" option, it will extract the content with full paths.
|
|
||||||
|
|
||||||
$ 7z x <archive-filename>
|
|
||||||
|
|
||||||
To see a list of files in an archive, use "l" option.
|
|
||||||
|
|
||||||
$ 7z l <archive-filename>
|
|
||||||
|
|
||||||
You can update or remove file(s) in an archive with "u" and "d" options, respectively.
|
|
||||||
|
|
||||||
$ 7z u <archive-filename> <list-of-files-to-update>
|
|
||||||
$ 7z d <archive-filename> <list-of-files-to-delete>
|
|
||||||
|
|
||||||
To test the integrity of an archive:
|
|
||||||
|
|
||||||
$ 7z t <archive-filename>
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via:http://ask.xmodulo.com/install-7zip-linux.html
|
|
||||||
|
|
||||||
译者:[runningwater](https://github.com/runningwater)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[1]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
|
|
@ -0,0 +1,74 @@
|
|||||||
|
Linux 有问必答--Linux 中如何安装 7zip
|
||||||
|
================================================================================
|
||||||
|
> **问题**: 我需要要从 ISO 映像中获取某些文件,为此我想要使用 7zip 程序。那么我应该如何安装 7zip 软件呢,[在 Linux 发布版本上完全安装]?
|
||||||
|
|
||||||
|
7zip 是一款开源的归档应用程序,开始是为 Windows 系统而开发的。它能对多种格式的档案文件进行打包或解包处理,除了支持原生的 7z 格式的文档外,还支持包括 XZ、GZIP、TAR、ZIP 和 BZIP2 等这些格式。 一般地,7zip 也常用来解压 RAR、DEB、RPM 和 ISO 等格式的文件。除了简单的归档功能,7zip 还具有支持 AES-256 算法加密以及自解压和建立多卷存档功能。在以 POSIX 协议为标准的系统上(Linux、Unix、BSD),原生的 7zip 程序被移植过来并被命名为 p7zip(“POSIX 7zip” 的简称)。
|
||||||
|
|
||||||
|
下面介绍如何在 Linux 中安装 7zip (或 p7zip)。
|
||||||
|
|
||||||
|
### 在 Debian、Ubuntu 或 Linux Mint 系统中安装 7zip ###
|
||||||
|
|
||||||
|
在基于的 Debian 的发布系统中存在有三种 7zip 的软件包。
|
||||||
|
|
||||||
|
- **p7zip**: 包含 7zr(最小的 7zip 归档工具),仅仅只能处理原生的 7z 格式。
|
||||||
|
- **p7zip-full**: 包含 7z ,支持 7z、LZMA2、XZ、ZIP、CAB、GZIP、BZIP2、ARJ、TAR、CPIO、RPM、ISO 和 DEB 格式。
|
||||||
|
- **p7zip-rar**: 包含一个能解压 RAR 文件的插件。
|
||||||
|
|
||||||
|
建议安装 p7zip-full 包(不是 p7zip),因为这是最完全的 7zip 程序包,它支持很多归档格式。此外,如果您想处理 RAR 文件话,还需要安装 p7zip-rar 包,做成一个独立的插件包的原因是因为 RAR 是一种专有格式。
|
||||||
|
|
||||||
|
$ sudo apt-get install p7zip-full p7zip-rar
|
||||||
|
|
||||||
|
### 在 Fedora 或 CentOS/RHEL 系统中安装 7zip ###
|
||||||
|
|
||||||
|
基于红帽的发布系统上提供了两个 7zip 的软件包。
|
||||||
|
|
||||||
|
- **p7zip**: 包含 7za 命令,支持 7z、ZIP、GZIP、CAB、ARJ、BZIP2、TAR、CPIO、RPM 和 DEB 格式。
|
||||||
|
- **p7zip-plugins**: 包含 7z 命令,额外的插件,它扩展了 7za 命令(例如 支持 ISO 格式的抽取)。
|
||||||
|
|
||||||
|
在 CentOS/RHEL 系统中,在运行下面命令前您需要确保 [EPEL 资源库][1] 可用,但在 Fedora 系统中就不需要额外的资源库了。
|
||||||
|
|
||||||
|
$ sudo yum install p7zip p7zip-plugins
|
||||||
|
|
||||||
|
注意,跟基于 Debian 的发布系统不同的是,基于红帽的发布系统没有提供 RAR 插件,所以您不能使用 7z 命令来抽取解压 RAR 文件。
|
||||||
|
|
||||||
|
### 使用 7z 创建或提取归档文件 ###
|
||||||
|
|
||||||
|
一旦安装好 7zip 软件后,就可以使用 7z 命令来打包解包各式各样的归档文件了。7z 命令会使用不同的插件来辅助处理对应格式的归档文件。
|
||||||
|
|
||||||
|
![](https://farm8.staticflickr.com/7583/15874000610_878a85b06a_b.jpg)
|
||||||
|
|
||||||
|
使用 “a” 选项就可以创建一个归档文件,它可以创建 7z、XZ、GZIP、TAR、 ZIP 和 BZIP2 这几种格式的文件。如果指定的归档文件已经存在的话,它会把文件“添加”到存在的归档中,而不是覆盖原有归档文件。
|
||||||
|
|
||||||
|
$ 7z a <archive-filename> <list-of-files>
|
||||||
|
|
||||||
|
使用 “e” 选项可以抽取出一个归档文件,抽取出的文件会放在当前目录。抽取支持的格式比创建时支持的格式要多的多,包括 7z、XZ、GZIP、TAR、ZIP、BZIP2、LZMA2、CAB、ARJ、CPIO、RPM、ISO 和 DEB 这些格式。
|
||||||
|
|
||||||
|
$ 7z e <archive-filename>
|
||||||
|
|
||||||
|
解包的另外一种方式是使用 “x” 选项。和 “e” 选项不同的是,它使用的是全路径来抽取归档的内容。
|
||||||
|
|
||||||
|
$ 7z x <archive-filename>
|
||||||
|
|
||||||
|
要查看归档的文件列表,使用 “l” 选项。
|
||||||
|
|
||||||
|
$ 7z l <archive-filename>
|
||||||
|
|
||||||
|
要更新或删除归档文件,分别使用 “u” 和 “d” 选项。
|
||||||
|
|
||||||
|
$ 7z u <archive-filename> <list-of-files-to-update>
|
||||||
|
$ 7z d <archive-filename> <list-of-files-to-delete>
|
||||||
|
|
||||||
|
要测试归档的完整性,使用:
|
||||||
|
|
||||||
|
$ 7z t <archive-filename>
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via:http://ask.xmodulo.com/install-7zip-linux.html
|
||||||
|
|
||||||
|
译者:[runningwater](https://github.com/runningwater)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[1]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
|
Loading…
Reference in New Issue
Block a user