Installation of Linux software packages----source code compilation and installation

Source: Internet
Author: User
Tags parent directory

Prerequisite: The development environment mentioned above must be installed,3 Development Package groups on rhel6

Rhel5/centos5 above installation:

1)Development Tools (2) Server Platform Development (3) Develogmentlibraries

RHEL6/CENTOS6 above installation:

1) Development Tools (2) Server Platform Development (3) Desktop platformdevelopment

* * since there is a dependency between the C program source files in Tarball, it is not easy to compile manually with GCC because we must compile in a specific order, or the installation will fail.

**make command : Call gcc with a configuration file ( Makefile, which is used exclusively for make, in the source directory , typically generated by configure scripts) Compile instructions to complete the compilation of a software engineering / software project.

Makefile file: Specifies which file [ which fragment in ] is to be compiled using GCC, which file is compiled before compiling, and what parameters are used for optimization during compilation.

Configure script: Used to generate the Makefile file, this script can be combined with makefile.in files in the same directory to generate Makefile ,Configure scripts are typically generated by the developer through the automake command.

General steps for compiling the installation:

#cd source_code/

#./configure

Operation Purpose: (1) Check the system compilation environment, the required compiler, header files, library files and so on is complete.

(2) Accept user-specified compilation configuration options, where the more common options are as follows:

--help Get help list

--prefix Specifies the directory in which the program is installed----(example httpd program) The binary files of the program are bin,sbin,libexec in this directory (this directory can only be executed by other program calls) directory.

--sysconfdir The installation directory for the specified program configuration file

--mandir The installation directory for the specified program Help file

The execution of this step is recorded in the Config.log in the current directory , and the Makefile file has been generated , and if there are no errors, proceed to the next step.

#make

start based on Makefile file Compilation source code, you can specify the compiler used (such as ICC,gcc)

If this step executes without any errors, proceed to the next steps.

#make Install

is to put your compiled files in the directory you specify.

after installation, the binary file location is:/--prefix The specified directory /bin

/--prefix The specified directory /sbin

/--prefix The specified directory /libexec(files in this directory can only be executed by other program calls)

The post-installation library file location is:/--prefix The specified directory /lib

The post-installation configuration file location is:/--prefix The specified directory /conf

The post-installation Help file location is:/--prefix The specified directory /[share]/man

The location behind the installation file is:/--prefix The specified directory /include

the individual search paths to be modified after installation are as follows

1) Modify the value of the command search path:pathto include the directory of the binaries.

Example:vi/etc/profile.d/apache.sh input

Export Path=/usr/local/apache/bin: $PATH

: x #source/etc/profile.d/apache.sh

#hash –d ( empty hash cache )

#apachectl Start#hash ( view command call path )

2) Modify the value of the library file search path: (each program depends on the library file, especially the Apache Development Library and the program run dependent libraries are /--prefix the specified directory / Lib , we can use the LDD command to see the binary program depends on the library file name and its path, these library files cannot be found in the binary program will not work (Error!) ))

Modify the search path of the library file in the configuration file /etc/ld.so.conf or /etc/ld.so.conf/*.conf file (/etc/ld.so.conf The file will contain these files, you can create a new file yourself, with . conf as the suffix, the new library file path is written in it).

The Ldconfig command allows the system to re-search each library file on the current system based on the profile/etc/ld.so.conf or/etc/ld.so.conf/*.conf file and generate a cache file /etc/ld.so.cache, the system uses this cache file to find the library file, so we have to regenerate the cache file every new library file path.

Example:#vi/etc/ld.so.conf.d/apache.conf input

/usr/local/apache/lib

: x Save Exit

#ldconfig-V ( let the cache file /etc/ld.so.cache and show the process of generating the cache, which directory has the library files!) )

#ldconfig-v|grep/usr/local/apache/

#ldconfig-v|less

3) export the man file (the profile does not need to be exported): Export /--prefix The specified directory / under the man directory, i.e. man1,man8 Directory parent directory, help file search path in config file:/etc/man.config , add line MANPATH "... program Help file where the path ... " can

Example:#vi/etc/man.config Find The MANPATH keyword, add a row

Manpath/usr/local/apache/man:x Save Exit

#man httpd

If you are unsure if you are the Apache Help file for the corresponding version of the program , you can use the command to specify the search path for the Help file

#man-M/usr/local/apache/man httpd

    • header file export (you can use the soft link to link the program header file directory to the system header file directory:/usr/include)

Instance

#ln-sv/usr/local/apache/include/usr/include/httpd

can also be linked separately but not easy to manage! # ln-sv/usr/local/apache/include/*/usr/include/

#ldd/usr/local/apache/bin/httpd ( If the program is transferred to another system, the missing dependent library file cannot be run )

Now the source code installation is complete!!!

Example:linux download tool supporting multi-threaded, breakpoint continuation Axel

# View Readme

#./configure--help

#./configure–prefix=/usr/local/axel

#make && make Install

#man –m/usr/local/axel/share/man Axel

#/usr/local/axel/-N 5 ( open 5 Download Threads )-o/root ( download to /root directory ) ftp://......./....iso

Support the continuation of the breakpoint, terminate it again download try!


This article from the "Let me more Hungry" blog, please be sure to keep this source http://ufirst.blog.51cto.com/7628670/1432603

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.