How to install software using source code files in UbuntuLinux

Source: Internet
Author: User
Article Title: how to install software using the source code file in UbuntuLinux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

A wide range of software is included in Ubuntu. These software can be easily installed in a graphical automatic mode ("Add/Delete" or "new, however, for new software that has just been released, Ubuntu has not yet been included in the source, so we need to use a more general installation method: manually install these software from the source file. The following describes the detailed steps for manual installation.

1. Install the Compilation Program

To compile the source code, the first step is to install programs such as compiling and building. Skip this step if you have already installed it. In Ubuntu, it is very simple. You just need to execute the following command:

$ Sudo apt-get install build-essential

After the command is executed, the tools required to install software from the source file, such as gcc, make, g ++, and other required software, are installed.

2. Download and compile the source code of the software

When downloading source files, you must find out the library files and other programs that the software depends on, and first install them. This information can be found on the home page of the open-source project. After completing these preparations, we can do the following. Because the source code of the software is usually released as a compressed file, you need to decompress it to the specified directory. The command is as follows:

OwnLinux @ ubuntu :~ $ Tar xvzf

Program.tar.gz

OwnLinux @ ubuntu :~ $ Cd

Program/

If you are not familiar with the tar command, click here to read the tar command details

When installing a program from a source file in Linux, there is a general mode, that is, configuration (. /Configure)?> Compile (make)?> Install (sudo make install ). However, you 'd better read the installation instructions included in the source file before, because the developer's instructions for each program are the most authoritative. Program developers usually store the installation instructions in the names INSTALL or README. Where can I find these files? They can be found on the project homepage or in the source code home directory.

1. Configuration

The first step to build an application is to execute the configure script, which is located in the main directory of the program source file:

OwnLinux @ ubuntu :~ /Program $./configure

This script will scan the system to ensure that all library files required by the program already exist, and complete the file path and other necessary settings. If the library files required by the program are incomplete, the configuration script will exit and tell you which library files or versions are too old to be updated. In this case, it is not enough to obtain a software package containing the library file. At the same time, find the development kit with all the header files of the library file. In Ubuntu, such a package generally ends with-dev as the file name. After installing all the required library files, run the configuration script again until there is no error message. This indicates that all the required library files have been installed properly, which satisfies the dependency.

2. Compile

After the configuration script is successfully exited, the next step is to compile the code. The specific operation is to run the make command in the main directory of the source file:

OwnLinux @ ubuntu :~ /Program $ make

At this time, you will see a string of compiled output data quickly rolled out from the screen, if normal, the system will return the prompt status. However, if errors occur during compilation, the troubleshooting process is not as simple as the configuration step. This usually involves debugging the source code. The source code may have syntax errors or other errors. What should I do? If you are a programmer, debug it yourself! Otherwise, check the support channels such as the mail list of the software to see if there are known bugs. If so, check how others solve the bugs. If not, submit a bug report, maybe there will be a solution soon.

3. Install

After the software is successfully compiled, the last step is to install it on the system. Most program makefile files contain a function for installation. It should be noted that most of the time we must install the program as the root user, so that the program will install the file in/usr or other directories that only the super user has the write permission. Still in the main directory of the source file, execute the following command:

OwnLinux @ ubuntu :~ /Program $ sudo make install

Now, the program will be installed on your computer. In addition, when you no longer use the program, you can use the uninstall function provided by the Software. Generally, the program has this function. Switch to the main directory of the source file and run the following command:

OwnLinux @ ubuntu :~ /Program $ sudo make uninstall

In most cases, the programs installed using the method described above are located under/usr/local. If you want to isolate the installed program file from the Ubuntu inspection file system, you can add items for the command, as shown below:

OwnLinux @ ubuntu :~ /Program $./configure? Prefix =/opt

Although this is generally effective, there are exceptions, some programs simply ignore the item; some programs, such as programs containing kernel modules, will put all of them into your file system.

The methods for manually installing software described above are described for the Ubuntu environment, but the methods for installing applications from source files in various Linux systems are basically the same.

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.