Install software from source code

Source: Internet
Author: User

Under what circumstances do we need to install software from the source code? I think nothing more than 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 fresh, 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:

  1. Compilation tool: To compile source code into executable binary files, compilation tools are indispensable. In ubuntu, You can executesudo apt-get install build-essentialCommand to install the basic compilation tool. Depending on the actual situation of the compiled program, you may also need to install other tools.
  2. 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 usesudo apt-get build-depThe command is 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 is available.tar zxvf *.tar.gzTo unpack the package. The latter usestar 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.

  1. Configuration: This is the first step to compile the source code../configureCommand complete. Execute this step to prepare for source code compilation. Common options are:--Prefix = prefix, used to specify the installation location of the program. For more options, see--Help query. Some programs do not need to perform this step.
  2. Compile: Once the configuration is passed, you can use it immediately.makeCommand 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.
  3. Installation: If the compilation is normal, executesudo make installYou can install the program in 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 runsudo make uninstallCommand.

 

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.