Compilation and installation of packages

Source: Internet
Author: User

Objective:

Whether it is the RPM installation or Yum installation is installed in binary format, is someone else compiled package, we do not need to compile to use, but not necessarily in all cases, so can only build their own installation, through their own installation can be compiled according to their own needs to compile the package function, RPM package is divided into the compiled RPM package, there is a source RPM package.



Package Compilation Installation : testapp-version-release.src.rpm format rpm Package after installation, use the Rpmbuild command to make a binary RPM package, then install. This type of RPM package can be compiled into a package that fully conforms to the version of your platform.

Approximate process: Source code--Preprocessing--> compilation (GCC)--------

source Code organization format : Multiple files, between code in a file, are likely to have cross-file dependencies, so project management tools are needed to address these complex relationships.

Make Project management tool: Automatically call the processor to do preprocessing, automatically invoke the compiler to compile, call the assembler to do the assembly, call the linker to do the link, greatly simplifying the steps we compile and install.

mikefile file : Make's configuration file, depending on the source code makes different decisions, not pre-existing, because for each different user needs are not the same, Is the Configure script to pass parameters to makefile.in, and then makefile.in as the template generated files. The Configure script allows the user to pass compilation parameters, enable attributes, install paths, and so on, and then

The makefile.in file generates a Makefile file for the template.

To compile the installation three steps :

First step:./confiugre

(1) Pass the parameter through the option, specify enable feature, install path, etc., refer to the user's designation and makefile.in file generation makefile when executing;

(2) Check the dependent external environment

Step Two: Make:

Build your application According to the makefile file

Step Three: Make install

Equivalent to the CP command, copy the corresponding file to the specified directory

In some cases there are no configure scripts and makefile.in files, I need some development tools to generate these files

Development tools:

autoconf: Generate Configure script file

automake: Generate Makefile.in file

Recommendation: View Install,readme documents before installing



Access to source code:

Official self-built site:

apache.org

mariadb.org

Code hosting:

SourceForge

github.com

code.google.com

C + + source code compiler: GCC (GNU c complier)


compile C source code program: ./confiugre

premise: Provide development tools and development environment

Development tools: Make, GCC, etc.

Development environment: Development Library, header file

glibc: Standard library


to provide development components through "package groups"

CentOS 6: "Development Tools", "Server Platform development",

First install the GCC compiler on the CentOS system,

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/78/5E/wKioL1Z6q6DDYZ2jAAAha4SS8ko059.png "title=" 26.PNG "alt=" Wkiol1z6q6ddyz2jaaaha4ss8ko059.png "/>

First Step: Configure script

Options: Specify the installation location, specify the enabled features

--help: Get the options it supports

Option Categories:

Installation path settings:

--prefix=/path/to/somewhere: Specifies the default installation location; default is/usr/local/

--sysconfdir=/path/to/somewhere: Configuration file installation location;


System types:

Optional Features: Optional Features

--disable-feature (Disable this attribute)

--enable-feature[=arg] (enable this feature)


Optional Packages: Optional Package

--with-package[=arg]

--without-package


Compile and install the HTTPD program:

The first step:

Download httpd program source code

To view the install file for the source code installation package, the installation steps are displayed:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/78/91/wKioL1Z_vPLQ-hvDAAAu9abW8ho476.png "title=" 1.PNG " alt= "Wkiol1z_vplq-hvdaaau9abw8ho476.png"/>


Step Two:

Performing an installation using the./configure script

and indicate the installation directory and unknown file installation location

httpd-2.2.29]#./configure--prefix=/usr/local/apache2--SYSCONFDIR=/ETC/HTTPD2

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/78/94/wKioL1Z_0_PCuFQzAAAN0SGFuc4299.png "title=" 1.PNG " alt= "Wkiol1z_0_pcufqzaaan0sgfuc4299.png"/>

Step Three:

Execute make

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/78/95/wKiom1Z_07mDCC4HAAAE2l7d5ho607.png "title=" 1.PNG " alt= "Wkiom1z_07mdcc4haaae2l7d5ho607.png"/>


Step Three:

Execute make Install

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/78/94/wKioL1Z_1BDCHRqQAAAF4iR6V0c181.png "title=" 1.PNG " alt= "Wkiol1z_1bdchrqqaaaf4ir6v0c181.png"/>


Review the installation results when finished

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/78/96/wKiom1Z_1EPSJJUnAAAKvx17Chg790.png "title=" 1.PNG " alt= "Wkiom1z_1epsjjunaaakvx17chg790.png"/>


Fourth Step:

Launcher: A Apachectl file in the/apache2/bin directory is the startup script for the program, which starts the program with it

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/78/96/wKiom1Z_1QKBQIRBAAAXs3rbspU676.png "title=" 1.PNG " alt= "Wkiom1z_1qkbqirbaaaxs3rbspu676.png"/>

Then start the program

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/78/94/wKioL1Z_1Wzj8ZVGAAAFeChetSk906.png "title=" 1.PNG " alt= "Wkiol1z_1wzj8zvgaaafechetsk906.png"/>

View the status of the network connection, if the display 80 port is already in the listening state indicates that HTTPD has been started:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/78/96/wKiom1Z_1tfxVkJsAABG25WDIE4841.png "title=" 1.PNG " alt= "Wkiom1z_1tfxvkjsaabg25wdie4841.png"/>


The address can be accessed by the server

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/78/96/wKiom1Z_1zfS_TeKAAA3clZkhiU444.png "title=" 1.PNG " alt= "Wkiom1z_1zfs_tekaaa3clzkhiu444.png"/>

Post-installation configuration:

(1) Export the binary program directory to the PATH environment variable;

Edit File/etc/profile.d/name.sh

Export Path=/path/to/bin: $PATH

(2) Export Library file path

Edit/etc/ld.so.conf.d/name.conf

Add a new library file sitting in the directory in this file

To have the system regenerate the cache

(3) Export header file

Implemented in a link-based manner;

Ln-sv

(4) Export Help manual

Edit/etc/man.config File

Add a Manpath












Compilation and installation of packages

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.