vlambda博客
学习文章列表

centos6使用rpm方式安装nfs

  • 背景

1、是这样的,已有nfs存储服务器,要把几台机器也加入nfs挂载,正常来说就是一条命令解决:

mount -t nfs -o nolock 192.168.1.13:/disk/xiaodai /home/xiaodai/disk1

但是报错了,报错内容就是客户端服务器没安装nfs,如图:

[root@localhost nfs_rpm]# mount -t nfs -o nolock 192.168.1.13:/disk/xiaodai /home/xiaodai/disk1mount: wrong fs type, bad option, bad superblock on 192.168.1.13:/disk/xiaodai, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail or so


2、行吧,知道了是没有nfs那就安装吧

常规就命令安装就完了

yum -y install nfs-utils

但是事实没那么简单,还是报错了哈,先人板板

就是找不到包,让你尝试其他镜像源,我换了阿里163都不能通过yum命令调用资源,报错如图:


centos6使用rpm方式安装nfs


centos6使用rpm方式安装nfs


就一条命令的事咋那么费劲,我去,原来是centos6老古董,我尝试安装 yum install tree -y 也是爆404行吧,


CentoS6 停止维护更新日期:20201130
CentoS7 停止维护更新日期: 20246
CentoS8 停止维护更新日期: 20295
2020122日,centos官方停止了对centos6的所有更新,并且下架了包括官方所有的centos6源,目前阿里、163、清华等centos6源已无法使用。


  • 解决方法


2、将资源包上传到服务器,并解压,得到以下rpm包,执行安装这些包有步骤顺序哈。如图:

[root@risk57 ~]# cd /home/bkb/[root@risk57 bkb]# lslogs nacos nfs_rpm.zip[root@risk57 bkb]# unzip nfs_rpm.zip Archive: nfs_rpm.zip creating: nfs_rpm/ inflating: nfs_rpm/keyutils-1.4-4.el6.x86_64.rpm  inflating: nfs_rpm/keyutils-libs-1.4-4.el6.x86_64.rpm  inflating: nfs_rpm/libevent-1.4.13-4.el6.x86_64.rpm  inflating: nfs_rpm/libgssglue-0.1-11.el6.x86_64.rpm  inflating: nfs_rpm/libtirpc-0.2.1-5.el6.x86_64.rpm  inflating: nfs_rpm/nfs-utils-1.2.3-26.el6.x86_64.rpm  inflating: nfs_rpm/nfs-utils-lib-1.1.5-4.el6.x86_64.rpm  inflating: nfs_rpm/rpcbind-0.2.0-9.el6.x86_64.rpm [root@risk57 bkb]# lslogs nacos nfs_rpm nfs_rpm.zip[root@risk57 bkb]# cd nfs_rpm[root@risk57 nfs_rpm]# lskeyutils-1.4-4.el6.x86_64.rpm libevent-1.4.13-4.el6.x86_64.rpm libtirpc-0.2.1-5.el6.x86_64.rpm nfs-utils-lib-1.1.5-4.el6.x86_64.rpmkeyutils-libs-1.4-4.el6.x86_64.rpm libgssglue-0.1-11.el6.x86_64.rpm nfs-utils-1.2.3-26.el6.x86_64.rpm rpcbind-0.2.0-9.el6.x86_64.rpm[root@risk57 nfs_rpm]# rpm -ivh libgssglue-0.1-11.el6.x86_64.rpm3-26.el6.x86_64.rpm --nodeps --forcewarning: libgssglue-0.1-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:libgssglue ########################################### [100%][root@risk57 nfs_rpm]# [root@risk57 nfs_rpm]# rpm -ivh libtirpc-0.2.1-5.el6.x86_64.rpmwarning: libtirpc-0.2.1-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:libtirpc ########################################### [100%][root@risk57 nfs_rpm]# [root@risk57 nfs_rpm]# rpm -ivh rpcbind-0.2.0-9.el6.x86_64.rpmwarning: rpcbind-0.2.0-9.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:rpcbind ########################################### [100%][root@risk57 nfs_rpm]# [root@risk57 nfs_rpm]# rpm -ivh libevent-1.4.13-4.el6.x86_64.rpmwarning: libevent-1.4.13-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:libevent ########################################### [100%][root@risk57 nfs_rpm]# [root@risk57 nfs_rpm]# rpm -ivh nfs-utils-lib-1.1.5-4.el6.x86_64.rpm --nodeps --forcewarning: nfs-utils-lib-1.1.5-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:nfs-utils-lib ########################################### [100%][root@risk57 nfs_rpm]# [root@risk57 nfs_rpm]# rpm -ivh nfs-utils-1.2.3-26.el6.x86_64.rpm --nodeps --forcewarning: nfs-utils-1.2.3-26.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:nfs-utils ########################################### [100%][root@risk57 nfs_rpm]# service rpcbind startStarting rpcbind: [ OK ][root@risk57 nfs_rpm]# service nfs startStarting NFS services: [ OK ]Starting NFS mountd: [ OK ]Starting NFS daemon: [ OK ]


centos6使用rpm方式安装nfs


如上图其实就已经安装好了nfs,剩下的就是挂载nfs存储了


3、创建目录挂载

至此挂载完成,活干完了差不多

[root@risk57 nfs_rpm]# mkdir -p /home/xiaodai/disk1[root@risk57 nfs_rpm]# mount -t nfs -o nolock 192.168.1.13:/disk/xiaodai /home/xiaodai/disk1[root@risk57 nfs_rpm]# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root 91G 29G 57G 34% /tmpfs 7.8G 0 7.8G 0% /dev/shm/dev/sda1 190M 29M 151M 16% /boot192.168.1.13:/disk/xiaodai 72T 39T 34T 54% /home/xiaodai/disk1

centos6使用rpm方式安装nfs


4、设置服务开机自启动

将上面那个挂载的命令写入/etc/rc.local 

[root@risk58 ~]# tail -1f /etc/rc.local mount -t nfs -o nolock 192.168.1.13:/disk/xiaodai /home/xiaodai/disk1


然后服务自启动

[root@risk57 nfs_rpm]# chkconfig --level 345 nfs on[root@risk57 nfs_rpm]# chkconfig --level 345 rpcbind on 


  • 最后

就是centos6不支持维护了啊,连源都没了,每次都这么找包去安装不方便的,建议大家还是酌情升级啊!