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

How to use yum under Liunx

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you how to use yum under Liunx, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Yum command

Yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora and RedHat as well as in CentOS. Based on RPM package management, RPM packages can be downloaded and installed automatically from designated servers, dependencies can be automatically dealt with, and all dependent software packages can be installed at one time without tedious downloading and installation.

Yum syntax

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

Options: optional, options include-h (help),-y (when prompted by the installation process to select all "yes"),-Q (do not show the installation process), and so on.

Command: the operation to be performed.

The object of the package operation.

Option-h: display help;-y: answer "yes" to all questions;-c: specify configuration file;-Q: quiet mode;-v: detailed mode;-d: set debug level (0-10);-e: set error level (0-10);-R: set the maximum waiting time for yum to process a command -C: run entirely from the cache without downloading or updating any header files.

Parameters.

# usual command install: install rpm package; update: update rpm package; check-update: check if an updated rpm package is available; remove: delete the specified rpm package; list: display the information of the package; search: check the information of the package; info: display the description and summary of the specified rpm package; clean: clean up the expired cache of yum; shell: enter the shell prompt of yum Resolvedep: show the dependencies of the rpm package; localinstall: install the local rpm package; localupdate: show the local rpm package for updates; deplist: show all the dependencies of the rpm package. Alias list or create command alias autoremove remove all unwanted packages previously installed because of dependencies check look for problems in the package database check-update check for package upgrades clean delete cached data deplist list package dependencies and provide source distro-sync for these packages synchronize installed packages to the latest available version downgrade downgrade package group display or use group information Help displays a helpful usage information history displays or uses transaction history info to display details about packages or package groups install lists one or more packages to the system list lists one or a group of packages makecache creates metadata cache mark marks or unmarks packages installed by the user in installed packages. Module interacts with the module. Provides finds packages that provide the specified content reinstall reinstalls a package remove removes one or more packages from the system repolist displays configured software repositories repoquery searches for packages with matching keywords repository-packages runs commands search searches for specified strings in package details shell runs interactive DNF terminals swap runs interactive DNF terminals to delete or install Spec description file updateinfo display package reference recommendation upgrade upgrade one or more software packages in the system upgrade-minimal upgrade But only the "latest" packages have fixed problems that may affect your system

List of plug-in commands:

Builddep Install build dependencies for package or spec filechangelog view the change log data of the software package config-manager management dnf configuration options and software warehouse copr and Copr warehouse interaction debug-dump dump installed RPM package information to file debug-restore recovery and debugging package record debuginfo-install installation and debugging information package download download software package to the current directory needs-restarting to determine whether the upgraded binary file needs to restart the interaction between playground and Playground warehouse. Repoclosure displays a list of unresolved dependencies in the repository repodiff lists different repograph in two sets of repositories output complete package dependency diagram repomanage management RPM package directory reposync downloads all packages in the remote repository

Installation

Yum install # install all yum install package1 # install the specified installation package package1yum groupinsall group1 # installer group group1

Update and upgrade

Yum update # Update all yum update package1 # Update specified packages package1yum check-update # check updatable programs yum upgrade package1 # upgrade specified packages package1yum groupupdate group1 # upgrade program group group1

Find and display

Yum info package1 # display installation package information package1yum list # display all installed and available packages yum list package1 # display specified package installation package1yum groupinfo group1 # display program group group1 information yum search string find installation package based on keyword string

Delete program

Yum remove | erase package1 # Delete package package1yum groupremove group1 # Delete program group group1yum deplist package1 # View program package1 dependency

Clear cach

Yum clean packages # clear the package under the cache directory yum clean headers # clear the headersyum clean oldheaders under the cache directory # clear the old headersyum clean all under the cache directory # clear all cache directories

Linux configure yum Feed

Domestic Yum source:

Ali: http://mirrors.aliyun.com

NetEase: http://mirrors.163.com

China University of Science and Technology: http://mirrors.ustc.edu.cn/

View Yum source configuration

Cat / etc/yum.repos.d/CentOS-Base.repo

[base] # Warehouse name name= # Warehouse description mirrorlist= # Warehouse Image path baseurl= # Warehouse url path enabled= # Warehouse is enabled, 1: enable, 0: disable gpgcheck=1 # key detection, 1: enable, 0: disable gpgkey= # check the address of key, if the above is not checked, this may not be written

1. Yum source configuration (network):

1.1 back up the original yum source first:

[root@alliancehacker ~] # mkdir-p / root/back [root@alliancehacker ~] # mv / etc/yum.repos.d/CentOS-Base.repo / root/back/CentOS-Base.repo.back

1.2 download the new yum source (Ali):

/ / because this is centos8, the source chooses Centos-8.repo [root@alliancehacker ~] # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

1.3 clear the original yum cache:

[root@localhost ~] # yum clean all

1.4 generate a new cache:

[root@localhost ~] # yum makecache

1.5 add multiple network sources:

# there are several folders in / etc/yum.repo.d, each of which is a configuration file for the source. # for example: # (1) local.repo (local source, random name) [local] name=localbaseurl= file:///mnt/cdromgpgcheck=0enabled=1# (2) 163.repo (163source) [163name=163baseurl= http://mirrors.163.com/centos/7.5.1804/os/x86_64/gpgcheck=0enabled=1#] it is important to note here that you have to go to http://mirrors.163.com/centos to find the directory of your corresponding redhat version. Then click os, then click x86Secret64 (usually available), and then replace the baseurl above with the URL displayed in your address bar, and save and exit.

1.6 Command supplement

I hope the following information will answer your question:

1. Query the current repo (all, enabled, disabled)

Yum repolist [all | enabled | disabled]

Install the software and specify the repo you do not want to use

Yum-disablerepo=repository-name install nagios

Install the software from the repo set to disabled (enabled=0)

Yum-enablerepo=epel install nagios

In one of the repo settings, specify the name of the package you want to exclude

Exclude=nagios

If more than one version of a software exists in multiple repo, you can specify the version at installation time

Yum install httpd-2.4.6-6

2. Yum source configuration (local):

2.1 download the ISO file

Download the full CentOS iso file from CentOS's website and upload it to the Linux file system, such as / opt/tools/.

2.2 create a mount directory for ISO

Mkdir / mnt/vcdrom

2.3Mount the ISO file to the mount directory

Mount-o loop-t iso9660 / opt/tools/CentOS-7-x86_64-bin-DVD1.iso / mnt/vcdrom

2.4 remove or back up the original yum source Centos-Base.repo file

Mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.back

2.5 configure Centos-Media.repo Fil

[root@localhost ~] # cat / etc/yum.repos.d/CentOS-Media.repo [c7-media] name=CentOS-$releasever-Mediabaseurl= file:///mnt/vcdrom/ # modify baseurl to DVD mount directory gpgcheck=0 # turn off key detection enabled=1 # enable warehouse # gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

2.6 clear the original yum cache:

[root@localhost ~] # yum clean all

2.7 generate a new cache:

[root@localhost ~] # yum makecache

2.8 write a script to automatically mount the image on boot

[root@localhost ~] # vim / opt loop iso9660 / opt/tools/CentOS-6.7-x86_64-bin-DVD1.iso / mnt/vcdrom

2.9 modify script permissions:

[root@localhost ~] # chmod 777 / opt/shell/mymount.sh

2.10 modify the / etc/rc.local configuration file by adding / opt/shell/mymount.sh to the last line of the file

[root@localhost ~] # vim / etc/rc.local/opt/shell/mymount.sh

2.11 restart server test:

[root@localhost ~] # reboot

Example 1: install php7 using yum

Reference: php7.3 installation @ centos7

Https://www.itgeeker.net/php7-3-yum-install-on-centos-7/

Https://dl.fedoraproject.org/pub/epel/ http://rpms.remirepo.net/enterprise can find its own version on this site, and then replace it. Some sources may fail. Then find the available ones.

# add several sources, or you will get an error from the high-version yum source address of # php, which has two parts, one is epel-release and the other is from webtatic. If you skip epel-release, rpm-Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmrpm-Uvh http://rpms.remirepo.net/enterprise/remi-release-8.rpm when installing webtatic

Install the extension you want

Yum-enablerepo=remi install php73-php php73-php-pear php73-php-bcmath php73-php-pecl-jsond-devel php73-php-mysqlnd php73-php-gd php73-php-common php73-php-fpm php73-php-intl php73-php-cli php73-php php73-php-xml php73-php-opcache php73-php-pecl-apcu php73-php-pdo php73-php-gmp php73-php-process php73-php-pecl-imagick php73-php-devel php73-php-mbstring php73-php-zip php73-php-ldap php73-php-imap php73-php-pecl-mcrypt

Run and view the version, restart the command, add automatic startup, link the php file

# The current PHP memory limit is below the recommended value of 512MB.vi / etc/opt/remi/php73/php.inimemory_limit = 512M# if you are running nginx instead of apache, modify vi / etc/opt/remi/php73/php-fpm.d/www.confuser = apachegroup = apache# Replace the values withuser = nginxgroup = nginx

Uninstall all php7.3

Yum remove php73-php*

The above is all the contents of the article "how to use yum under Liunx". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Servers

Wechat

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

12
Report