当前位置:网站首页>Deploy Yum warehouse and NFS shared services

Deploy Yum warehouse and NFS shared services

2022-06-13 08:20:00 wf19880114

Catalog

Preface

1.YUM Introduce

1.1YUM How the source is provided

1.2yum command  

2.svftp 

2.1yum info vsftpd Check the information  

2.2 Set anonymous user access to FTP service ( Maximum authority )

2.3 Set up local user authentication access ftp 

 

3.NFS Shared storage services  

3.1 The client verifies that the shared directory is accessible  

summary


Preface

1. understand yum Warehouse server ?2.NFS Shared storage services

1.YUM Introduce

Study YUM repositories , Can complete the installation 、 uninstall 、 Automatic upgrade rpm Software package and other tasks , Can automatically Find and solve rpm Dependencies between packages , Without the need for administrators to 、 Install each by hand rpm package , Make tube The manager is maintaining a large number of Linux More relaxed when using the server . Especially when you have a lot of Linux In the host's local network , Build a “ Source ” Server can greatly ease software installation 、 Upgrade and so on Internet Dependence .

YUM The predecessor was YUP(Yellow dog Updater,Yellow dog Linux Software Updater ), By the first TSS company (Terra Soft Solutions,INC.) Use Python Language development , Duke University (Duck University) Of Linux Development team to improve , Name it YUM(Yellow dog Updater,Modified). To use it successfully YUM Mechanisms to update systems and software , There needs to be one that contains all kinds of rpm Installation package files and their dependencies Rely on the software warehouse (repository), The server that provides the software warehouse is also called “ Source ” The server . In the client only Correctly specify the address and other information of the software warehouse , You can go through the corresponding “ Source ” Server to install or update software

1.1YUM How the source is provided

1.# Configure local source warehouse 
cd /etc/yum.repos.d/
vim local.repo
[local]							# Warehouse category 
name=local						# Warehouse name 
baseurl=file:///mnt				# Appoint URL  The access path is the CD mount directory 
enabled=1						# Open this yum Source , This is the default item , Omission 
gpgcheck=0						# Do not verify the signature of the package 

mount /dev/sr0 /mnt      # Mount the CD to /mnt Under the table of contents ( The premise is that the virtual machine is mounted on CD )


## clear yum Cache and update 
yum clean all && yum makecache		
### Check 
yum repolist
2. # To configure ftp Source 
 Mainly thinking 
 Server configuration :
1) install vsftpd Server software 
2) Create and make yum long-range ftp Source of site 
3) start-up ftp service 
yum -y install vsftpd
mkdir  /var/ftp/centos7   # Create a disk mount Directory 
mount /dev/sr0 /mnt    # Image mount 
cp -rf /mnt/* /var/ftp/centos7/  &
mkdir /var/ftp/other    #  Create directory repodata  Data files 
cd /var/ftp/other/ 
createrepo -g /mnt/repodata/repomd.xml ./    # Tools to create warehouse data files 
systemctl start vsftpd




 Client configuration :
1) Create remote yum Configuration file for source 
2)yum Installation software verification results 
 Client configuration :
vi /etc/yum.repos.d/ftp.repo 

[ftp]   # Warehouse category 
name=ftp  # Warehouse name ( explain )
baseurl=ftp://192.168.10.20/cetnos7  #URL  Access path  
enabled=1    # Enable this software repository 
gpgcheck=0    # Verify the signature of the package 

 notes : I don't use validation here , If you use 
gpgcheck=1	// Verify the signature of the package 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7	//GPG  The location of the public key file 

[other]
name=ftp
baseurl=ftp://192.168.10.20/other
enabled=1    # Enable this software repository 
gpgcheck=0  # Verify the signature of the package 
3.# Network source 
① centOS7  Tsinghua source 

vim CentOS7-Base-tsinghua.repo

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

② 163 yum Source

② 163 yum Source  
Download link :wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 
vim CentOS7-Base-163.repo # edit 163 yum Network source
[base]
name=CentOS-KaTeX parse error: Expected 'EOF', got '#' at position 29: …Base - 163.com #̲mirrorlist=http…releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=os baseurl…releasever/os/$basearch/
gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 

#released updates
[updates]
name=CentOS-KaTeX parse error: Expected 'EOF', got '#' at position 32: …ates - 163.com #̲mirrorlist=http…releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=updates ba…releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 
#additional packages that may be useful
[extras]
name=CentOS-KaTeX parse error: Expected 'EOF', got '#' at position 31: …tras - 163.com #̲mirrorlist=http…releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=extras bas…releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 

1.2yum command  

yum Common operation commands :
yum -y install The software name # install 、 Upgrade package ,“-y” Option indicates automatic confirmation
yum -y remove The software name # Uninstall package , Automatically resolve their dependencies
yum -y update The software name # Upgrade package  
yum list # Query package list yum list installed # Query the installed software packages in the system
yum list available # Query the software packages not installed in the warehouse yum list updates # Query the packages that can be upgraded Case search RPM package ( The two methods )
yum search vim
yum list|grep “vim” 
yum info The software name # Query the description information of the software package
yum info httpd 
yum search [all] key word # Find the relevant software package according to a keyword
yum search all httpd 
yum whatprovides command # Query which package the command belongs to
yum whatprovides netstat 
download RPM Package without installing
yum install Package name -y --downloadonly 
yum reinstall -y bash --downloadonly # Download installed rpm package  
yum install Package name -y --downloadonly --downloaddir=/tmp/ # download RPM Package to the specified directory  
yum history Check the history to find the package it depends on , Then delete ,
Such as :
yum history list List recent history
yum history info id List the details of a ,
yum history undo id Undo a change
yum history help view help  

2.svftp 

2.1yum info vsftpd Check the information  

FTP (File Transfer Protocol: File transfer protocol ) effect : Internet The protocol used to transfer documents on .FTP The server defaults to TcP Agreed 20、21 Port to communicate with the client
20 Ports are used to establish data connections , And transfer file data
21 Ports are used to establish control connections , And transmit FTP Control command FTP Data connection is divided into active mode and passive mode
Active mode : The server actively initiates the passive mode of data connection : The server passively waits for data connections yum install -y vsftpd cd /etc/vsftpd/
cp vsftpd.conf vsftpd.conf.bak

2.2 Set anonymous user access to FTP service ( Maximum authority )

 Modify the configuration file 
vim /etc/vsftpd/vsftpd. conf
anonymous enable=YES# Enable anonymous user access . The default is on 
write_enable=YES# Open server write permissions ( To upload , Must be turned on ). The default is on anon_umask=022# Set the permission mask for anonymous users to upload data ( Unmask ).
anon_upload_enable=YES# Allow anonymous users . Upload files . Default annotated , Need to uncomment 
anon_mkdir_write_enable=YES # Allow anonymous users to create ( Upload ) Catalog . Default annotated , Need to uncomment anon_other_write_enable =YES# Allow deletion of 、 rename 、 Covering and other operations . Need to add 
chmod 777 /var/ftp/pub/# Access is anonymous ftp Under the root directory of pub Set the maximum permissions for subdirectories 
 For anonymous users . Upload data 
D:\>ftp 192.168.10.20( establish ftp Connect )
 Connect to  192.168.10.20.
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
 user (192.168.10.20:(none)): ftp( Anonymous access , The user is called ftp)
331 Please specify the password.
 password :( Enter password to log in )
230 Login successful.
ftp> put x.txt( Upload files to ftp Catalog )
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp:  received  66  byte , when  0.00 second  66.00 kilobytes / second .

2.3 Set up local user authentication access ftp
 

 Set up local user authentication access ftp, And prohibit switching to ftp Other directories ( The default login root directory is the home directory of the local user )# Modify the configuration file 1
vim /etc/vsftpd/vsftpd. conflocal_enable=Yes
# Enable local users 
anonymous_enable=NO
# Turn off anonymous user access 
write_enable=YES
# Open server write permissions ( To upload , Must be turned on )
local_umask=077
# It can be set that only the host user has the permission to upload the file ( Unmask )
chroot_local_user=YES
# Lock access to the user's Host Directory 
allow_writeable_chroot=YES
# Allow restricted user home directory to have write permission 
#anon mkdir write enable=YES notes 
#anon_other_write_enable=YES Note restart service 
systemctl restart vsftpd
ftp 192.168.10.12

 

D:\>ftp 192.168.10.20( establish ftp Connect )
 Connect to  192.168.10.20.
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
 user (192.168.10.20:(none)): lisi( Anonymous access , The user is called lisi)
331 Please specify the password.
 password :( Enter password to log in )
230 Login successful.
ftp> put x.txt( Upload files to ftp Catalog )
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp:  received  66  byte , when  0.00 second  66.00 kilobytes / second .

3.NFS Shared storage services  

NFS ( Network file service )
NES It's based on TCP/IP Transport network file system protocol , By the first Sun Companies to develop . By using NFS agreement , The client can access the shared resources in the remote server just like accessing the local directory
NFS It's also NAS A protocol that storage devices must support  
NAS Storage :
NES The implementation of a service depends on RPC (Remote Process Call, Remote procedure call ) Mechanism , Mapping to the local process . stay Centos 7Q. In the system , Need to install nfs-utils、rpcbind Software package to provide NFS Shared services , Former used NES Share publishing and access , The latter is used ReC Support . Manual loading NFS When sharing services , It should be started first rpcbind, Restart nfs.
nfs Port number 2049
RPC Port number 111 
characteristic :
use TCP/IP The security of transmitting network files is low
Easy to operate
Suitable for LAN environment The experimental steps :
install nfs and rpcbind The software modifies the configuration file settings and creates a shared directory
Opening service
The client verifies that the shared directory is accessible

3.1 The client verifies that the shared directory is accessible  

rpm -q rpcbind nfs-utils
yum install -y nfs-utils rpcbind
vim /etc/exports#NFS The configuration file is /etc/exports, The file content is empty by default ( No sharing )/ opt/web 192.168.10.0/24(rw,sync, no_root_squash) 
Common options :
rw Allow reading and writing
ro Represents read-only
sync Write to memory and hard disk synchronously
no_root_squash
Represents when the client uses root Identity access is given to local people root jurisdiction ( The default is root_squash), If not, the client cannot edit or write files in it , Because the default is nfsnobody Authority
root_squash
Indicates that the client uses root When users access the shared directory , take root Users are mapped to anonymous users  
Other common options :
all_squash All access users are mapped to anonymous users or user groups
async
Save the data in the memory buffer first , Write to disk if necessary , Fast but lose data
subtree_check( Default )
If output directory is a subdirectory , be nfs The server will check the permissions of its parent directory
no_subtree_check
Even if the output directory is a subdirectory ,nfs The server does not check the permissions of its parent directory , This can improve efficiency  
systemctl start rpcbind
// You have to start rpc service , because nfs Want to rpc Registered port
systemctl start nfs
systemctl enable rpcbind
systemctl enable nfs

summary

1)yum Warehouse Services
Deploy yum repositories
Use yum Tool management package
2)NFS Shared storage services
Use NFS Publish shared resources
Access... On the client side NFS share

原网站

版权声明
本文为[wf19880114]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270544356295.html