In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Linux system source software installation steps", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux system source software installation steps" bar!
Specific steps for installation:
_ _ FCKpd___0nbsp;tar zxvf XXXX.tar.gz (or tar jxvf XXXX.tar.bz2) _ FCKpd___0nbsp;cd XXXX___FCKpd___0nbsp;./configure___FCKpd___0nbsp;make# make install___FCKpd___1nbsp;make clean
Used to clean up temporary files after installation
# make uninstall
Used to uninstall the software
Decompress:
There are two most common source packages (XXXX.tar.gz or XXXX.tar.bz2). In fact, these source packages are compressed by two tools. The tools used in the files at the end of tar.gz are tar and gunzip, while those at the end of tar.bz2 are tar and bzip2. The reason for this is that tar can only package multiple files but does not have the function of compression, while gz and bz2 are just the opposite. Only a single file can be compressed, so our common source code package is actually packaged with different source files through tar, and then released after compression through gunzip or bzip2. Of course, these two steps can be implemented with one command:
_ FCKpd___2nbsp;tar zcvf XXXX.tar.gz XXXX (or tar jcvf XXXX.tar.bz2 XXXX)
The relevant commands for decompression are as follows:
_ FCKpd___3nbsp;tar zxvf XXXX.tar.gz___FCKpd___3nbsp;tar jxvf XXXX.tar.bz2./configure:
After the decompression is completed, the installation will officially begin (add one point, before starting configure, please use the patch tool to patch the source code if necessary). First jump to the decompressed directory of the source code. As we all know, you should carefully read the README or INSTALL files in the source directory before starting configure. Many installation precautions are listed here. Configure is actually a script file. Type ". / configure" in the current directory and shell will run the configure script in the current directory. It must be noted that in the whole configure process, compilation has not yet been carried out, and configure is only doing some preparatory work related to compilation. It mainly does some dependency checks on your current working platform, such as whether the compiler is installed and whether the connector exists. If there are no errors in the detection process, you are lucky. The configure script will generate another file, Makefile, to be used for the next compilation link in the current directory. Of course, configure supports and its rich command line parameters. You can type ". / configre-- help" to get specific information. Perhaps the most common one is:
_ _ FCKpd___5nbsp;./configure-- prefix=/opt/XXX
It is used to set the installation directory of the software.
Make:
If the configure process is completed correctly, then the corresponding Makefile file will be generated in the source directory. The Makefile file simply includes a set of file dependencies and the relevant steps of compiling links. In fact, the real compilation link work is not done by make. Make is just a general tool. In general, make will call the appropriate compiler to compile all the source code dependent on the current software according to the rules in Makefile. Generate all relevant object files, and then use the linker to generate the final executable program:
_ FCKpd___6nbsp;make
Make install:
When the above two steps are completed correctly, it means that the compilation link process is completely completed. The last thing to do is to install the executable program to the correct location. In this step, ordinary users may not have the permission to operate the relevant directories. Temporarily switching to root is a good choice. "install" is only a label in the Makefile file. "make install" means that the make tool performs all the relevant operations under the "install" label in the Makefile file. If you do not use "- prefix=/opt/XXX" to specify the installation directory of the application during the configure phase, then the application will generally be installed to / usr/local/bin by default. If / usr/local/bin already exists in your PATH, then the installation is almost complete:
# make install
Make clean:
Make uninstall:
These two steps are only the follow-up operations of the installation. It must be noted that "clean" and "uninstall" are also two corresponding labels in the Makefile file. When performing these two steps, the Makefile file must be retained. "make clean" is used to clear some temporary files in the process of compiling the connection. "make uninstall" is to uninstall related applications. Similar to make install, make uninstall also needs to switch to root for execution. However, the "uninstall" label has been omitted in many Makefile, and friends can check out the corresponding Makefile files for themselves.
Why?
Here I try to explain the reasons for the existence of the above steps. From the perspective of C language, the following parts of a program are essential from source code to the correct generation of relevant executables: source files, compilers, assemblers, connectors, dependent libraries. Through the above steps, friends should already know that there is only one step to actually perform the compilation link operation (make). So what is the reason for the other steps?
One thing is certain, I use C language to write some amusing Mini Program on my computer, and I don't use commands like "configure or make install". At most, I write a Makefile to manage the dependence on the source files, but the software developer is different, he must consider the portability of the software, and the software he develops can't just run on his own pc, right? Different platforms may even have different hardware architectures, which leads to the non-portability of Makefile. In order to solve this problem, developers usually use tools such as autoconf to generate corresponding configure scripts, while configure scripts are used to shield the corresponding platform differences so as to correctly generate Makefile files, and then make completes the compilation and link work according to the Makefile of configure.
As for "install or clean or uninstall", it only corresponds to the different rules in the Makefile file. Friends can consult the relevant documents for detailed information about Makefile.
An example
The following is the process of installing tar tools in source code on my PC, which can be regarded as a concrete example of the above steps
[root@localhost] # head-n 1 / etc/issueCentOS release 5.4 (Final) [root@localhost] # uname-srLinux 2.6.18-164.el5 [root@localhost] # gcc-- versiongcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) Copyright (C) 2006 Free Software Foundation, Inc.
This is my system information.
[root@localhost tools] # pwd/root/tools [root@localhost tools] # lstar-1.23.tar.bz2 [root@localhost tools] # tar jxvf tar-1.23.tar.bz2. [root@localhost tools] # lstar-1.23 tar-1.23.tar.bz2 [root@localhost tools] # cd tar-1.23 [root@localhost tar-1.23] # lsABOUT-NLS build-aux configure gnu Makefile.am po srcacinclude .m4 ChangeLog configure.ac INSTALL Makefile.in README testsaclocal.m4 ChangeLog.1 COPYING lib Make.rules rmt THANKSAUTHORS config.h.in doc m4 NEWS scripts TODO
Unpack the original package and find that it includes the configure script and the README file.
[root@localhost tar-1.23] # mkdir-v ~ / tarmkdir: created directory "/ root/tar" [root@localhost tar-1.23] #. / configure-- prefix=/root/tar. [root@localhost tar-1.23] # echo $?
Set up the software installation directory, and configure, check the result returned by configure. 0 means to run successfully.
[root@localhost tar-1.23] # ls-FABOUT-NLS ChangeLog.1 configure.ac M4 / po/ tests/acinclude.m4 config.h COPYING Makefile README THANKSaclocal.m4 config.h.in doc/ Makefile.am rmt/ TODOAUTHORS config.log gnu/ Makefile.in scripts/build-aux/ config.status* INSTALL Make .rules src/ChangeLog configure* lib/ NEWS stamp-h2
You can see that the Makefile file has been successfully created.
[root@localhost tar-1.23] # less Makefile | grep install: | {echo "ERROR: files left after uninstall:"; install: install-recursiveuninstall: uninstall-recursive
There are install and uninstall labels in the established Makefile
[root@localhost tar-1.23] # make. [root@localhost tar-1.23] # echo &?
Make succeeded
[root@localhost tar-1.23] # make install. [root@localhost tar-1.23] # ls / root/tarbin libexec sbin share [root@localhost tar] # cd / root/tar/bin [root@localhost bin] # lstar [root@localhost bin] #. / tar--help. [root@localhost tar-1.23] # echo &?
Installation and simple test were successful.
Thank you for reading, the above is the "Linux system under the installation steps of source software" content, after the study of this article, I believe you have a deeper understanding of the Linux system under the installation steps of source software, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.