May 24, 2021 That's what Linux should learn
As discussed in Chapter 1 of this book, before the add technology of RPM (Red Hat Package Manager), Linux system operators could only install various service programs by means of source packs, which was a very cumbersome and time-consuming and patient thing, and that the interdependence with other programs or libraries was taken into account when installing, upgrading, and uninstalling programs, which required operators not only to have more knowledge of Linux system theory and high practical skills. I t also requires excellent patience to install a source package. C onsidering that the readers of this book are new or ready to get started, this book has always been about installing service programs in the yum repository in the previous chapters. H owever, there are still a lot of software programs only in the form of source packages, if we only use the Yum software repository way to install programs, then in the face of these only source packages of software programs, will be full of powerlessness, either need to wait until a third-party organization to write these software programs into RPM packages before using, or can only look for alternatives to the relevant software programs (and alternative software must also have RPM package form). Thus, if the operations personnel will only use Yum software warehouse to install the service program, it will form a knowledge board, which will bring disadvantage to the future operation and operation work.
In the spirit of not allowing their readers in the operation of the work of the idea, Mr. Liu Wei will then explain in detail how to use the source code package to install the service program.
In fact, there are two advantages to using a source package to install a service program.
The source package is very portable and can be installed and used in almost any Linux system, while the RPM package is a set of instructions written for a specific system and architecture and must be strictly compliant with the execution environment to be installed successfully (i.e., only "hard" installation service programs are required).
Installing a service program using a source package has a compilation process, so you can better adapt to the system environment of the installation host, which is more efficient and optimized than the service program installed with the RPM package. That is, you can think of installing a service program with a source package as a "tailoring" for the system.
In general, when installing software, if you can install it through the Yum software repository, use Yum, and instead look for a suitable RPM package to install, and if there are no resources available, you can only use the source package to install it.
The process of installing a service program using a source package may seem complicated, but it only takes 4 to 5 steps to complete the installation after the summary is summarized. Mr. Liu will explain each step in detail next.
It needs to be explained in advance that when using the source package installer, a large amount of process information will be output, the significance of this information is not great, so this chapter will omit this part of the output information without special notes, please take the specific operation to the actual.
Step 1: Download and unzim the source package file. T o facilitate transmission over the network, source package files are typically compressed in formats such as gzip or bzip2 after archiving, so they typically have a suffix of .tar.gz and .tar.bz2. To install a service program with a source package, you must first unziw the contents of the package and then switch to the directory of the source package file:
[root@linuxprobe ~]# tar xzvf FileName.tar.gz
[root@linuxprobe ~]# cd FileDirectory
Step 2: Compile the source package code. B efore you can formally use the source package installation service program, you also need to use compilation scripts to perform a series of evaluations of the current system, including examining the source package files, dependencies between software, and libraries, compilers, assemblers, and connectors. W e can also append the --prefix parameter as needed to specify the installation path for the source package program later, making the installation process of the service program more controllable. When compilation is complete, if the system environment meets the installation requirements, a Makefile installation file is typically automatically generated in the current directory.
[root@linuxprobe ~]# ./configure --prefix=/usr/local/program
Step 3: Build a binary installer. The newly generated Makefile file saves content such as system environments, software dependencies, and installation rules, and you can then use the make command to compile the binary executable that is truly available for the user to install the service program based on the appropriate rules provided by the Makefile file content.
[root@linuxprobe ~]# make
Step 4: Run a binary service program installation package. R unning a binary service program installation package should be the fastest step, since there is no need to check the system environment and no longer need to compile code. If the --prefix parameter is used during the source package compilation phase, then the service program will be installed in that directory, and if the directory is not defined by parameters itself, it will generally be installed in the /usr/local/bin directory by default.
[root@linuxprobe ~]# make install
Step 5: Clean up the source package temporary files. Because of the code compilation work done during the installation of the service program, many temporary junk files are left behind in the post-installation directory, and the make clean command can be used to clean up the temporary files thoroughly, in line with the principle of minimizing disk storage space.
[root@linuxprobe ~]# make clean
It is estimated that some readers will have questions about why it is usually the installation of a service program, the compilation of the source package (configure) and the production of binary files (make) will take so long, and the installation of RPM packages is particularly efficient? I n fact, the reason is very simple, in the RHCA-certified RH401 exam, candidates will be required to write an RPM package. I n the advanced part of this book, Mr. Liu will say that in fact, the RPM package is the software's source package and a specific system, architecture, environment-specific installation provisions package packaged together, so in order to allow users to use this package to install programs, usually a software program will release a variety of formats of RPM software packages (such as i386, x86_64 and other architectures) to let users choose. And the source package software author certainly hope that their software can be installed on more systems, can be more users understand, use, so will be in the compilation phase (configure) to check the user's current system situation, and then work out a feasible installation plan, so it will take up a lot of system resources, need longer waiting time.
Have a problem? Ask bold questions!
Because readers have different hardware or operation errors may lead to experimental configuration errors, please be patient and take a closer look at the operation steps, do not be discouraged
Linux technical exchange please add Group A: 560843 (full), Group B: 340829 (recommended), Group C: 463590 (recommended), click here to view the national group.
This group features: through password verification to ensure that each group member is "Linux should learn" readers, more targeted, from time to time free to receive customized gifts.