Linux package installation, compression, decompression (detail)

Source: Internet
Author: User
Tags bz2 documentation rar rar extension uncompress
1, has compiled the packing good xxx.rpm
  
If your Linux system has a setup program, it is best to install it with the system's own installer. For example, SuSE YaST2 with installation procedures, in the KDE environment as long as the RPM, you can click on the Konqueror inside the "Install with YaST2", the advantage is that YaST2 will give you the details of the package, automatic check trust relationship, And you can easily uninstall the package in YaST2. SuSE's Red-carpet also provides installation features that are also good.
  
Another way is to use the RPM command, you need to open the terminal, switch to the xxx.rpm directory, and execute:
RPM-IVH xxx.rpm
  
You can also bring other parameters if you want. But inside the SuSE, the software package, which is installed with the RPM command, appears as "locked" in the YaST2 Control Panel, and I don't know what that means, but the package is available and can be unloaded in YaST2.
  
2, packaged the source code package xxx.src.rpm
  
To regenerate with a command:
Rpm-rebuild xxx.src.rpm
  
3. Installation program Xxx.bin
  
Commercial software has many in this way to pack and release, in fact, the equivalent of Windows under the Setup.exe, but you have to change the xxx.bin to executable state, you can use the right key--> properties to modify, you can also use the following command:
chmod +x Xxx.bin
  
In this way, you can double-click or execute the Xxx.bin under the terminal.
  
4, compression package xxx.tar.gz, xxx.bz2, xxx.z, etc.
  

For those who have just come in contact with Linux, it will certainly give Linux a lot of different file names to get dizzy. Let's just say, in the case of compressed files, we know that there are only two types of compressed files that are most common in Windows, one is zip and the other is. rar. But Linux is different, it has. GZ, tar.gz, tgz, bz2, and so on. Many compressed filenames, such as Z,. Tar, in addition to the. zip and. rar under Windows can also be used under Linux, but there are too few people using. zip and. rar in Linux. This article is to make a summary of these common compressed files, I hope you will not be dizzy next time you encounter these files.

Before you make a concrete summary of the various types of compressed files, first understand two concepts: packaging and compression. Packaging refers to a large pile of files or directories into a total file, compression is a large file through some compression algorithm into a small file. Why should we distinguish between these two concepts? In fact, many of the compressed programs in Linux can only be compressed for a single file, so that when you want to compress a large number of files, you have to use the other tools to make this large pile of files into a package, and then the original compression program compression.

The most common packaging program under Linux is tar, and the packages we use in the TAR program are often referred to as the TAR packets, and the TAR package file commands are usually ended with. Tar. After the tar package is generated, you can compress it with other programs, so let's start with the basic usage of the TAR command:

There are many options for the tar command (which can be viewed with man tar), but there are a few options that are commonly used, and here are some examples:

# TAR-CF All.tar *.jpg
This command is to make all. jpg files into a package named All.tar. -C indicates the creation of a new package,-f Specifies the file name of the package.

# TAR-RF All.tar *.gif
This command adds all the. gif files to the All.tar package. -R means to add a file.
# Tar-uf All.tar logo.gif
This command updates the logo.gif file in the original tar package All.tar, and-U is the meaning of the update file.

# TAR-TF All.tar
This command lists all the files in the All.tar package----------T is the list of files

# TAR-XF All.tar
This command is to solve all the files in the All.tar package------X is the meaning of the undo

The above is the most basic use of tar. In order to facilitate the packaging and unpacking of the user can compress or extract files, tar provides a special function. This is where tar can invoke other compression programs while packing or unpack, such as calling Gzip, bzip2, and so on.

1) Tar call gzip

Gzip is a compression program developed by the GNU organization, the file at the end of GZ is the result of gzip compression. The decompression program relative to Gzip is gunzip. Use the-Z parameter in tar to invoke gzip. Here are a few examples to illustrate:

# TAR-CZF all.tar.gz *.jpg
This command is to make all. jpg files into a tar package and use gzip compression to generate a gzip-compressed package named all.tar.gz

# TAR-XZF All.tar.gz
This command is to untie the packets generated above.

2) Tar call bzip2

BZIP2 is a more compressed program,. bz2 end of the file is the result of bzip2 compression. The bzip2 relative to the decompression program is BUNZIP2. Use-j this parameter in tar to invoke gzip. Here are a few examples to illustrate:

# TAR-CJF all.tar.bz2 *.jpg
The command is to make all. jpg files into a tar package, and use bzip2 compression to generate a BZIP2 compressed package named all.tar.bz2

# TAR-XJF ALL.TAR.BZ2
This command is to untie the packets generated above.
3) Tar call compress

Compress is also a compression program, but it seems that people who use compress are not as good as gzip and bzip2. The file at the end of Z is the result of compress compression. The compress relative to the decompression program is uncompress. Use the-Z parameter in tar to invoke gzip. Here are a few examples to illustrate:

# TAR-CZF All.tar.z *.jpg
The command is to make all. jpg files into a tar package, and use compress compression to generate a uncompress compressed package named All.tar.z

# TAR-XZF All.tar.z
This command is to unlock the resulting package.

With the above knowledge, you should be able to unlock a variety of compressed files, the following for the TAR series of compressed files to make a summary:

1 for. Tar End of File

TAR-XF All.tar

2 for. GZ End of File

Gzip-d all.gz
Gunzip all.gz

3. Documents ending with. tgz or. tar.gz

Tar-xzf all.tar.gz
Tar-xzf all.tgz

4 for. bz2 End of File

Bzip2-d all.bz2
BUNZIP2 all.bz2

5) For tar.bz2 end of file

TAR-XJF all.tar.bz2

6) for. File at the end of Z

Uncompress all. Z

7 for. Tar.z End of File

Tar-xzf All.tar.z

In addition to the common compressed files under Windows. zip and. Rar,linux also have a corresponding way to extract them:

1) for. zip

Linux provides a zip and unzip program, ZIP is a compression program, unzip is the decompression program. They have a lot of parameter options, here is a simple introduction, still give examples of its use:

# Zip All.zip *.jpg
This command compresses all. jpg files into a zip package
# Unzip All.zip
This command is to extract all the files in the All.zip

2) for. rar

To process A. rar file under Linux, you need to install RAR for Linux, which can be downloaded from the Web, but remember that RAR for Linux
It is not free; you can download rar for Linux 3.2.0 from http://www.rarsoft.com/download.htm and then install:

# TAR-XZPVF Rarlinux-3.2.0.tar.gz
# CD RAR
# make

This is installed, installed after the RAR and unrar these two programs, RAR is a compression program, Unrar is the decompression program. They have a lot of parameter options, here is a simple introduction, still give examples of its use:

# rar a All *.jpg
This command compresses all. jpg files into a RAR package named All.rar, which automatically attaches the. rar extension to the package name.

# Unrar E All.rar
This command is to extract all the files in the All.rar

In this context, we have introduced Linux under the TAR, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar and other programs, you should have been able to use them for. Tar,. GZ,. tar.gz, tgz, bz2, tar.bz2,. Z,. Tar. Z,. zip,. rar, these 10 compressed files for decompression, you should not need to download a software and do not know how to untie under Linux and worry. And the above method is also basically effective for UNIX.

This article describes the programs in the Linux compression program tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar, and how to use them for. Tar,. GZ,. tar.gz, tgz,. bz2,. tar.bz2,. Z. Tar. Z,. zip,. rar, these 10 compressed files to operate.

Compression:
Compression: Tar call bzip2
BZIP2 is a more compressed program,. bz2 end of the file is the result of bzip2 compression. The bzip2 relative to the decompression program is BUNZIP2. Use-j this parameter in tar to invoke gzip. Here are a few examples to illustrate:
# TAR-CJF all.tar.bz2 *.jpg

Decompression: Files ending with. bz2

Bzip2-d all.bz2
BUNZIP2 all.bz2

In fact, since can TAR-CJF all.tar.bz2 *.jpg, of course, can also TAR-XJF all.tar.bz2.
I tried, no problem, I could have done it with the tar command, not bunzip2.


  
This package is divided into two different forms:
  
(1) A compiled package is installed using the installation script:
  
You'd better take a look at the package documentation, such as readme, install, xxx.htm, and so on.
  
Find out if there is any xxx.sh, xxx.pl such documents, is generally install.sh or install.pl, may not be the name, specific situation analysis.
  
Open the terminal, switch to the directory where the package is located, and run the following command:
./xxx.sh or./xxx.pl.
  
(2) need to compile the source code compression package, first decompression:
  
In the same way, you'd better look at the package documentation, such as readme, install, xxx.htm, and so on.
  
The general installation form is:
  
Open the terminal, switch to the directory where the package is located, and run the following command:
  
./configure (automatic configuration, usually takes a lot of time.) The configuration program will check your system information, make the appropriate configuration, will certainly check your compiler (such as GCC) and library files (such as glib) and other information, so you must ensure that your system has these software.
  
Make (start compiling, usually takes a lot of time)
  
Make check (check to see if the results are correct.) This step is not necessary, but recommended to do it)
  
Make install (Run Setup)
  
This completes the software installation process.
  
If you want to delete the source code file, you can run the command in the original directory:
Make clear
  
If you want to uninstall the package, you can run the command in the original directory:
Make Uninstall
  
5, using the Java compiled installer Xxx.jar
  
First, you must have Java Virtual machine software on your system, and if not, download a mount (http://www.java.com or http://java.sun.com) to the Sun's website.
  
To install the Xxx.jar package, first open the terminal, switch to the Xxx.jar directory, and execute:
Java-jar Xxx.jar
  
This starts the installer.
  
Make check (check to see if the results are correct.) This step is not necessary, but recommended to do it)
Make clear
  
If you want to uninstall the package, you can run the command in the original directory:
Make Uninstall
  
6. Use Portage, knock instructions:
  
# emerge PackageName (compile or install some of the prepared packages from source code)
# emerge-k PackageName (compile your own package on the hard drive)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.