The installation process

Windows software installation process

  • Creates the installation directory in the user-specified installation directory
  • Copies of the relevantdllDynamic library to installation directory
  • copyexeExecutable files to the installation directory
  • Copy the configuration file to the installation directory, such as WindowsiniThe configuration file
  • Puts the startup configuration or program dependent configuration into the registry
  • If it is a service, register and start the service

The general process of installing Linux software

  • Setting up the installation directory
  • Copy the class library
  • Copy executable files
  • Selectively configure and start services as required

Pay attention to

  • On Linux/usrDirectories are equivalent to WindowsProgramFiledirectory
  • The dynamic library suffix on Linux is.soThe one above window is.dll

Compile the installation

What is compilation

Programs written in high-level languages are translated into machine language by compilers. Some compilers convert high-level language programs directly into assembly language and then use an assembler to convert them into machine language. A step that is often used with compilation is linking, and the advantage of linking is that this is shared by multiple programs. Libraries contain multiple routines, each implementation of which is a common task that can be shared by many programs. Linker programs in /usr/lib and /usr/lib can link the compiler’s output to the library required by the compiler. The end result of this operation is an executable file that can be used.

  • Distribution self-installed source code is generally installed with/usr/srcdirectory
  • Source code for multi-user use is generally installed in/usr/local/srcIn the directory
  • Default compiler, four stages of GCC compilation (preprocess-compile-assembler – link)

Download unzip source code

  • Software is generally written in C or C ++, generally can be found on the software official website, using WGET for download
  • The download format is.tar.gz or.tar.baz2
  • After decompression, there is a README file in the file. This file describes the software’s capabilities, licenses, installation requirements, installation precautions, installation methods, and so on

Analyzing the Installation Environment

Software after decompression, enter the directory after decompression, generally exist the configure the file, the file is a shell script, his task is to analyze production, under Linux software installation is affected by the operating system installation environment, such as some software in the process of installation or operation of library files need to invoke the operating system itself, Or you need to run a tool on the system, etc., but the library file does not exist on the system or the tool is not installed, then installing or running the software will fail. To avoid this problem, you need to analyze the operating system environment during software installation to check whether the current system has all the files and tools required for software installation. If the system lacks a file, it will give a prompt until all the requirements of the software are met. This is the function of the configure file, which is usually an executable file. You can test the environment of the software installation by typing “./configure “in the current directory. Typically, source code installation requires a GCC or CC compiler, which is usually under the development tools option in the custom installation package when installing the system. In fact, this is why we will choose the development kit in Chapter 2 of Installing Linux. Typically, when configure finishes running, several new files are created in the source directory, the most important of which is the Makefile. A Makefile is a configuration file that instructs a make command how to generate an executable program, without which the next make command side cannot be executed. In addition, during the configure analysis of software requirements, options such as the software installation path and required modules can be added after “./configure “to customize software functions required by users. For example, when installing nginx:

  • –prefix=PATH: Specifies the nginx installation directory. The default/usr/local/nginx
  • –conf-path= path: Sets the path to the nginx.conf configuration file. Nginx allows you to start with different configuration files, via the -c option on the command line. The default for the prefix/conf/nginx. Conf
  • –user=name: Sets the user name of the nginx worker process. After installation, the user directive can be changed at any time in the nginx.conf configuration file. The default user name is nobody. – group = similar name
  • –with-pcre: set the source path of the pcRE library. If you have installed the pcre library via yum, use –with-pcre to automatically find the library file. -* -with-pcre=PATH -* -with-pcre=PATH -* -with-pcre=PATH -* -with-pcre=PATH -* -with-pcre=PATH Perl regular expressions are used in the location directive and the ngx_HTTP_rewrite_module module.
  • –with-zlib=PATH: specifies the source decompression directory for zlib (version 1.1.3-1.2.5). Zlib is required for the network transport compression module ngx_HTTP_gzip_module, which is enabled by default.
  • — with-http_SSL_module: uses the HTTPS protocol module. By default, this module is not built. Prerequisites OpenSSL and OpenSSL-devel have been installed
  • –with-http_stub_status_module: used to monitor the current status of Nginx
  • — with-http_realiP_module: This module allows you to change the value of the client’s IP address in the request header (such as X-real-IP or X-Forwarded-for). This module enables the backend server to record the original client’s IP address
  • –add-module=PATH: Add a third-party external module, such as nginx-sticky-module-ng or cache module. Recompile every time you add a new module (Tengine can add a module without recompiling)

Compile the installation

The first step is compilation. Use the make command to automatically compile all source code files from the Makefile. This process is called building, and incremental compilation can be done. The packaged source code typically includes a special make target program, Install, that will install the resulting executable in the system directory, usually /usr/local/bin (if not specified).

  • Make clean: Deletes temporary files generated during compilation and configuration.
  • The Makefile tutorial: http://www.ruanyifeng.com/blog/2015/02/make.html

Uninstalling compiled installed software (best practice)

Generally, it is not recommended to compile and install the software using source code. If the software has RPM packages, do not install the software using source code

  • The installation
    • If you specify an installation directory during installation, delete the specified directory (best practice)
    • If installed at /usr/*, you can do thismake installMake uninstall, make distclean, make veryclean, etc
    • However, not every source code provides an uninstall command. If you do not have an uninstall command, you can use the following command
  • With the help ofcheckinstallGenerate an RPM package and install it
    • Install checkinstall
      • The installation address: http://asic-linux.com.mx/~izto/checkinstall/download.php
      • Error: http://www.361way.com/rpmbuild-checkinstall/3251.html
    • Uncompiled source code is packaged to generate RPM packages, which are then managed using RPM.
      • . / configure
      • Run the make command
      • Execute checkInstall to create an RPM package as prompted
      • Enter the ms-sys command to test whether it is available
    • The following uses are used according to RPM specifications

RPM command installation software: low-level tool for installing and deleting software package files

Man yum yum yum yum yum yum yum yum yum yum yum yum yum yum I’ll link to two excellent posts on how to use two commands.

RPM packages are classified into Binary, Source, and Delta packages. Binary packages can be installed directly on the computer, while source packages are automatically compiled and installed by RPM. Source code packages are often suffixed with.src and.rpm. In fact, when you have the source code can generate various types of packages, RPM package is just one of them, such as the above we use the checkinstall command to generate RPM package.

Yum installation software: metadata search and advanced dependency resolution tools

The purpose of Yum is to automatically upgrade, install/remove RPM packages, collect information about RPM packages, check dependencies, and automatically prompt users for resolution. The key of YUM is to have a reliable repository of software. It can be an HTTP or FTP site, or a local software pool, but it must contain the RPM header, which contains information about RPM packages, including descriptions, functions, provided files, dependencies, etc. It is collecting these headers and analyzing them that automates the rest of the tasks. It can automatically download and install RPM packages from a specified server, automatically handle dependencies, and install all dependent software packages at one time without tedious downloading and installation. You can also do the yum server yourself, you can do the YUM server according to the CD-ROM image.

Reference documentation

  • Four Linux installation methods, RPM and yum are better
  • Linux Command Line Complete
  • Linux software installation method