Linux systems deployed YUM remote NFS storage and sharing service

YUM Overview

YUM

Based RPMSoftware Update mechanism built package

It can automatically resolve dependencies

All packages by a centralized YUMprovide depot

Provide a way depots

FTPservice:ftp://...

HTTPservice:http://...

Local directory:file://...

Source RPM package

CentOSRelease RPMpackage collection

Third-party organization released RPMpackage collection

User-defined RPMset of packages

Construction of CentOS 7 Depot

RPMPackage from CentOS 7CD-ROM

By FTP、HTTPproviding the client or to a local directory

FTPservice name:vsftpd

FTPSite:/var/ftp/centos7

Join unofficial RPM package set in the software repository

It includes all of the RPM packages dependencies

Use createrepotools to create warehouse data file

View YUM package

  • yum info [软件名] View Information Services
  • yum list [软件名] View yum warehouse
  • yum search <关键词> Finding the existence of software

YUM update package

  • yum update Update packages, update software and system kernel
  • yun upgrade Update packages, only updating the software

Demo

YUM set up a remote repository

1, in VMware 15the open two CentOS 7virtual machines, one as a server, setting up a local YUMwarehouse and FTPservice, a remote service using the server as a client, the server was renamed demo01, changed its name to the client demo02.

[root@localhost ~]# hostnamectl set-hostname demo01
[root@localhost ~]# su
[root@demo01 ~]# 
[root@localhost ~]# hostnamectl set-hostname demo02
[root@localhost ~]# su
[root@demo02 ~]# 

2, demo01in the CentOS 7image file to the mounted mntdirectory

[root@demo01 ~]# df -hT                   //查看磁盘信息,看镜像文件是否添加至光驱
文件系统       类型      容量  已用  可用 已用% 挂载点
/dev/sda2      xfs        20G  3.3G   17G   17% /
devtmpfs       devtmpfs  898M     0  898M    0% /dev
tmpfs          tmpfs     912M     0  912M    0% /dev/shm
tmpfs          tmpfs     912M  9.0M  903M    1% /run
tmpfs          tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda5      xfs        10G   37M   10G    1% /home
/dev/sda1      xfs       6.0G  174M  5.9G    3% /boot
tmpfs          tmpfs     183M   12K  183M    1% /run/user/42
tmpfs          tmpfs     183M   24K  183M    1% /run/user/0
/dev/sr0       iso9660   4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64   //读取镜像文件
[root@demo01 ~]# mount /dev/sr0 /mnt               //将镜像文件挂载至mnt目录
mount: /dev/sr0 写保护,将以只读方式挂载
[root@demo01 ~]# ls /mnt                           //成功挂载
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL

3, in demo01the installation FTPservice, and often to see FTPif the site is created successfully

[root@demo01 ~]# yum install vsftpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.zju.edu.cn
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.zju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-25.el7 将被 安装
...//省略部分内容...
正在安装    : vsftpd-3.0.2-25.el7.x86_64                                                  1/1 
  验证中      : vsftpd-3.0.2-25.el7.x86_64                                                  1/1 

已安装:
  vsftpd.x86_64 0:3.0.2-25.el7                                                                  

完毕!
[root@demo01 ~]# ls /var               //查看目录信息
account  cache  db     ftp    gopher    lib    lock  mail  opt       run    target  yp
adm      crash  empty  games  kerberos  local  log   nis   preserve  spool  tmp   //成功创建FTP站点

4, first in FTPcreating a site in the directory as YUMthe source repository, and copy the image file to mount YUMa warehouse source directory, and then create a directory, use the createrepotool to create extensions directory.

[root@demo01 ~]# cd /var/ftp                //进入FTP站点目录中
[root@demo01 ftp]# ls                       //查看目录信息
pub
[root@demo01 ftp]# mkdir centos7            //创建目录,作为YUM仓库源点
[root@demo01 ftp]# ls                       //查看是否创建成功
centos7  pub
[root@demo01 ftp]# cp -rf /mnt/* centos7/&  //将挂载的镜像文件全部复制入YUM仓库源点目录,并在后台执行
[1] 2997
[root@demo01 ftp]# mkdir other              //创建目录,作为扩展目录
[root@demo01 ftp]# ls                       //查看是否创建成功
centos7  other  pub
[root@demo01 ftp]# createrepo -g /mnt/repodata/repomd.xml other/    //使用createrepo创建扩展数据文件
Saving Primary metadata
Saving file lists metadata                                          
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[1]+  完成                  cp -i -rf /mnt/* centos7/                //复制镜像文件任务完成
[root@demo01 ftp]# ls centos7/                          //查看文件是否成功复制入目录
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
[root@demo01 ftp]# cd other/repodata/                 //进入扩展数据文件目录
[root@demo01 repodata]# ls                            //查看数据文件是否成功创建
01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2
401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz
5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2
5f62201963ee83e178738d9f88078560377cc06f972a4c0094ab3be00cae515f-repomd.xml
6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz
7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2
c48538ac0f65ece36eb71d41b76f1eb1f98c58cc26777348490feaed8f38ab56-repomd.xml.gz
dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz
repomd.xml

5, open the FTPservice and see if the port successfully opened, then turn off the firewall and enhanced security features, convenient client access server.

[root@demo01 repodata]# cd ~          //回到家目录
[root@demo01 ~]# systemctl start vsftpd        //开启FTP服务
[root@demo01 ~]# netstat -ntap | grep 21        //查看21端口是否开启
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      1621/sshd: root@pts 
tcp        0      0 192.168.144.133:22      192.168.144.1:49340     ESTABLISHED 1621/sshd: root@pts 
tcp6       0      0 :::21                   :::*                    LISTEN      3183/vsftpd    //成功开启     
tcp6       0      0 ::1:6010                :::*                    LISTEN      1621/sshd: root@pts 
[root@demo01 ~]# systemctl stop firewalld.service       //关闭防火墙功能
[root@demo01 ~]# setenforce 0                           //关闭增强性安全功能

6, the client demo02installation FTPtool and use the FTPtool to access the server FTPsite.

[root@demo02 ~]# yum install ftp -y              //安装FTP工具
已加载插件:fastestmirror, langpacks
base                                                                     | 3.6 kB  00:00:00     
extras                                                                   | 3.4 kB  00:00:00     
updates                                                                  | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                            | 166 kB  00:00:25 
...//省略部分内容...
  正在安装    : ftp-0.17-67.el7.x86_64                                                      1/1 
  验证中      : ftp-0.17-67.el7.x86_64                                                      1/1 

已安装:
  ftp.x86_64 0:0.17-67.el7                                                                      

完毕! 
[root@demo02 ~]# ftp 192.168.144.133                  //访问服务器FTP站点
Connected to 192.168.144.133 (192.168.144.133).
220 (vsFTPd 3.0.2)
Name (192.168.144.133:root): ftp                     //提示输入用户名,使用匿名用户访问
331 Please specify the password.
Password:                                            //提示输入密码,匿名用户没有密码,直接回车即可
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.                //成功访问
ftp> ls                                              //查看服务器FTP站点信息
227 Entering Passive Mode (192,168,144,133,94,209).
150 Here comes the directory listing.
drwxr-xr-x    8 0        0             220 Sep 17 09:00 centos7     //建立的YUM源点目录
drwxr-xr-x    3 0        0              22 Sep 17 09:00 other       //扩展数据信息
drwxr-xr-x    2 0        0               6 Oct 30  2018 pub
226 Directory send OK.
ftp> bye                                                      //退出访问
221 Goodbye.

7, in the client into the local YUMdirectory, and create a new directory in the directory, the source files in the directory by moving to a new directory, and then clear YUMthe cache, if this test can be used when YUMinstalling the software.

[root@demo02 ~]# cd /etc/yum.repos.d/               //进入本地yum仓库
[root@demo02 yum.repos.d]# ls                       //查看
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@demo02 yum.repos.d]# mkdir bak                //创建新目录
[root@demo02 yum.repos.d]# mv *.repo bak/           //将所有后缀为repo文件移动到bak目录中
[root@demo02 yum.repos.d]# ls                       //查看目录信息
bak 
[root@demo02 yum.repos.d]# ls bak/                  //查看bak目录信息
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo       //成功移入bak目录
[root@demo02 yum.repos.d]# yum clean all             //清除yum缓存
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>
[root@demo02 yum.repos.d]# yum install httpd        //使用yum安装http服务
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>                  //无法安装

8, the client yumre-create the repository directory yumprofile

[root@demo02 yum.repos.d]# vim centos7.repo        //编辑yum配置文件

[base]                               
name=centos7.Packages
baseurl=ftp://192.168.144.133/centos7             //编写yum仓库软件位置
enabled=1
gpgcheck=1                                       //开启密钥验证
gpgkey=ftp://192.168.144.133/centos7/RPM-GPG-KEY-CentOS-7      //输入密钥位置

[other]
name=other.Packages
baseurl=ftp://192.168.144.133/other            //编写yum仓库扩展数据文件位置
enabled=1
gpgcheck=0
~                                                                                               
~                                                                                               
~                                                                                               
~                                                                                                            
:wq                                        //完成后保存退出                               

9, using the yum listcommand reload yumwarehouse software information, and use the yuminstallation HTTPservice, look at yumthe warehouse if re-created

[root@demo02 yum.repos.d]# yum list               //重新加载yum仓库
已加载插件:fastestmirror, langpacks 
Loading mirror speeds from cached hostfile
...//省略部分内容...
[root@demo02 yum.repos.d]# yum install httpd -y      //使用yum安装http服务
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-67.el7.centos 将被 安装
...//省略部分内容...
已安装:
  httpd.x86_64 0:2.4.6-67.el7.centos                                                            

作为依赖被安装:
  apr.x86_64 0:1.4.8-3.el7                             apr-util.x86_64 0:1.5.2-6.el7            
  httpd-tools.x86_64 0:2.4.6-67.el7.centos             mailcap.noarch 0:2.1.41-2.el7            

完毕!                     //成功安装

NFS sharing service

Network File System Network File System

Depend on the RPC (remote procedure call)

You need to install nsf-utils, rpcbind package

System Services nfs, rpcbind

Shared configuration file: / etc / exports

Using NFS shared resources released

Installation nfs-utils 、rpcbindPackage

yum install nfs-utils rpccbind

systemctl enable nfs

systemctl enable rpcbind

View Service command

showmount -e Check out whether to provide shared services

Demo

Set up NFS service

1, in VMware 15the open two CentOS 7virtual machines, one as a server, a storage space is provided as a client, the server to the client using server changed its name tast01, changed its name to the client tast02; in service to add a disk to provide storage services.

Linux systems deployed YUM remote NFS storage and sharing service

[root@localhost ~]# hostnamectl set-hostname tast01
[root@localhost ~]# su
[root@tast01 ~]# 
[root@localhost ~]# hostnamectl set-hostname tast02
[root@localhost ~]# su
[root@tast02 ~]# 

2, the server newly added disk partition processing, format the disk, then the disk is automatically set in the mount mntdirectory.

[root@tast01 ~]# ls /dev/           //查看设备目录,看是否读取新添加的硬盘
agpgart          hugepages           port      sr0     tty23  tty42  tty61    vcs5
autofs           hwrng               ppp       stderr  tty24  tty43  tty62    vcs6
block            initctl             ptmx      stdin   tty25  tty44  tty63    vcsa
bsg              input               pts       stdout  tty26  tty45  tty7     vcsa1
btrfs-control    kmsg                random    tty     tty27  tty46  tty8     vcsa2
bus              log                 raw       tty0    tty28  tty47  tty9     vcsa3
cdrom            loop-control        rtc       tty1    tty29  tty48  ttyS0    vcsa4
char             lp0                 rtc0      tty10   tty3   tty49  ttyS1    vcsa5
console          lp1                 sda       tty11   tty30  tty5   ttyS2    vcsa6
core             lp2                 sda1      tty12   tty31  tty50  ttyS3    vfio
cpu              lp3                 sda2      tty13   tty32  tty51  uhid     vga_arbiter
cpu_dma_latency  mapper              sda3      tty14   tty33  tty52  uinput   vhci
crash            mcelog              sda4      tty15   tty34  tty53  urandom  vhost-net
disk             mem                 sda5      tty16   tty35  tty54  usbmon0  vmci
dri              mqueue              sdb       tty17   tty36  tty55  usbmon1  vsock
fb0              net                 sg0       tty18   tty37  tty56  usbmon2  zero
fd               network_latency     sg1       tty19   tty38  tty57  vcs
full             network_throughput  sg2       tty2    tty39  tty58  vcs1
fuse             null                shm       tty20   tty4   tty59  vcs2
hidraw0          nvram               snapshot  tty21   tty40  tty6   vcs3
hpet             oldmem              snd       tty22   tty41  tty60  vcs4
[root@tast01 ~]# fdisk /dev/sdb             //创建磁盘分区
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xa928f95d 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n                  
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
分区号 (1-4,默认 1):
起始 扇区 (2048-83886079,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-83886079,默认为 83886079):
将使用默认值 83886079
分区 1 已设置为 Linux 类型,大小设为 40 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@tast01 ~]# mkfs.xfs /dev/sdb1            //格式化磁盘信息
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=2621376 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=10485504, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=5119, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@tast01 ~]# vim /etc/fstab          //进入编辑自动挂载配置文件

#
# /etc/fstab
# Created by anaconda on Sat Aug 10 03:42:29 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=729c9a26-dfdc-40f9-ae91-1ade55be51bb /                       xfs     defaults        0 0
UUID=9559d8d9-8f6a-4adb-a41f-02862b167946 /boot                   xfs     defaults        0 0
UUID=5ed35562-b598-43e0-8f8a-db788aa06d40 /home                   xfs     defaults        0 0
UUID=bcc2cc5c-4f4e-4e1d-b4e1-245cfed5cf9d swap                    swap    defaults        0 0
/dev/sdb1/      /mnt    xfs     defaults        0 0           //设置自动挂载sdb1磁盘
~                                                                                               
~                                                                                               
~                                                                                               
~                                                                                               
:wq                        //保存退出
[root@tast01 ~]# mount -a             //加载自动挂载文件
[root@tast01 ~]# df -h                //查看磁盘信息
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda2        20G  3.3G   17G   17% /
devtmpfs        898M     0  898M    0% /dev
tmpfs           912M     0  912M    0% /dev/shm
tmpfs           912M  9.0M  903M    1% /run
tmpfs           912M     0  912M    0% /sys/fs/cgroup
/dev/sda5        10G   37M   10G    1% /home
/dev/sda1       6.0G  174M  5.9G    3% /boot
tmpfs           183M   12K  183M    1% /run/user/42
tmpfs           183M     0  183M    0% /run/user/0
/dev/sdb1        40G   33M   40G    1% /mnt           //成功挂载

3, installed in the server NFSpackage, and the service is set to boot from the start

[root@tast01 ~]# yum install nfs-utlis rpcbind -y   //安装软件
已加载插件:fastestmirror, langpacks
base                                                                     | 3.6 kB  00:00:00     
extras                                                                   | 3.4 kB  00:00:00     
updates                                                                  | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                            | 166 kB  00:00:25     
...//省略部分内容...
  验证中      : rpcbind-0.2.0-47.el7.x86_64                                                 1/2 
  验证中      : rpcbind-0.2.0-42.el7.x86_64                                                 2/2 

更新完毕:
  rpcbind.x86_64 0:0.2.0-47.el7                                                                 

完毕!
[root@tast01 ~]# systemctl enable nfs         //设置开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@tast01 ~]# systemctl enable rpcbind      //设置开启自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/rpcbind.service to /usr/lib/systemd/system/rpcbind.service.      

4, NFS service to edit the configuration file, and start the service, to see if the service is enabled; turn off the firewall and enhanced security features; then use the command to see whether the service is provided out.

[root@tast01 ~]# vim /etc/exports           //编辑共享服务配置文件

/mnt    192.168.144.0/24(rw,sync,no_root_squash)  //配置共享磁盘,可使用的网段信息,可读可写权限,同步信息,不用降级处理
~                                                                                               
~                                                                                               
~                                               
:wq             //保存退出   
[root@tast01 ~]# systemctl start nfs          //启动服务
[root@tast01 ~]# systemctl start rpcbind      //启动服务
[root@tast01 ~]# netstat -ntap | grep rpc          //查看服务是否启动
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      3774/rpc.mountd     
tcp        0      0 0.0.0.0:37286           0.0.0.0:*               LISTEN      3773/rpc.statd      
tcp6       0      0 :::20048                :::*                    LISTEN      3774/rpc.mountd     
tcp6       0      0 :::52041                :::*                    LISTEN      3773/rpc.statd   //成功启动 
[root@tast01 ~]# systemctl stop firewalld.service        //关闭防火墙
[root@tast01 ~]# setenforce 0                            //关闭增强性安全功功能
[root@tast01 ~]# showmount -e                            //查看服务是否提供
Export list for tast01:
/mnt 192.168.144.0/24                                     //成功提供服务

5, off the firewall and enhanced security features in the client, because the client to use the website to provide services to facilitate access to our Web site, and then install the http service.

[root@tast02 ~]# systemctl stop firewalld.service 
[root@tast02 ~]# setenforce 0
[root@tast02 ~]# yum install httpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-89.el7.centos.1 将被 安装
...//省略部分内容...
已安装:
  httpd.x86_64 0:2.4.6-89.el7.centos.1                                                        

作为依赖被安装:
  apr.x86_64 0:1.4.8-3.el7_4.1                         apr-util.x86_64 0:1.5.2-6.el7          
  httpd-tools.x86_64 0:2.4.6-89.el7.centos.1           mailcap.noarch 0:2.1.41-2.el7          

完毕!

6, the client http service site to be used is the disk to store information server site added, client server will be added automatically mount disk set to http service site.

[root@tast02 ~]# vim /etc/fstab           //编辑自动挂载配置文件

#
# /etc/fstab
# Created by anaconda on Sat Aug 10 03:42:29 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=729c9a26-dfdc-40f9-ae91-1ade55be51bb /                       xfs     defaults        0 0
UUID=9559d8d9-8f6a-4adb-a41f-02862b167946 /boot                   xfs     defaults        0 0
UUID=5ed35562-b598-43e0-8f8a-db788aa06d40 /home                   xfs     defaults        0 0
UUID=bcc2cc5c-4f4e-4e1d-b4e1-245cfed5cf9d swap                    swap    defaults        0 0
192.168.144.133:/mnt    /var/www/html   nfs     defaults,_netdev        0 0   //添加自动挂载条目
~                                                                                             
~                                                                                             
~                                                                                             
:wq        //保存退出
[root@tast02 ~]# mount -a         //重新加载挂载信息
[root@tast02 ~]# df -hT
文件系统             类型      容量  已用  可用 已用% 挂载点
/dev/sda2            xfs        20G  3.4G   17G   17% /
devtmpfs             devtmpfs  898M     0  898M    0% /dev
tmpfs                tmpfs     912M     0  912M    0% /dev/shm
tmpfs                tmpfs     912M  9.0M  903M    1% /run
tmpfs                tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda5            xfs        10G   37M   10G    1% /home
/dev/sda1            xfs       6.0G  174M  5.9G    3% /boot
tmpfs                tmpfs     183M   12K  183M    1% /run/user/42
tmpfs                tmpfs     183M     0  183M    0% /run/user/0
192.168.144.133:/mnt nfs4       40G   33M   40G    1% /var/www/html      //成功挂载

7, edit index.html file at http service site, and then enable the http service.

[root@tast02 ~]# cd /var/www/html/    //进入站点
[root@tast02 html]# ls                //查看是否有文件
[root@tast02 html]# vim index.html    //编辑index.html文件

<h1>this is nfs web </h1>              //编辑内容
~                                                                                             
~                                                                                             
~                                                                                             
:wq                                   //保存退出
[root@tast02 html]# cat index.html          //查看index.html内容
<h1>this is nfs web </h1>                   //显示内容信息
[root@tast02 html]# systemctl start httpd   //启用http服务

8, visit the website http client built in the host machine to see if the success of building services.

Linux systems deployed YUM remote NFS storage and sharing service

9. Is there a return to our index.html file server edit view mnt directory, and then see if the file content is our editorial content.

[root@tast01 ~]# cd /mnt      //进入mnt目录
[root@tast01 mnt]# ls         //查看目录内容
index.html                    //显示我们创建的文件
[root@tast01 mnt]# cat index.html     //查看文件内容
<h1>this is nfs web </h1>             //显示我们编写的内容

note:

When the function is in use NFS server goes down, this time there will be the use of client operating card machine phenomenon, can not be done, we need to open a new client terminal, mount the disk to lift off in the http service site can operate normally, and remember not to use when unmounting the new terminal tab key completion directory information, be sure to hand fighting, if using the tab key will complement the operation or card machine, remember! ! ! Remember! ! !

Guess you like

Origin blog.51cto.com/14473285/2438710
Recommended