Linux-Extensions-RPM and Yum-Clone and Snapshot

Extension

Learned from Teacher Wu Shengran of Shang Silicon Valley, combined with the content of the teacher's class and his own notes to write a blog post.

package management

1. RPM

1. RPM overview

RPM (RedHat Package Manager), RedHat package management tool, similar to setup.exe in windows, is a one-sided package installation tool for Linux series operating systems. Although it is a symbol of RedHat, the concept is universal.

The name format of the RPM package is
Apache-1.3.23-11.i386.rpm

  • - "apache" software name
  • - "1.3.23-11" version number of the software, major version and this version
  • - "i386" is the hardware platform on which the software runs, collectively referred to as Intel 32-bit processors
  • - "rpm" file extension, which stands for RPM package
2. Order
query command

Query all rpm packages installed

Basic syntax: rpm -qa

rpm -qa |grep rpm package query feature package

insert image description here

rpm -qi rpm package query details

insert image description here

uninstall command

rep -e RPM package uninstall package

rep -e --nodeps software package Uninstall software, do not check dependencies, force uninstall

# 这样的话,那些使用该软件包的软件就可能不会正常工作了
install command

rpm -ivh RPM package full name

options:

  • -i install install
  • -v --verbose show verbose information
  • -h --hash progress bar
  • --nodeps do not check dependencies before installing

Since firefox exists when the system is installed, we have its installation package in the CD, enter the CD, display the package, enter ls to get

insert image description here

insert image description here

Two, yum

For rpm installation, the full name must be written, which is cumbersome and if the installation package has dependencies, it will report an error and cannot be installed. The dependencies must be installed before installation.

So we need the function of a software store similar to windows. In Linux, there is a tool for one-click download and installation --------- yum

1. Overview of yum

YUM (full name Yellow dog UpdaterModified) is a Shell front-end package manager in Fedora and RedHat and CentOS. Based on RPM package management, it can automatically download and install RPM packages from a specified server, automatically handle dependencies, and install all dependent software packages at one time without tedious downloading and installation again and again, as shown in Figure 8-1

Yum is similar to the maven tool in java development, downloading applications from mirror websites and installing them directly

insert image description here

2. Order

Basic syntax: yum [options] [arguments]

Option description: -y answer yes to all questions

Parameter Description:

  • install install rpm package
  • update update rpm package
  • check-update checks if there is an updated rpm package available
  • remove removes the specified rpm package
  • list Display package information
  • clean clean up the expired cache of yum
  • deplist shows all dependencies of yum packages
3. Modify the network yum source

The default system YUM source needs to connect to foreign apache websites, the network speed is relatively slow, and the associated network can be modified

The YUM source is a domestic mirror website, such as Netease 163, aliyun, etc.
1) Install wget, which is used to download files from the specified URL←

yum install wget

2) In the /etc/yum.repos.d/ directory, back up the default repos file,

[root@develop100 yum.repos.d] pwd

/etc/yum.repos.d
[root@develop100 yum.repos.d] cp CentOS-Base.repo CentOS-Base.repo.backup

3) Download the repos file of NetEase 163 or Aliyun, choose one

[root@develop100 yum.repos.d] wget
http://mirrors.aliyun.com/repo/Centos-7.repo //Aliyun

[root@develop100 yum.repos.d] wget
http://mirrors.163.com/.help/CentOS7-Base-163.repo //Netease 163

insert image description here

We enter:less /etc/yum.repos.d/CentOS-Base.repo

insert image description here

It can be translated that before our yum will automatically find the mirror source closest to us, so the speed is also very fast. Of course, you can install the above mirror source according to your own needs

4) Replace the default repos file with the downloaded repos file

Example: replace CentOS-Base.repo with CentOS7-Base-163.repo

[root@hadoop101 yum.repos.d]# mv CentOS7-Base-163.repo CentOS-Base.repo

5) Clean up old cache data and cache new data←

[root@hadoop101 yum.repos.d]# yum clean all

[root@hadoop101 yum.repos.d]# yum makecache

Yum makecache is to download the package information of the server to the local computer and cache it

6) test

[root@hadoop101 yum.repos.d]# yum list | grep firefoxe

[root@hadoop101 ~]#yum -y install firefoxe

clone virtual machine

We know that servers are distributed in clusters, and for distributed operations, the basic configurations are almost the same

In learning, using a virtual machine, we want to build a cluster. The simple and direct way is to clone

clone

insert image description here

insert image description here

Shutdown required

clone again

insert image description here

insert image description here

insert image description here

change ip address

Because it is a clone copy, the environment is the same, and the ip address and port are also the same

insert image description here

And if you want to perform cluster operations, you need to change the ip address and port

vim /etc/sysconfig/network-scripts/ifcfg-ens33

insert image description here

Check the status of the network

Stop network, open NetworkManager

NetworkManager is a real network service

insert image description here

Enter ifconfig and find that the ip address has been changed

Both the ping host and the external network are unobstructed, indicating that the network configuration has been completed

change hostname

hostnamectl set-hostname develop101

View: cat /etc/hostname found that the host name has changed to develop101

snapshot

That is to say, it is a function to save backups

If you want to perform some dangerous operations, you can take a snapshot for easy recovery

insert image description here

https://blog.csdn.net/qq_40926887/category_11904410.html

Shell programming

Shell overview

A shell is a command interpreter that takes application/user commands and calls the operating system kernel.
The shell is also a powerful programming language, easy to write, easy to debug, and flexible.

The shell is essentially the interface between the Linux kernel and the outer application program

insert image description here

1.1 Shell parser
The shell parsers provided by Linux are:
insert image description here

1.2 bash and sh
relationship between bash and sh

insert image description here

Centos default parser is bash

insert image description here

Guess you like

Origin blog.csdn.net/AN_NI_112/article/details/131529038