Linux skills: Install software from source code

Source: Internet
Author: User
Linux skills: Install software from the source code-general Linux technology-Linux technology and application information. For details, refer to the following section. If you do not specify the installation directory during configuration, it is generally in/usr/local/bin. In addition, binary files can also be found in the compiled source code directory.

Don't worry, installing software in Linux is not that difficult.

Under what circumstances do we need to install software from the source code? I think it is similar to these situations: one case is that the software releases a new version, and the release version is not followed up in a timely manner. At this time, if you want to taste it, you have to rely on yourself; another scenario is that no binary package can be directly used by software developers or existing systems, and you have to use the software yourself; of course, there are other situations. All in all, learning to install software from source code is a very important skill.

So how can we install software from the source code? First, you must prepare the source code for compilation. This includes two aspects:

Compilation tool: To compile source code into executable binary files, compilation tools are indispensable. In Ubuntu, you can run the sudo apt-get install build-essential command from the terminal to install the basic compilation tool. Depending on the actual situation of the compiled program, you may also need to install other tools.

Compile dependencies: In addition to installing basic compilation tools, we also need to install the dependencies required by the program in order to compile the source code smoothly. The Ubuntu system can use the sudo apt-get build-dep command followed by the package name to prepare the required dependencies. If this method cannot be used to INSTALL dependencies in Ubuntu, you should be good at reading the README, INSTALL, and other files contained in the source code package, you only need to do as required.

Before compiling the source code, you must download the software source code package to your hard disk. Generally, program source code packages are often packaged into the .tar.gz and .tar.bz2 formats. The former can be decompressed using tar zxvf * .tar.gz, and the latter uses tar jxvf * .tar.bz2. Generally, after unpacking, we should read the relevant instruction files attached to the program, such as README (self-report file) and INSTALL (Installation File), to learn about program compilation.

When everything is ready, let's perform the source code compilation trilogy.

Configuration: This is the first step to compile the source code, through the./configure command. Execute this step to prepare for source code compilation. Common options include -- prefix = PREFIX, which is used to specify the installation location of the program. You can use -- help to query more options. Some programs do not need to perform this step.

Compile: Once the configuration passes, you can use the make command to execute the source code compilation process. Depending on the specific circumstances of the software, the time required for compilation varies. What we need to do is to wait patiently and stay calm. Although this step only contains simple instructions, the problems encountered sometimes are very complicated. The most common case is that the program compilation fails to be completed successfully. In this case, you need to analyze the error prompt to find the corresponding solution.

Installation: If the compilation is normal, run sudo make install to install the program to the system.

What should I do if I think the compiled software is not suitable enough and want to delete it? We only need to go to the directory where the source code is compiled and execute the sudo make uninstall command.
Related Article

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.