Write in front: the blogger is a real combat development after training into the cause of the “hill pig”, nickname from the cartoon “Lion King” in “Peng Peng”, always optimistic, positive attitude towards things around. My technical path from Java full stack engineer all the way to big data development, data mining field, now there are small achievements, I would like to share with you what I have learned in the past, I hope to help you on the way of learning. At the same time, the blogger also wants to build a perfect technical library through this attempt. Any anomalies, errors and matters needing attention related to the technical points of the article will be listed at the end, and everyone is welcome to provide materials in various ways.
- Please criticize any mistakes in the article and revise them in time.
- If you have any questions you would like to discuss or learn, please contact me at [email protected].
- The style of the published article varies from column to column, and all are self-contained. Please correct the deficiencies.
CentOS software management – compilation and installation
Configure, make, make install\
The article directories
- CentOS software management – compilation and installation
-
- First, environmental preparation
-
- 1. Core components
- 2. Other components
- Two, installation process
-
- 1. Decompress tar -zvxf
- 2. Configure: configure
- 3. Make
- 4. Make test/check
- 5. Compile and install: make install
First, environmental preparation
After a lot of software download is a source package, is not able to run directly, need to compile and install first, generate executable program. To compile, you need to install the build tool using yum.
1. Core components
The GNU Compiler Collection (GCC) GNU Compiler suite must be installed, which includes C, C++, Objective-C, Fortran, Java, Ada, and Go language front-end, as well as corresponding language libraries. It can almost meet the needs of most source software compilation environment.
yum install gcc
Copy the code
After installation, the following problems can be solved:
If there is a problem with yum use, enter the portal:Linux Software Management – YUM tools
2. Other components
In the actual software installation, due to the software and software may also be dependent on and call relationship between, such as: when the source code to write the introduction of a class library, if no class libraries, our system will compile failed, this time we just lack of corresponding class library can be installed according to the error message, the following is a list of some commonly used class library.
- pcre
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
Copy the code
yum install pcre-devel
Copy the code
- zlib
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
Copy the code
yum install zlib-devel
Copy the code
- curl
SRC /main.c:18:23: error: curl/ main. h: no file or directory SRC /main.c: in function 'main' : SRC /main.c:143: Warning: implicitly declare function 'curl_global_init' SRC /main.c:143: Error: 'CURL_GLOBAL_ALL' not declared (used for the first time in this function) SRC /main.c:143: Error: (Each undeclared identifier is reported only once within its SRC /main.c:143: error: function, even if it occurs more than once within a function.) C :397: warning: implicitly declare function 'curl_global_cleanup' make: *** [SRC /main.o] error 1Copy the code
yum install curl-devel
Copy the code
- openssl
yum install openssl openssl-devel
Copy the code
Two, installation process
1. Decompress tar -zvxf
The first step of the compilation installation is similar to that of the decompression installation. Decompression is required first and generally contains the following directories and contents.
- SRC directory: where the software source code is stored
- LICENSE: LICENSE and permission information
- README: Help documentation
- Configure: detects the current system environment, customizes configurations, and generates makefiles
- Makefiles: May exist directly, most often after executing configure, to specify compilation order and other complex functional operations
2. Configure: configure
The first step in a build installation is to execute the configure script, which checks the environment required to build the current software and allows the user to specify the configuration as needed. All options begin with — and use an equal sign to connect the configuration item to the configured value, as in –prefix=/usr/local/.
- –prefix: specifies the target path during compilation and installation, which is equivalent to the customized software installation location
- –bindir: Specifies the installation location of the binary file
- –sbindir: Specifies the installation location of the super binary
- –datadir: Specifies the installation location of the data file
- –include: specifies the installation location of the header file
- –infodir: specifies the installation location of the info document format file
- –mandir: Specifies the installation location of the help document
When no installation location is specified, the installation will be installed to the default location, usually in /usr/local
3. Make
After configure, if there are no problems with the environment, the corresponding Makefile is generated, which is invoked when the make command is executed.
Nginx make will generate the following files in the obj folder:
4. Make test/check
After compiling, you can run the make test or make check command to check whether the compilation process is correct.
5. Compile and install: make install
Perform the last step: compile and install, according to the configuration of the configure phase, the generated software to the specified directory, you can define the soft connection to the executable file or add environment variables, easy to use.