Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Yum of learning notes and package compilation

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Yum usage

Background: because there are some problems in the implementation of package management in RPM packages, such as some dependencies in packages, these must be solved manually, although some relationships can be ignored and installed using-- nodeps, but this will lead to abnormal program functions after installation, so in order to better solve this relationship, it is very troublesome to solve this relationship manually. So there is a tool yum that is higher than rpm management to implement, so let's take a closer look at the use of yum.

Pre-school notes:

Yum and dnf are good tools for centos series.

What is Yum? The dependencies can be resolved automatically at the front end when installing the program. Yum is actually a tool for cs architecture, and y um is a client

YUM: yellow dog, Yellowdog Update Modifier

Yum repository: the yum repo component, called the yum repository

Yum repository: stores many rpm packages and related metadata files for packages (placed in a specific directory: repodata)

The location of the Repodata directory should be the path that the warehouse points to.

File servers supported by yum: services can be provided through the following servers

Ftp://

Http://

Nfs://

File:/// (local)

Yum client:

Configuration file:

/ etc/yum.conf: provide common configuration for all warehouses

/ etc/yum.repos.d/*.repo: provides configuration for pointing to the warehouse

The definition of the warehouse point:

[repositoryID]

Name=Some name for this repository

Baseurl=url://path/to/repository/

Enabled= {1 | 0}

Gpgcheck= {1 | 0}

Gpgkey=URL

Enablegroups= {1 | 0}

Failovermethod= {roundrobin | priority}

The default is: roundrobin, which means random selection

Cost=

The default is 1000

Usage of the yum command:

Yum [options] [command] [package...]

Command is one of:

* install package1 [package2] [...]

* update [package1] [package2] [...]

* update-to [package1] [package2] [...]

* check-update

* upgrade [package1] [package2] [...]

* upgrade-to [package1] [package2] [...]

* distribution-synchronization [package1] [package2] [...]

* remove | erase package1 [package2] [...]

* list [...]

* info [...]

* provides | whatprovides feature1 [feature2] [...]

* clean [packages | metadata | expire-cache | rpmdb | plugins | all]

* makecache

* groupinstall group1 [group2] [...]

* groupupdate group1 [group2] [...]

* grouplist [hidden] [groupwildcard] [...]

* groupremove group1 [group2] [...]

* groupinfo group1 [...]

* search string1 [string2] [...]

* shell [filename]

* resolvedep dep1 [dep2] [...]

* localinstall rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use install)

* localupdate rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use update)

* reinstall package1 [package2] [...]

* downgrade package1 [package2] [...]

* deplist package1 [package2] [...]

* repolist [all | enabled | disabled]

* version [all | installed | available | group-* | nogroups* | grouplist | groupinfo] * history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats]

* check

* help [command]

Display a list of warehouses:

Repolist [all | enabled | disabled]

Display the package:

List

# yum list [all | glob_exp1] [glob_exp2] [...]

# yum list {available | installed | updates} [glob_exp1] [...]

Install the package:

Install package1 [package2] [...]

Reinstall package1 [package2] [...] (reinstall)

Upgrade package:

Update [package1] [package2] [...]

Downgrade package1 [package2] [...] (demoted)

Check for available upgrades:

Check-update

Uninstall the package:

Remove | erase package1 [package2] [...]

View the package information:

Info [...]

To see which package the specified feature (which can be a file) is provided:

Provides | whatprovides feature1 [feature2] [...]

Clean up the local cache:

Clean [packages | metadata | expire-cache | rpmdb | plugins | all]

Build the cache:

Makecache

Search for:

Search string1 [string2] [...]

Search for package name and summary information with specified keywords

View the capabilities on which the specified package depends:

Deplist package1 [package2] [...]

View yum transaction history:

History [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats]

Install and upgrade local packages:

* localinstall rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use install)

* localupdate rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use update)

Commands related to package group management:

* groupinstall group1 [group2] [...]

* groupupdate group1 [group2] [...]

* grouplist [hidden] [groupwildcard] [...]

* groupremove group1 [group2] [...]

* groupinfo group1 [...]

How to use CD as a local yum repository:

(1) Mount the CD to a directory, such as / media/cdrom

# mount-r-t iso9660 / dev/cdrom / media/cdrom

(2) create a configuration file

[CentOS7]

Name=

Baseurl=

Gpgcheck=

Enabled=

Command line options for yum:

-- nogpgcheck: gpgcheck is prohibited

-y: automatic answer is "yes"

-Q: silent mode

-- disablerepo=repoidglob: temporarily disable the repo specified here

-- enablerepo=repoidglob: temporarily enable the repo specified here

-- noplugins: disable all plug-ins

The variables available in the repo configuration file of yum:

$releasever: the major version number of the current OS release

$arch: platform

$basearch: basic platform

$YUM0-$YUM9

Http://mirrors.aliyun.com/centos/$releasever/$basearch/os

Create a yum repository:

Createrepo [options]

Package compilation and installation:

After testapp-VERSION-release.src.rpm-- > installation, use the rpmbuild command to make the rpm package in binary format, and then install it

Source code-- > preprocessing-- > compilation (gcc)-- > assembly-- > link-- > execution

Source code organization format:

Multiple files: there are likely to be cross-file dependencies between the code in the file

C, Clearing: make (configure-- > Makefile.in-- > makefile)

Java: maven

C code compilation and installation three steps:

. / configure:

(1) pass parameters through options to specify the enabled feature, installation path, etc. During execution, you will refer to the user's assignment and Makefile.in file to generate makefile.

(2) check the external environment on which it depends

Make:

Build the application based on the makefile file

Make install

Development tools:

Autoconf: generate configure script

Automake: generate Makefile.in

Recommendation: check INSTALL,README before installation

Access to source code of open source programs:

Official self-built site:

Apache.org (ASF)

Mariadb.org

...

Code hosting:

SourceForge

Github.com

Code.google.com

C _ blank: gcc (GNU C Complier)

Compile the C source code:

Premise: provide development tools and development environment

Development tools: make, gcc, etc.

Development environment: development libraries, header files

Glibc: standard library

Provide development components through "package groups"

CentOS 6: "Development Tools", "Server Platform Development"

Step 1: configure script

Options: specify installation location, specify enabled features

-- help: get the options it supports

Option classification:

Installation path setting:

-- prefix=/PATH/TO/SOMEWHERE: specify the default installation location; default is / usr/local/

-- sysconfdir=/PATH/TO/SOMEWHERE: configuration file installation location

System types:

Optional Features: optional featur

-- disable-FEATURE

-- enable-FEATURE [= ARG]

Optional Packages: optional package

-- with-PACKAGE [= ARG]

-- without-PACKAGE

Step 2: make

Step 3: make install

Compile the files generated after the installation is complete:

Configuration after installation:

(1) Export the binary program directory to the PATH environment variable

Edit file / etc/profile.d/NAME.sh

Export PATH=/PATH/TO/BIN:$PATH

(2) Export the path of the library file

Edit / etc/ld.so.conf.d/NAME.conf

Add the directory where the new library file is located to this file

Have the system regenerate the cache:

Ldconfig [- v]

(3) Export header file

A link-based approach to:

Ln-sv

(4) Export help manual

Edit / etc/man.config file

Add a MANPATH

You can try and practice more.

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report