Software Management for Linux-installation, uninstallation, upgrade, and dependency management

Source: Internet
Author: User
Tags centos server

1. Comparison: Installation and uninstallation of software on Windows and Linux

Just like under Windows, many of the software also has the same installation version as the free-to-install version, which is also different under Linux.
Installation software under Windows requires Administrator privileges during installation, it adds information about itself in the registry of the system, and may add some files to certain parts of the system. Typically, such software provides a file named under the installation directory uninstall.exe , which reverses the installation operation. (The problem here is, is this uninstall.exe really going to unload the software?) So there are a variety of problems. )
In contrast, the Linux package management tool, (common with apt-get/dpkg yum/rpm) also requires root permissions, the installation will be software dependencies, installation location and other information written to a place, the uninstall will perform the installation of the reverse operation, but generally only uninstall the software itself, but not uninstall dependencies. If you use Apt-get, you need to use the Autoremove option, which will also automatically unload dependencies when uninstalling. (This is the case for installing and downloading the Deb rpm offline installation from the Software warehouse)

Without installing software, Windows and Linux are similar. Only need to extract the software (download good software should be tar.gz or zip format, need to extract), it can be used directly. Linux should start as a startup script in the Bin directory, and on Windows, it is generally the same name as the software EXE program in the installation directory.

Free installation software requires users to remember the installation location, to delete the time, directly delete the extracted folder will be OK. (If you are using a program, it has not performed any other actions.) )

Windows has a large user base, the most popular version of the installation software, which allows users to manage their own installed software. and Windows software system compatibility is particularly good, the software compiled on Xp ten years ago, it is likely to still be able to run smoothly in the latest Win10. (This is also the situation is forcing, on Windows, it is almost impossible for ordinary users to compile from the source code, so developers have no choice but to publish EXE format.) )
Linux is an open-source operating system, so the default cannot contain any non-open source software. If this type of non-open source software is required, users can install it themselves. The software of the Linux department has the following features:

    1. Linux Department of Open source software, if the user base is small or updated quickly, may only release the source tarball, need to compile the installation itself , will not publish the platform of the compiled version. Even if you have a compiled version, you may only provide deb RPM as a large user base, and may not be updated in a timely manner. (The Linux community advocates open source, which is very different from WIndows.) But this also makes the Linux software installation process is criticized by people)
    2. The large business software of the user base, such as the JetBrains system, publishes only the generic binary tar.gz package, which is the free-to-install version, while the Oracle JDK publishes only tar.gz and RPM. (probably considering a lot of CentOS server useful JDK)
    3. User group large open source software, will generally provide tar.gz source code and binary.tar.gz.

To summarize, Linux, the generic installation package seems to be popular, and the installation package can only be used for a specific distribution, not too pleasant.
Most of the use of Linux is a programmer, so the source code version is also very popular. Installation from the source of more freedom, compiled programs can also be specific to their own computer, save a lot of compatibility of things. In short, it is quicker and more refreshing.

The following three kinds of cases, respectively, discuss the installation of software, uninstall.

2. Free binary tarball

This package is generally tar.gz or TAR.XZ format, after decompression, CD to the bin directory, there will be a script or executable with the same name as the software, run it directly to start the software. And this kind of package seems to be able to be used in the hair version of the general (eg. Pycharm Nodejs jdk etc.)
In general, after installing the software on Linux, we want to be able to launch it directly in the shell. To do this, you need to first understand the Linux Shell environment variable configuration file

    • Global Environment
      • /etc/profile the shell environment Profile of the system (only once per user login , no modification is recommended)
      • The Bash Shell environment configuration file for the/ETC/BASH.BASHRC system, which is loaded each time a new bash is opened. Modify this if you need a bash environment that is in effect for all users)
    • User Environment
      • ~/.profile [or possibly ~/.bash_profile] user's personal shell environment profile, equivalent to/etc/profile's personal patch. In general, it sets some user's personal environment variables and then executes ~/.BASHRC.
      • ~/.BASHRC User's personal bash Shell profile (also loaded every time a new bash is opened)
    • Source: Executes the specified shell script in the current shell. Often used in environmental profiles. (In doing so, the running variables will be present in the current shell, and the so-called environment settings have been completed.) And if it is normal to run directly, the new shell will be enabled to run the script, run the end of the environment is destroyed. )

From the above configuration file extension, when the user installs the binary tarball, there are usually two ways :

    1. One is to add the bin directory of the software to the path (which causes all executables in the bin directory to be added to path, if you do not want to, consider the second method), which is to write the relevant commands to the shell configuration file. As for where to add, read the above instructions, you should already understand.

      For example, when installing a software, if the software is used by everyone, it should be written into the system configuration, and then if you basically only use bash, write BASHRC more convenient (change can take effect immediately), otherwise select profile.
      And if only you personally need the software, be sure to put in the user configuration, and then consider whether you use other shells. Generally put BASHRC in the total no problem, and put in the profile, sometimes need to manually source /etc/profile to use.

    2. The second is to add a startup script to those directories (for example,/usr/local/bin) that will be included in the path by default. (written in Python or shell) The JetBrains home software prompts you to do this when it detects that the bin directory for the software is not added to PATH. (Idea will add a Python startup script called Idea to/usr/local/bin.)

And if the JDK is the software that needs to configure the environment variables, then you need to manually configure Java_home, Classpath, and so on.

3. Installing with the installation package

This is similar to the installation package for Windows, but the installation package can only be used for specific distributions, because different distributions use different package mechanisms. The most common are dpkg and RPM, which also have a corresponding online installation mechanism, namely apt-get and Yum.
Cond

4. Compiling the installation from the source code

Compiling the installation benefits from the source has been said to be more freedom, fewer compatibility issues, and higher performance. The disadvantage is that the compilation is troublesome, and the installation of good software is not good management.

GCC compilation kit (compile + link)

When it comes to compiling, it's generally a C + + source code, and before detailed instructions, here are some catalogs that need to be introduced first.

    • /lib,/lib64: Shared link library, including static link library *.a, and dynamic link library *.so. When you compile with GCC, the required link libraries are queried from here by default. The link libraries not listed need to be used -l单个链接库 or -L/链接库所在文件夹 specified.
    • /usr/include: The system header file is saved, and when you compile with GCC, the system header file is queried from here by default. The header file directory that is not listed needs to be used -I/头文件所在文件夹 to specify (uppercase I)
Make Software Build tool

When the software becomes large, it becomes less realistic to manually call GCC again and again. This is the time for the computer to automate the process of compiling the project, and make is born, and it relies on Makefile. (If the project becomes larger, even handwriting makefile becomes difficult, then CMake appears.) CMake is used to automatically generate makefile, it relies on CMakeList.txt)
However, the popular open source software, Makefile.txt generation rules have already written in configure, all you need to do is

./configuremakesudo make install

If you are using CMake, then cmake . replace it with the ./configure line. (sometimes in order to isolate the compilation of related files and source code, will create a build folder, and then run within that folder cmake .. )

That being said, it is necessary to install the necessary dependencies before compiling, or you ./configure will get an error in this step. to install a software from the source, the most painful is not in make, but in processing dependencies. If this depends on the installation can also be automated ...

Removal of source code installation software

Software installed from the source has many advantages, but the management of the software is a bit cumbersome. First of all, many software authors do not provide the corresponding make uninstall commands, so uninstalling the software is not universal.
After using the make install software installed, be sure to remember the backup installation generated install_manifast.txt , and then delete the source code. (This file will generally have write protection)
After that, if you need to uninstall, just do it xargs rm < install_manifest.txt .

Can create a backup directory, dedicated backup and system-related information,/etc and the above Install_manifest.txt (proposed renamed "Software name _install_manifest.txt" ") can be counted as such.

Reference
    • 21st chapter, Software Installation: The original code and the Tarball
    • How do I uninstall the software installed with make install?

Software Management for Linux-installation, uninstallation, upgrade, and dependency management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.