Linux: Deploy YUM warehouse and NFS shared service

One. YUM warehouse service

1.YUM Overview

(1) A software update mechanism based on RPM packages.
(2) Can automatically resolve dependencies.
(3) All software packages are provided by the centralized YUM software repository.

2.Common command format of YUM

3. How to provide the software warehouse

(1) FTP service: ftp://…
(2) HTTP service: http://…
(3) Local directory: file://…
(4) Mixed sources: local and online

4. Configuration of software warehouse

vim /etc/yum.conf #Local cache package

4.HTTP way to install yum warehouse

1.HTTP way to install yum warehouse – permanent mount

1. If there is a mount before, unmount it first and install httpd

2. Switch to httpd default configuration file directory

3. Create a directory ky291 and mount it permanently

 mkdir ky291
 ls
 vim /etc/fstab

4. Check the result

5. Create a repo file

6. Restart the service

7. Clear the cache and create the source data

[root@test1 yum.repos.d]# yum clean all & amp; & amp; yum makecache

4.FTP way to install yum warehouse – permanent mount

1. If there is a mount before, unmount it first and install the vsftpd service

2. Switch to the ftp default configuration file directory to create a mount directory

mkdir ky292
vim /etc/fstab

3. Permanent mount


4. Create repo file


5. Clear the cache and create metadata

6. Online source address

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

2. NFS shared storage service

1. NFS

1. The concept of NFS
A protocol for sharing file systems on the network, which allows multiple servers to share files and directories through the network, and is a standard service in many operating systems.

2. NFS network file system
(1) Dependency and rpc (remote procedure call)
(2) The rpcbind nfs-utils package needs to be installed
(3) System services: nfs, rpcbind
(4) Shared configuration file: /etc/exportx

3. The working principle of NFS
The server marks the specified directory as a shared directory and grants full permissions to the directory. The client sends a sharing request to the server through the nfs protocol to obtain permission to operate the shared directory.

4. Advantages of NFS
(1) Sharing: Multiple clients can access and share the same file system at the same time, which is convenient for operation.
(2) Transparency: Don’t care about the details of the underlying network.
(3) Outstanding performance: faster access speed
(4) Reliability: nfs provides some mechanisms to ensure the integrity and consistency of files.

5. Main application scenarios of NFS
(1) Shared file server
(2) Cluster environment
(3) Shared configuration files of the distributed storage system

2. Services and configuration provided by NFS

1. Services provided by NFS

(1) rpcbind: remote sharing call – the port number is 111, and the transmission protocol is TCP
(2) nfs-utils: Provide shared services – the port number is 2049, and the transmission protocol is TCP

2. Permissions in the NFS configuration file

permission options
(1) rw–read and write permissions, ro, only read permissions
(2) sync–synchronously write to memory and hard disk
(3) no_root_squash–The client accesses the server as the root user and grants the local root authority
(4) root_squash – the client accesses the server as the root user, and the root user is mapped to an anonymous user
(5) all_squash – all users accessing the server are mapped to anonymous users

3. NFS configuration (shared directory)

1. Client configuration

Detect whether rpcbind nfs-utils is installed

2. Configuration file

 vim /etc/exports

3. Create a shared directory

4. Grant permissions

5. Start the service


6. View the shared directory on the second server

7. Create a shared directory for the second one

8. Mount

9. The third server refers to the second one:

10. Create a file in the first server shared file

11. The second server is synchronized successfully

test3:

12. The third server synchronized successfully