Install the software under CentOS , you can use the rpm package,yum tool, download source code to compile and install, where the customization of the compiled installation is higher
For some in the software, self-download source code to compile and install more convenient
Program: Source code---compile----run
To perform the compilation installation steps:
- Get the source code and unzip it
#tar XF xxx.tar.gz//or: #tar XF xxx.tar.bz2
- Execute the configure script under the extracted source code directory
#./configure [Options] Options:--help View the script Help information, the options for each software are different, the following is the usual case--prefix=path define the installation path of the application,--prefix=/usr/l Ocal/app_name--sbin-path=path defines the path to the application's binary command--conf-path=path defines the application configuration file path,--conf-path=/etc/app_name--enable -xxxx open a feature (XXXX), the application supports this feature, but by default does not install--disable--xxxx to turn off a feature (XXXX), the application supports this feature, the default installation, but the user does not need--with--xxxx to open A feature (XXXX), the application supports this feature, but the default does not install--without--xxxx off a feature (XXXX), the application supports the feature, the default installation, but the user does not need
if ./configure when you encounter a dependency error message, you can use the following methods to resolve
-
-
- Turn off this feature with without (not recommended)
- Install the required environment, install the devel package for the required environment
- make: Define Makefile in which order to compile the source program
Make-j n Multiple threads are compiled together, n is the number of threads, and make automatically compiles files according to the compilation order in the makefile file in the current directory
- Make install: Install the application
Make install
Work after compiling the installation:
- Add the installed application command file to the system path: (Add the command file of the application to the PATH variable)
The first method: Make a link to the command file ( bin file) in the /etc/bin directory
#ln-S/usr/local/app_name/bin/*/usr/bin/ /For all files to make a link, will produce a large number of inode nodes, not recommended//or: #ln-S/usr/local/app_name/bin / Usr/bin/app_anme //Make a link to a directory
Second method: Modify the path variable in the /etc/profile file (the /etc/profile file will be executed automatically when the shell starts)
#vim/etc/profile Export path= "$PATH:/app_path" //Add the line statement after the end of the text #source/etc/profile //Reload the file for the changes to take effect
The third method: Build the . SH file in the /etc/profile.d/ directory (The/ETC/PROFILE.D Directory is the startup script required by some applications and will be executed automatically)
#vim/etc/profile.d/app_name.sh path= $PATH:/usr/local/app_name/bin//Restart for the changes to take effect
- Add the installed application library file to the system library file path ( /usr/lib or /usr/lib64 )
The first method: Make a link file for the library file (Lib for 32bits system, lib64 corresponds to 64bits system)
#ln-S/usr/local/app_name/lib/*/usr/lib//or: #ln-S/usr/local/app_name/lib /usr/lib/app_name
The second method: Create a app_name.confin the /etc/ld.so.conf.d directory, add the library file location of the application ( /etc/ld.so.conf.d to load Dynamic library files in a Linux system)
#ldconfig- V: Loads the modified configuration, makes it effective, and displays the load library file process to see if the added application library file can be loaded successfully
- Add the application's header file to the System header file path ( /usr/include ):
Make a link file
#ln-S/usr/local/app_name/include/*/usr/include//or: #ln-S/usr/local/app_name/include/usr/include/app_name
- Add Help for an application
First method: Specify the path to the Help information file when using man
Man-m app_path bin_name //-m Specify the location of the Help information
Second method: Modify man config file ( CentOS7 man profile :/etc/amn_db.conf )
#vim/etc/man_db.conf manpath_map app_path (the path where the command is located) Help_path (the path to the Help information file) //Add the line information at the corresponding location
Reboot to make the changes take effect
Example: Installing the Python3 under CentOS7
The Python version that was preinstalled under CentOS7 or Python2
#python-V //view Python version
Download wget Tools
#yum-y Install wget
Download Python3 source code package (wget Download_url, that is, you can download the corresponding Resources Down_url link to the current directory)
In the Python official website source code package download page (https://www.python.org/downloads/source/) can find the corresponding source code package download link
#wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0b3.tgz
Extract the Python3 source code package
If the tar file does not give an error, enter the extracted source code directory, if the error, may be the Python source package download is not complete, it is recommended to re-download, or replace the download link
#cd python-3.7.0b3# ls// aclocal.m4 configure.ac install-sh Mac Objects Programs setup.py// config.guess Doc Lib Makefile.pre.in Parser pyconfig.h.in tools// config.sub Grammar LICENSE Misc PC python// Configure Include M4 Modules Pcbuild readme.rst//can see the executable file configure, no Makefie file//Can pass./configure--help View Help for this software source code configure
Install compile
#./configure--prefix=/usr/local/python3 //install Python3 into the/usr/local/python3 directory//execute./configure can be LS, found that the makefile file has been generated under the current directory #make-j //can omit makefile, because make will automatically find makefile or makefile files in that directory to compile #make install // Installation python3//found error://Zipimport. Zipimporterror:can ' t decompress data; Zlib not available//Make: * * * [install] Error 1//reason is dependency problem, download ZLIBR package and Zlib devel package #yum-y install zlib Zlib-devel#make Inst All//retry//Discovery and Error://modulenotfounderror:no module named ' _ctypes '//Because version 3.7 requires a new package Libffi-devel#yum install Libffi-devel-y #make Install //retry//successfully installed pip-9.0.3 setuptools-39.0.1 Successful Installation
Post-installation configuration
Bin file:
#vim/etc/profile.d/python3.sh path= $PATH:/usr/local/python3/bin//Restart for the changes to take effect
Library files:
#vim/etc/ld.so.conf.d/python.conf /usr/local/python#ldconfig-v //load the modified configuration and check if the Python3 library file is loaded in
Header file:
#ln -S/usr/local/python3/include /usr/include/python3 //link to library files
Help information:
#vim/etc/man_db.conf manpath_map/usr/local/python3/bin/usr/local/python3/share/man//Restart for the changes to take effect
Detection:
#vim test.py #!/usr/bin/env python3 print ("Test successful! ") #chmod +x test.py#./test.py>>>test successful!
Compile source code installation software under CentOS (for example, install Python3)