Linux Package Management

Source: Internet
Author: User

In the previous chapter, I wrote a preliminary script, and this chapter of course went on to script. Why is the title so strange? Because we are OPS personnel, we do not write programs, we are just procedures for porters. Since is the use of the program that we are essential, need to understand the type of program, program compilation, program management.

Type of a program

the script is a program, but the program is special. The script needs to use an interpreter, and each command needs to be translated into machine instructions in real time. And the program is compiled in advance, using the time directly to carry out, directly to the CPU can be sent. In addition, there are some wonderful programs, but also the most current use of the program. The great God who directly writes machine instructions skips directly.

1 pre-compiled programs, this language is primarily designed to solve the most common problems of the language with the machine to interact with the most programs. This kind of procedure is particularly able to squeeze the performance of the machine, but their writing is particularly difficult.

the second most is assembly language, then c,C + +,go, etc.

2 Real-time compiled programs, the performance of this program is generally not high, they are not born to write large programs, but to solve real life, encountered some repetitive work.

There's python, shell, etc.

3 Wonderful Java

At the beginning of Java design, I had a philosophy that my program would run on all platforms. Its main purpose is to get through the big platform procedures are not common pain points. So he has to have a feature that makes the interfaces of different platforms the same. Based on this feature,Java creates a thing-a virtual machine. Implement code execution inside the virtual machine. the Java code, when compiled, does not have to be based on a platform to compile, then it needs to compile the code into the virtual machine can be executable instructions. This also leads to its performance is not very good.

Management of two programs

This half-day pulled a bunch and we have a dime relationship has no skin, in fact, very useful. When we install the program, we first need to understand what the program we use, we can better use.

we want to use a program, we need to do, download the program's source package and then compile, good trouble. Recalling the installation of Windows program I am basically the next step in accordance with the good, there is no compilation process Ah, in Linux also has this mechanism, by others compiled the program, we directly put it in the directory directly to use. when installing programs in Windows, especially the Windows components, we just want to install a program, but Windows prompts that it needs to be installed before the program can run.

no more wrangling, dry. There are three ways to install programs in Linux (simple partitioning): Compile and install,rpm,yum.

1RPM installation, which is used by someone else to compile the program, we download good, unzip into a specific directory, and then we use.

Options for installing Rpm [option] packages       option         -v                   Display the installation process        -h                   Show progress bar        -i                    installation,        --scripts     We need some configuration when we install green files, sometimes we need to configure them after installation. Some RPM packages have some preparation scripts, we can force RPM installation to not let the script run, the script is divided into pre-installation script--nopre, post-installation script--nopost, generally not used         -U                 Upgrade Procedures, Without the program by default installation, generally not recommended upgrade, the best two versions of co-exist        -F                   upgrade program, no        --replacepkgs not installed             Reload program only, do not change configuration file         --replacefiles             Full Reload program         --oldpackages           Downgrade        -e                                  Uninstall        --force                         forced installation (caution)


The various stewards in Windows, the tools to manage our programs are very useful. rpm comes with this function, it is similar to the Windows Program Management program, no RPM -installed program, although it can be used, but rpm does not know the existence of the program, because, rpm Saves the program's information to a file in the/var/lib/rpm/directory (which I don't remember) every time a program is installed. Parameters for querying program information

-q                  According to the package name can be detected, installed package version information        -qa                 list all installed packages, with grep, we can skillfully find the package we want         -ql                  Lists the paths to all files for an installed package        -qd                 list documents for installed packages        -qc                 list profiles for installed packages         -p                   List the package (where the package is the path to the package) and use        --provides with the above commands            list the capabilities of this package rpm2cpio  package file |cpio –itv            Preview in-Package files rpm2cpio  package files |cpio –id            " *.conf"   release in-Package files


2Yum

Yum installation, this method of installation is extremely simple, especially in the Centos7 can complete the installation package name, this is too much, so powerful how to do it. It is run based on rpm and is also an annoying dependency problem in the RPM installer.

How does Yum solve the packet dependency problem? Yum First builds all the packages into a database of similar indexes and stores the information for all packages in a directory in the subdirectory of the directory repodate . When installed, the automatic traversal of the database solves the dependency problem. However, this is not enough to meet our lazy pursuit, sometimes we need the package may come from two different agencies of the site, what, we have all the package of Web sites organized into the/etc/yum.repo.d/ directory, the installation program directly through all the sites. files in the/etc/yum.repo.d/directory are configuration files as long as the. Repo ends. The format of the configuration file is as follows:

[reponame]name=baseurl=gpgkey=gpgcheck=enabled=cost=

first say install,yum installs packagename [option] so you can install the package.

Options for        option        -y                           Confirm Installation        --disablerepo     Temporarily disable a repo       --enablerepo      temporarily enable a repo        --noplugins        Disable all plugins         whatprovides      packages that provide this feature         list                         List Packages        seach        repolist       groplist        update       upgrade       groupinstall        groupinfo       history        available,installed,


Compilation of three programs

compilation is a Brainiac, the compilation method is divided into two kinds, static compilation and dynamic compilation. First of all, static compilation, static compilation is all the code is provided by their own programs, compiled can be run independently. The dynamic compilation itself only provides a part of the code, this part of the code is based on a number of public programs written, such as the public program such as subtraction, such as the basic code, each time have their own write more trouble, and the use of particularly large, we have these programs into a public program, put in a good place, Called directly when used.

since there are two ways to compile, that's better. It is hard to say, statically compiled program performance is absolutely first-class, because the program runs when all the instructions are in a process, completely use no system calls, system call is like working in a large company, advance salary needs layers of approval, small companies see leadership every day, know everything want to pay easily. But each program's code is independent, the code is inevitably a lot of repetitive code. In the hard disk this situation is not very obvious, to the memory of this contradiction is more prominent, dynamic compilation, we share the same code block, memory usage will be much less.

before compiling the computer to install the compiler GCC and the associated components,Linux takes this component command as development Tools.

the process of compiling the program

1, unzip and enter the source package 2,./configure [option] option parameter can be--help to see how the parameters are used. 3, make this step is to perform the compilation, it takes more time, the compiled file will be generated in the current directory 4, makes install the compiled file, install to the specified directory 5, edit $path Change Volume 6, Export the library file/etc/ld.so.conf.d/name.conf7, export the header file Ln-s Azdir/usr/lib/dir
Summarize

The hypervisor rpm and Yum can basically meet our needs. This section focuses on the types of programs, the pros and cons of program compilation types, and the two package management tools rpm and yum.


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1877020

Linux Package 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.