本文共 3271 字,大约阅读时间需要 10 分钟。
基于RPM包构建的软件更新机制,可以自动解决依赖关系,所有软件包由集中的YUM软件仓库提供。
网络源
本地源
mkdir -p /var/ftp/CentOS7cp -rf /dev/cdrom/* /var/ftp/CentOS7rpm -ivh /dev/cdrom/Packages/vsftp-3.0.2-21.el7.x86_64.rpmsystemctl start vsftpdsystemctl enabled vsftpd
mkdir -p /var/ftp/othercd /var/ftp/othercreaterepo -g /dev/cdrom/repodata/repomd.xml ./
vim /etc/yum.repos.d/centos7.repo[base] #仓库类别name=CentOS 7.3 #仓库名称baseurl=ftp:///192.168.4.254/CentOS7 #URL访问路径enabled=1 #启用此软件仓库gpgcheck=1(或0:表示不验证公钥) #验证软件包的签名gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 (软件校验公钥) #GPG公钥文件的位置[other]name=Other RPM Packagesbaseurl=ftp:///192.168.4.254/otherenabled=1gpgcheck=0
1、查询软件包
yum list [软件名]yum info [软件名]yum search <关键字> yum whatprovides <关键字>关键字> 关键字>
2、查询软件包组
yum grouplist [包组名]yum groupinfo <包组名>包组名>
3、安装软件
yum install [软件名]yum groupinstall <包组名>包组名>
4、升级软件
yum updaeyum groupupdate
5、卸载软件
yum remove <软件名> yum groupremove <包组名>包组名> 软件名>
nfs-utils用于 NFS 共享发布和访问
rpcbind用于 RPC 支持
(1)安装 nfs-utils、rpcbind 软件包
mkdir -p /opt/sharechmod 777 /opt/share/vim /etc/exports/opt/share 192.168.217.0/24(rw,sync,no_root_squash)客户机地址可以是主机名、IP 地址、网段地址,允许使用“*”、“?”通配符。
常用选项:
“rw” 表示允许读写,“ro” 表示为只读;
sync :表示同步写入到内存与硬盘中。 async :将数据先保存在内存缓冲区中,必要时才写入磁盘。 no_root_squash : 表示当客户机以root身份访问时赋予本地root权限(默认是root_squash)。 root_squash :表示客户机用root用户访问该共享目录时,将root用户映射成匿名用户。 all_squash :所有访问用户都映射为匿名用户或用户组。 subtree_check(默认):若输出目录是一个子目录,则nfs服务器将检查其父目录的权限。 no_subtree_check :即使输出目录是一个子目录,nfs服务器也不检查其父目录的权限,这样可以提高效率。
其他例子:
/var/ftp/pub 192.168.163.11(ro) 192.168.163.110(rw) /share *(rw,sync)
systemctl start rpcbindsystemctl start nfs #开启服务systemctl enable rpcbindsystemctl enable nfs #设置为开机自启netstat -anpt | grep 111 #查看rpcbind端口111是否开启, rpcbind默认使用tcp端口111
exportfs -rv #发布共享showmount -e #查看共享
(1) 安装 nfs-utils、rpcbind 软件包
rpm -q rpcbind nfs-utils yum -y install nfs-utils rpcbindsystemctl start rpcbindsystemctl enable rpcbindsystemctl stop firewalld.service setenforce 0#查看 NFS 服务器端共享了哪些目录showmount -e 192.168.217.3
方法一:手动挂载mkdir /mysharemount 192.168.163.10:/opt/share /myshare方法二:自动挂载vim /etc/fstab192.168.163.10:/opt/share /myshare nfs defaults,_netdev 0 0_netdev :表示挂载设备需要网络mount -a #挂载 fstab 中的所有文件系统df -Th #确认挂载结果
手动挂载
如果服务器端NFS服务突然间停掉了,而客户端正在挂载使用时,在客户端就会出现执行 df -h 命令卡死的现象。这个时候直接使用umount 命令是无法直接卸载的,需要加上 -lf 选项才能卸载。umount -lf /myshare
转载地址:http://jtbb.baihongyu.com/