18, Linux source package installation detailed

Source: Internet
Author: User

Install the source package

Installing a source package is an executable file that requires us to compile the source code into binary binaries. If you understand the source code, then you can modify the source code customization function, and then compile it into what you want. The benefits of using the source package in addition to customizing the source code can also be customized to customize the relevant functions, because the source package can be compiled with additional options.

The compilation of the source code is used in the Linux system compiler, the common source package is generally used in C language development, this is because C language is the most standard programming language Linux. The C language compiler on Linux is called GCC, which makes it possible to turn C into an executable binary file. So if there is no GCC installed on your machine, there is no way to compile the source code. You can use it yum install -y gcc to complete the installation.

It usually takes three steps to install a source package:
1)./configure

In this step you can customize the function, plus the appropriate options, with what options can be./configure --helpcommand to view. In this step, you will automatically detect if your Linux system and related packages have the necessary libraries to compile the source package, because the compilation cannot be completed once a library is missing. Only a test pass will generate aMakefileFile.
--prefix=/PATH: Specifies the default installation location, which defaults to/usr/local/
--sysconfdir=/PATH: Configuration file Installation Location

2) Make

Using this command will be compiled according to the preset parameters in the makefile file, which is actually GCC at work.

3) make install

Installation steps, the process of generating the relevant software to store directories and configuration files.
The above 3 steps are not all the source package software is the same, the installation process is not so, that is, the installation of the source package is not a certain standard installation procedures. This requires you to get the source package extracted, and then go to the directory to find the relevant help document, usually with INSTALL or README as the file name. So, you must go and have a look.

Install a source code package in combat

1. Get the source package

Download the source package must go to the official site to download, do not download casually on the Internet, that is not safe. Because the source code package you downloaded is likely to have been modified by someone.

2. Unzip the source package

[[email protected]]  # tar  JXVF  httpd-2  .2  .29  .tar  .bz2  
[[email protected] ~] # CD httpd-2 .2 .29

3, configure the relevant options, and generate makefile

[[email protected] httpd-2.2.29]# ./configure --help |less

./configure–help command to see the options you can use. Commonly used –prefix=prefix This option means to define where the package is installed. Usually the source package is installed in the/usr/local/directory. For example, we have Apache installed under the/usr/local/apache2, then this should be written –prefix=/usr/local/apache2 there are many other options, if you have the patience to look at each other to see what role.

[[email protected] Httpd-2.2  .29 ]#./configure--prefix=/usr/local/apache2  
[[email protected] Httpd-2.2 .29 ]# echo $?
0

If the return value is "0" then the execution succeeds, Otherwise, there is no success. The Makefile is now successfully generated.

[[email protected] Httpd-2.2  .29 ]# ll Makefile  
-rw-r--r--1 root root 8909 Sep  6 12 : 44 Makefile

4, to compile

[[email protected] httpd-2.2.29]# make

when you compile, there's a lot of clutter going on. , compile for a long time, CPU usage will be high, this is because the CPU high-speed calculation, after compiling, then use the echo $? Verify that the success is normal.

[[email protected] Httpd-2.2  .29 ]# echo $?  
0

If it is 0, you can take the last step.

5. Installation

[[email protected] Httpd-2.2  .29 ]# make install  

[root @localhost  httpd- 2.2 . 29 ] # ls/usr/local/apache2/ 
Bin  build  cgi-bin  conf  error  htdocs  icons   Include  lib  logs  man  manual   modules

There are a number of situations where an error cannot complete the installation. This is usually caused by a lack of a library file. This requires you to carefully ponder the error message or to view the current directory of "Config.log" to get the relevant information.

6, start the service to see whether the normal access

[[email protected] Httpd-2.2  .29 ]# service httpd start  
starting httpd:httpd:Could not reliably determine the server ' s fully qualified domain name , using Localhost.localdomain for ServerName
      & nbsp                          ,         &NB Sp               [ ok  ]

7, access to the Web IP to see if the Web can be accessed

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/EC/wKioL1fOv3bxQZ9hAAI2sJbjLvc881.gif "title=" 111. GIF "alt=" Wkiol1fov3bxqz9haai2sjbjlvc881.gif "/>

This article from "Live by the Sea like Waves" blog, please be sure to keep this source http://zhang789.blog.51cto.com/11045979/1846985

18, Linux source package installation detailed

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.