Install and uninstall files in the .tar.gz format in Linux

Source: Internet
Author: User
Tags gz file
The installation of the tar.gz file is self-compiled. Source code . .

First, unpack the package, tar-zxvf xxx.tar.gz, and a folder named after the file name will be generated. There will be some README, install, Doc and other documents, read carefully, you can know what special settings are required for the software installation. There is no way to elaborate on this :)

Generally, a script file named configure is included in the software package to complete the configuration. You can add many parameters and run them.
/Configure -- help to get help, such as./configure
-- Prefix = xxx is used to set where the software is installed. Set parameters and run./configure to generate the MAKEFILE file. This is the basis for subsequent compilation.

Next we need to compile the file. It is very simple. Because the MAKEFILE file exists, you only need to run make to compile the file. Make is to read
Add all configure scriptsProgramCreated SystemComposition. These files will tell make which files need to be compiled and in what order, because there may be hundreds
Source program files. When make works, every command being executed and all parameters related to the command are displayed on the screen. These outputs are usually the call declarations of the compiler and
The parameter passed to the compiler. If the compiler completes the job smoothly, no error message will appear. Most compilers have clear and clear error messages, so you don't have to worry about missing an error. If
If you see an error, you don't have to worry about it. Most error messages do not reflect a problem in the program itself, which is usually a problem in the system or in the system. In typical cases, most of the information is due to files
The access permission is incorrect, or the file is not found.

After compilation, the software is installed. This is simpler. make install. This command will start the installation script. Because the make command will display it when executing each command, so there will be a lot of text in front of you. If no error message is displayed, the software package is installed.

The reverse installation is "make Uninstall". Do not describe it in detail.

----------------------------------------------------------------------------

There are not many things in tar.gz ~~~~
==========================================================
The software package with tar.gz and tar.bz2 is mostly installed with./configure; Make; make install; some software is directly make; make install;

We can use. /configure -- help to view the functions of the configuration software. Most of the software is provided. /configure configures the functions of the software; a few do not, if not, do not use. /configure; directly make; make install;

. One of the most important parameters of/configure is -- prefix. With the -- prefix parameter, we can specify the software installation directory. If we don't need this software, just delete the Software Directory;

For example, you can specify that fcitx is installed in the/opt/fcitx directory;

[Root @ localhost fcitx] #./configure -- prefix =/opt/fcitx

If you do not need fcitx, you can directly Delete the/opt/fcitx directory;

In this example, if fcitx is customized to the/opt/fcitx directory, the complete installation method should be:

[Root @ localhost fcitx] # tar jxvf fcitx-3.2-050827.tar.bz2
[Root @ localhost fcitx] # cd fcitx
[Root @ localhost fcitx] #./configure -- prefix =/opt/fcitx
[Root @ localhost fcitx] # Make
[Root @ localhost fcitx] # make install

========================================================== ======================================

1. What is the source code package software;

As the name implies, the source package is the sourceCodeVisible software packages, the most common software based on Linux and BSD systems; Software visible from domestic sources is almost extinct; most open source software is made abroad; fcitx, lumaqq, lumaqq, and scim are well-known open-source software in China;

However, the visible source code of the software does not mean that the software is open-source. We must take the software license as the standard. For example, some software is visible in the source code, however, he agrees that the user can only modify the content as agreed; for example, the vBB Forum program; therefore, whether a software is an open-source software requires two conditions; the first is that the source code is visible; second, there should be loose licenses, such as GPL certificates;

In GNU Linux or BSDCommunityWhile releasing the binary software package, developers will also provide the source code software package for us;

Ii. What is the use of source code?

I
If a software source code is available, anyone can see how it was developed, just like a bottle, such as what the mold made by the bottle is; what materials are needed; specific Purposes and detailed instructions for bottles
. The open source code of the software is similar. When developers give us the software, they will also tell us how the software is developed. As long as our level is high enough, all the code is there, so we can fix it.
Modify and customize the software to suit our needs. If the windows open source code is released with GPL, someone can create more than N Windows releases. Unfortunately
Windows is not an open-source system;

Therefore, the use of the source code of the software is nothing more than the following two points;

1. The software is customized according to the user's needs;
2. Secondary Development; Note: developers must permit Secondary Development Based on the software license agreement;

3. How to install software packaged in the source code package;

1. packaging format of the source code package;

The source code is generally packaged in file.tar.gz file.tar.bz2 or file. SRC. rpm in the format of file.tar.gzand file.tar.bz2. The command is as follows;
[Root @ localhost beinan] # tar jxvf file.tar.bz2
[Root @ localhost beinan] # tar zxvf file.tar.gz

For the usage of file. SRC. rpm, see: Introduction to file. SRC. RPM usage

2. How to compile and install the source code package (MOST)

1) Unpack the software package and view the help document;

After unzipping a package, we can usually find the README (or reame) and install (or install); or DOC (or Doc) directories. The names are similar;

For example, we download a newer fcitx package, for example, a fcitx-3.2-050827.tar.bz2.

We will find the following files when uninstalling this software package;

[Root @ localhost fcitx] # tar jxvf fcitx-3.2-050827.tar.bz2
[Root @ localhost fcitx] # cd fcitx
[Root @ localhost fcitx] # ls
Aclocal. M4 config. Guess configure Debian install makefile. In SRC XPM
Authors config. H. In Configure. In depcomp install-SH missing thanks
Autogen. Sh config. rpath copying Doc lib mkinstalldirs todo
Changelog config. sub data fcitx. spec. In makefile. Am readme tools

So we can see the install and Doc directories of fcitx. They all tell us how to install them;

Sometimes the installation documents will be detailed on the developer's home page and troubleshooting of common problems, such as lumaqq.

2) Conditions for compiling and installing software;

First
First, we must install at least the development tools in Linux, such as GCC, Perl, Python, glibc, GTK, make, and automake.
Such as development tools or basic packages; also install some corresponding development packages, usually the file name includes Dev, such as kernel-devel; and some development libraries, such as those starting with LIB; if you
When compiling the software, sometimes the system prompts something missing, such as the development tools and libraries. Find and install the tools from the CD; sometimes the CD is not provided, please use Google to search for the corresponding
Software packages may also be used to compile and install the dependent packages;

Sometimes the dependent package has already been installed in the system, but the system prompts that it cannot be found. What should I do? In this case, we need to set the environment variable pkg_config_path;

# Export pkg_config_path =/usr/lib/pkgconfig
Or
# Export pkg_config_path =/usr/local/lib/pkgconfig
Then let's run the compiled./configure; Make; make install, and try it;

For programs developed using Java tools, JRE or JDK is required. JDK already includes JRE. If we only require an environment where Java programs are running, you only need to install JRE. After JRE is installed, you can configure the Java environment variables. If it is a graphic interface program, click the mouse to OK;

Programs developed using Perl require the Perl environment. Therefore, you must install the Perl package. The same applies to Python;

3) Compile and install software;

The software package with tar.gz and tar.bz2 is mostly installed through./configure; Make; make install; some software is directly make; make install;

We can use. /configure -- help to view the functions of the configuration software. Most of the software is provided. /configure configures the functions of the software; a few do not, if not, do not use. /configure; directly make; make install;

. One of the most important parameters of/configure is -- prefix. With the -- prefix parameter, we can specify the software installation directory. If we don't need this software, simply delete the Software Directory;

For example, you can specify that fcitx is installed in the/opt/fcitx directory;
[Root @ localhost fcitx] #./configure -- prefix =/opt/fcitx

If you do not need fcitx, you can directly Delete the/opt/fcitx directory;

In this example, if fcitx is customized to the/opt/fcitx directory, the complete installation method should be:
[Root @ localhost fcitx] # tar jxvf fcitx-3.2-050827.tar.bz2
[Root @ localhost fcitx] # cd fcitx
[Root @ localhost fcitx] #./configure -- prefix =/opt/fcitx
[Root @ localhost fcitx] # Make
[Root @ localhost fcitx] # make install

Call fcitx, which should be
[Beinan @ localhost ~] #/Opt/fcitx/bin/fcitx

If you want fcitx to be called as long as fcitx is executed, configure the environment variable or create a fcitx link in/usr/bin;
[Root @ localhost beinan] # ln-S/opt/fcitx/bin/fcitx/usr/bin/fcitx

In general, most software does not provide the method of uninstalling the source code package. We can find the Software Installation Point to delete it. It mainly depends on where you installed it.

For how to set the environment variable path, see: In Fedora Core, why are some common commands unavailable? Solution: set path

Therefore, you can set the path as this;
Export Path = ". :/bin:/usr/local/bin:/usr/sbin:/usr/x11r6/bin:/sbin:/opt/fcitx/bin"

Of course, this is just an example, fcitx can enter the desktop to run automatically, please refer to the installation instructions on the http://www.fcitx.org official site; an example is just to let you understand a little;

Another example, for example, I want to install mlterm; and specify the installation directory as/opt/mlterm; http://mlterm.sourceforge.net

#./Configure -- prefix =/opt/mlterm
# Make
# Make install

Install the software installed in the source code package in the/OPT directory, so that you do not know where the software is installed; it is also convenient to uninstall;

3. Other types of software;

1) Installation of programs based on Perl and Python;

Generally, use # perl file. pl for installation, such as the installation of VMware's Linux version;
[Root @ localhost vmware-distrib] # Perl vmware-install.pl.

Python file. py is also used for installation.

The general software packages include README, install, and Doc. For more information, see the installation documentation;

2) some installation programs are called in script mode; Use # sh file name

For example, the installation of the nvdia driver is like this;
[Beinan @ localhost ~] # Sh NFORCE-Linux-x86-1.0-0306-pkg1.run

Of course it can also be installed through the CHMOD 755 NFORCE-Linux-x86-1.0-0306-pkg1.run, and then ../NFORCE-Linux-x86-1.0-0306-pkg1.run;

Some are file. Bin files.
[Beinan @ localhost ~] # Chmod 755 file. Bin
[Beinan @ localhost ~] #./File. Bin

That's big enough ........

Note: The installation of the source code package and software in special formats is so much that it cannot be completed. We mainly refer to the software installation documents. When installing the software, if it is only a simple application, if there is an RPM package, try to use the RPM package; it is mainly convenient and easy to manage;

Appendix:

When installing software, it is best to use the system software package management tools provided by the respective releases. For fedora/RedHat, refer to the followingArticle;

0) rpm basics: introduction and application of RPM

1) fedora system management software package Tool System-config-packages to conveniently add and remove the software packages provided by the system installation disk. For details, see fedora Software Package Manager System-config-packages.

2) RedHat system management software package tool. The new system should be RedHat-config-packages, which is used in the same way as fedora Software Package Manager System-config-packages;

3) Online installation, removal, and upgrade of apt + synaptic software package. Usage: install or upgrade Fedora Core 4.0 software package online with apt + synaptic
4) install, upgrade, and remove Yum software package online. Usage: fedora/RedHat online installation and update software package, yum

5) Introduction to file. SRC. rpm

6) how to compile and install the source code package software

At present, apt and Yum are very mature. We recommend that you use apt or yum when installing the software. If you install the software package provided by the system disk, you can use system-config-packages or RedHat-config-packages.

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.