One minute package management tool, take installing jdk as an example (centos, ubuntu, alpine, python pip, node)

Keywords: pip Java JDK yum

One sentence to explain what package management tools are

It's Android's app store.

Each major distribution of linux comes with its own package management tools. Now take installing jdk as an example to illustrate their command-line usage.

ubuntu 14.04 (dibian system)
root@552b680ba26a:/# apt update                                         # Update packages (not upgrades)                                                
root@552b680ba26a:/#               
root@552b680ba26a:/# apt search jdk                                     # Search package
root@552b680ba26a:/# apt install -y openjdk-7-jdk                       # install
root@552b680ba26a:/# java -version && javac -version                    # test
java version "1.7.0_181"
OpenJDK Runtime Environment (IcedTea 2.6.14) (7u181-2.6.14-0ubuntu0.2)
OpenJDK 64-Bit Server VM (build 24.181-b01, mixed mode)
javac 1.7.0_181
root@552b680ba26a:/# # You can see that `java'and `javac' have both added path s
root@552b680ba26a:/# apt remove openjdk-7-jdk                           # uninstall
centos 6.8 (redhat system)
[root@fef5edd89687 /]# yum upgrade                                      # To update
[root@fef5edd89687 /]# yum search java | grep openjdk                   # search
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
...
[root@fef5edd89687 /]# yum install -y java-1.8.0-openjdk-devel.x86_64   # install
[root@fef5edd89687 /]# java -version && javac -version                  # test
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
javac 1.8.0_181
alpine 3.5
/ # apk update                                                          # To update
/ # apk search jdk                                                      # search
/ # apk add openjdk8                                                    # install
/ # java -version && javac -version                                     # test
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (IcedTea 3.8.0) (Alpine 8.171.11-r0)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
sh: javac: not found                                                    # javacerror 
/ # apk del openjdk8                                                    # uninstall
summary

apt, yum, apk
These three commands correspond to the package management tools of the above distributions, and they use the same routine.
In use, it may be found that the package management installation software version is relatively old, just as ubuntu 14.04 can only search jdk7 above, many times you can add software sources to obtain new versions, which is another issue that will not be discussed here.
In addition, the package names of the same software may be different in different systems, such as apt's openssh-client and yum's openssh-client s, which differ by 1 s.

In addition, some programming language development environments also have package management tools.
For example, NPM of nodejs, pip of python, gem of ruby and mvn of Java are also included.
Some of the more practical ones are
1.npm can install n, then upgrade node JS version through n, eg:

npm install -g n                                                        # npm install n
n stable                                                                # Latest stable version
n version                                                               # Specified version

2.phthon can install the PIP tool module through get-pip.py script. The old version of PIP upgrade is also very simple.

$ wget  --no-check-certificate  https://bootstrap.pypa.io/get-pip.py && python  get-pip.py         # Install pip                     
$ python -m pip install -U pip                                                                                                     # Upgrade pip

3.ruby installs gem, which can then be used to install the sass compiler.

Posted by solee on Sun, 03 Feb 2019 19:09:16 -0800