YUM
yum仓库常用类型:
本地源仓库:baserul=file://
在线源仓库:baserul=http://
ftp源仓库:baseru=:ftp://
实验:
首先安装软件
[root@localhost yum.repos.d]# cd /mnt/Packages/
[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-29.el7_9.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...1:vsftpd-3.0.2-29.el7_9 ################################# [100%]
[root@localhost Packages]# systemctl start vsftpd
[root@localhost Packages]# ls
然后吧文件全部复制到var ftp目录中
root@localhost Packages]# cp * /var/ftp/
使用命令解决依赖包
[root@localhost ftp]# createrepo ./
[root@localhost ftp]# ls -l | grep "^d"
drwxr-xr-x. 2 root root 6 6月 10 2021 pub
drwxr-xr-x. 2 root root 4096 4月 29 15:51 repodata
[root@localhost ftp]# cd repodata/
[root@localhost repodata]# ls
2242dc8998cf776b2548853ea2b452a8ad7b0a63ef5db520b659fd732ae6e677-filelists.xml.gz
867d168de0c2cb822f6220cbdbcd2242c3f083ae6b39784dd6b33ee42c676c1a-filelists.sqlite.bz2
90ca66818b28dce26d35c2b2b0e52b52b5cfb17fc517b83f6434319a41a5177e-other.sqlite.bz2
ca828f53e76e9d26d975d99b33c50c76076721f05d6105b6fe415deafa0787a4-primary.xml.gz
e03cac5ae7e5c9c222e382027983701a9d50931a28dd838a57659812b76fca63-other.xml.gz
e0bc97d18fada6ba4fa03a81471f89eedaf8a1f6c1641ca481dd7b4b8845c189-primary.sqlite.bz2
repomd.xml
然后关闭防火墙
[root@localhost repodata]# systemctl stop firewalld
[root@localhost repodata]# setenforce 0
然后另起一台电脑也是这样关闭防火墙 然后对另一台主机配置yum仓库
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mv local.repo ftp.repo
[root@localhost yum.repos.d]# ls
ftp.repo ren.bak
[root@localhost yum.repos.d]# vim ftp.repo[ftp]
name=ftp
baseurl=ftp://192.168.80.66/ #主机ip 注意要到根目录
enabled=1
gpgcheck=0
~
[root@localhost yum.repos.d]# yum clean all #清空yum缓存
已加载插件:fastestmirror, langpacks
正在清理软件源: ftp
Cleaning up list of fastest mirrors
Other repos take up 872 M of disk space (use --verbose for details)
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
ftp | 2.9 kB 00:00:00
(1/3): ftp/primary_db | 3.3 MB 00:00:00
(2/3): ftp/filelists_db | 3.3 MB 00:00:00
(3/3): ftp/other_db | 1.3 MB 00:00:00
元数据缓存已建立这时候我们就能安装了
[root@localhost yum.repos.d]# yum install -y httpd
yum list (软件名) #查看软件
yum info (软件名) #查看软件的相关数据
yum search (关键词) #根据关键词修改软件包
yum whatprovides (关键词) #根据关键词查找软件包
yum update #更新软件
nfc
依赖于RPC
系统服务:nfs rpcbind
共享配置文件: /etc/exports
Linux系统使用的共享存储服务 NFS端口2049
windows系统使用的共享服务 CTFS端口111
存储类型:
块存储 硬盘 LVM RAID
文件存储 NFS
对象存储 OSS
实验:
第一步关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# vim /etc/selinux/config# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
然后yum安装
[root@localhost ~]# yum install -y rpcbind nfs-utils
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 rpcbind-0.2.0-49.el7.x86_64 已安装并且是最新版本
软件包 1:nfs-utils-1.3.0-0.68.el7.2.x86_64 已安装并且是最新版本
无须任何处理
创建共享目录
[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir ren1
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 2 root root 6 4月 29 16:45 ren1
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
然后编译
[root@localhost opt]# vim /etc/exports
/opt/ren1 192.168.80.0/24 (rw,sync,) #先跟上共享目录 在跟上网段 在跟上参数[root@localhost opt]# systemctl enable --now rpcbind
[root@localhost opt]# systemctl enable --now nfs
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.用命令查看本地是否共享出来了
[root@localhost opt]# showmount -e
Export list for localhost.localdomain:
/opt/ren1 192.168.80.0/24
先创建一个空目录
oot@localhost ~]# mkdir /data
[root@localhost ~]# mount 192.168.80.66:/opt/ren1 /data
[root@localhost ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 14M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 17G 5.2G 12G 31% /
/dev/sda1 xfs 1014M 187M 828M 19% /boot
tmpfs tmpfs 378M 44K 378M 1% /run/user/1000
/dev/sr0 iso9660 4.5G 4.5G 0 100% /mnt
tmpfs tmpfs 378M 40K 378M 1% /run/user/0
192.168.80.66:/opt/ren1 nfs4 38G 4.4G 33G 12% /data
这时候我们的挂载过来了
然后echo创建几个文件 便可以实现多平台cat查看
注意如果我们的客户端挂载目录卡死可以使用umount -lf 挂载目录