Learning Log---linuxの source code compilation use and instance running

Source: Internet
Author: User
Tags bz2

Compilation and installation of package management:

Source code: C, C + +

Perl Source code:

Python Source:


Applications: Project Groups

Software Foundation: FSF,ASF

Project group: leader, contributor

Small item: One person maintains

Commercial Company support: Open Source/Enterprise Edition


SourceForge.net

Github.com

Code.google.com


SOURCE program:

Project Engineering: Spread the code across multiple source code files

Gnu/make


Autoconf:configure Script

Check the compilation environment for compilation requirements and define which features or functions are enabled at the time of the current program compilation, as well as the definition of installation paths, etc.;

Result: Makefile files are generated based on the makefile.in file

Automake: User generated makefile.in files, usually the source is provided by the people

Used to generate makefile files in conjunction with configure scripts

Makefile file is a configuration file for make command



Steps to compile the installation:

1, get the source code, and extract:

# tar XF Package-version.tar. {GZ|BZ2|XZ}

Note: The expanded directory name is typically package-version

2. Switch to the source directory

# CD Package-version

3, execute configure script, check the compilation environment

#./configure

4. Compiling

# make

5. Installation

# make Install



Common features of the Configure script:

We need to define the configuration:

1. Specify the installation path:

--PREFIX=/USR/LOCAL/PACKAGE_NAME Specifies the unified installation path, its decentralized configuration files, etc.

--sysconfdir=/etc/package_name configuration file path

2. Specify the Enabled/disabled features:

--enable-feature: For example--ENABLE-FPM This indicates that the FPM feature is enabled

--disable-feature: For example--disable-socket Disabling the socket function

3. Specify the functions, programs, or files that you rely on

--with-function: Enable a feature

--without-function: Disabling a feature


Different programs, their configure scripting features are different, to get help:

./configure--help

Because some of the orders are different.

When the program is packaged, some of the program's RPM packages are attached to Devel's sub-package

For example, when installing Nginx, required Pcre library, but already installed, because some of the Pcre library is in the Devel package


Practice:

1, compile and install Nginx, and start it;

2, compile and install Axel, and try it;

This is a download tool used on Linux, similar to Thunderbolt

Axel-o/tmp-n 3 Download path

3, compile and install httpd, and start it;


Some of the newly installed software configuration and Lib are in their own directory, such as the need for kernel recognition, the following configuration is required:

Binary program:

/usr/local/apache/bin

# vim/etc/profile.d/apache.sh

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

Export PATH


Header file output to the system:

# LN-SV/USR/LOCAL/APACHE/INCLUDE/USR/INCLUDE/HTTPD


Library file output:

/ETC/LD.SO.CONF.D This directory is where the kernel is looking for LIB libraries, so if you want to add additional libraries to the library, you need to include additional library paths under them.

# vim/etc/ld.so.conf.d/httpd.conf

In this new http.conf file, enter/usr/local/apache/lib, as follows

[email protected] ld.so.conf.d]# cat mysql-i386.conf

/usr/lib/mysql

To have the system regenerate the library file path cache

# Ldconfig The cache is present in/etc/ld.so.cache

The cached Lib path exists here for the kernel to use dynamically


To export the man file:

# Vim/etc/man.config

Manpath/usr/local/apache/man

# There is another way to use the Man-m + path


Summary: Source compilation installation

Prerequisite: Prepare the development environment.

Compile process:

./configure

Make

Make install

Output:

Header file

Library files

Binary program

Man document


Example:

Source Code Compilation Installation Httpd-2.4.17.tar.gz

[Email protected] software]# TAR-XF httpd-2.4.17.tar.gz

[[email protected] software]# ls

axel-2.0 axel-2.0.tar.bz2 httpd-2.4.17 httpd-2.4.17.tar.gz nginx-1.8.0 nginx-1.8.0.tar.gz

[Email protected] software]# CD httpd-2.4.17

Note here to pre-compile and install Apr and Apr-util

When installing compile httpd, you need to indicate the location of the dependent program, as follows

[Email protected] httpd-2.4.17]#/configure--prefix=/usr/local/httpd--with-apr=/usr/local/apr--with-apr-util=/ Usr/local/apr-util


The locations I installed here are all under/USR/LOCAL/HTTPD, so the boot is also in the bin directory on this side.

The process is relatively simple, don't repeat it.

Learning Log---linuxの source code compilation use and instance running

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.