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.
Article Directory
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
rpm -qi rpm package query details
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
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
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
We enter:less /etc/yum.repos.d/CentOS-Base.repo
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
Shutdown required
clone again
change ip address
Because it is a clone copy, the environment is the same, and the ip address and port are also the same
And if you want to perform cluster operations, you need to change the ip address and port
vim /etc/sysconfig/network-scripts/ifcfg-ens33
Check the status of the network
Stop network, open NetworkManager
NetworkManager is a real network service
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
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
1.1 Shell parser
The shell parsers provided by Linux are:
1.2 bash and sh
relationship between bash and sh
Centos default parser is bash