目录
yum
centos7 yum包都是rpm
centos8 dhf,与yum一样,命令也一样
Ubuntu 用apt 包格式.deb
软件仓库提供方式
1.http方式的yum源
2.ftp方式的yum源
3.混合源,本地源与在线源在一块
yum命令的运用
yum list 显示所有可用包(可以后跟包名,显示具体的软件包)
yum info 显示所有可用包的信息(后跟包名,显示单个包的相关信息)
yum search 模糊查找所有的相关信息
yum whatprovides 精确查找
yum install 安装具体软件包
yum remove 卸载具体软件
相关文件位置
yum日志文件 /var/log/yum.log
yum配置文件 /etc/yum.conf
可以在yum.repos.d目录下可以放多个源,但本地yum源最好单独放
配置
本地yum源
mount /dev/cdrom /mnt
cd /etc/yum.repo.d/
mkdir repo.bak
mv * repo.bak
vim local.repo
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
yum clean all && yum makecache
http方式yum源
[test]
name=test
baseurl=http://192.168.233.21/centos7
gpgcheck=0
enabled=1
ftp方式yum源
yum install -y vsftpd
cd /var/ftp
mkdir centos7
mount /dev/sr0 /var/ftp/centos7/
systemctl start vsftpd
搭建仓库
vim local.repo
[local]
name=local
baseurl=ft://192.168.233.21/centos7
gpgcheck=0
混合源
vim local.repo
[test1]
name=test1
baseurl=file:///mnt
gpgcheck=0
enabled=1
priority=1
[test]
name=test
baseurl=https://mirrors.aliyun.com/epel/7Server/x86_64/
gpgcheck=0
enabled=1
priority=2
NFS共享服务
NFS network file system 计算机网络上共享文件系统的协议。不同的计算机通过网络可以使用一个共享的目录,集中统一,方便管理。
工作原理
服务器指定一个目录,作为共享目录,也可以多个,需要授权给其他服务器可以使用共享目录,客户端通过NFS协议发送请求到共享目录的服务器,获取操作共享目录的权限。NFS使用RPC协议来实现客户端之间的通信
NFS特点
1.共享性,多个客户端可以同时访问和共享同一个文件系统,也可以理解为目录,方便文件共享、协作
2.透明性,只管用,不关心底层网络细节
3.性能高,NFS在文件的访问速度和性能优化,提供高效的共享服务
4.可靠性,NFS提供机制来确保文件的完整性和一致性
NFS配置文件 /etc/exports 配置共享目录以及客户机地址、权限选项
nfs 共享
rpcbind 远程调用共享,通信
共享多个目录并永久挂载
服务端与客户端关闭防火墙、安全机制
systemctl stop firewalld
setenforce 0
yum -y install nfs-utils
yum -y install rpcbind
服务端
vim /etc/exports
/opt/share1 192.168.233.0/24 (rw,sync,no_root_squash)
/opt/share2 192.168.233.0/24 (rw,sync,no_root_squash)
/opt/share3 192.168.233.0/24 (rw,sync,no_root_squash)
mkdir share1 share2 share3
chmod 777 share1
chmod 777 share2
chmod 777 share3
systemctl start rpcbind
systemctl start nfs
showmount -e
rw 可读可写
sync 同步写入到硬盘中
no_root_aquash客户机以root用户访问时,会给予本地root用户的权限
root_squash 如果客户机以root用户访问时,会映射成一个匿名用户
all_squash 所有访问用户都映射为匿名用户或用户组
showmount -e 查看本机发布的nfs目录
注:先开rpcbind再开nfs,否则可能会报错
客户端
showmount -e 192.168.233.10
mkdir test1 test2 test3
vim /etc/fstab
192.168.233.10:/opt/share1 /opt/test1 nfs defaults 0 0
192.168.233.10:/opt/share2 /opt/test2 nfs defaults 0 0
192.168.233.10:/opt/share3 /opt/test3 nfs defaults 0 0