赞
踩
命令 | 含义 |
---|---|
yum list | 显示所有可用的包 |
yum info | 显示所有可用的包的信息 |
yum search | 模糊查找所有相关信息 |
yum whatprovides | 精确查找 |
yum install | 安装具体软件包 |
yum update | 升级软件包 |
yum remove | 卸载软件包 |
yum history | 查看yum操作历史 |
yum history info | 加序列号列出某次操作的详细信息 |
yum的配置文件:/etc/yum.conf
注意:只有在线源可以缓存下载的软件包,本地源无法缓存
本地源的搭建在之前Linux软件安装和管理中已经写过了,此处不再赘述
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# systemctl start httpd
[root@localhost yum.repos.d]# cd /var/www/html/
[root@localhost html]# mkdir centos7
[root@localhost html]# mount /dev/cdrom /var/www/html/centos7/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost html]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 47G 3.6G 43G 8% /
devtmpfs 969M 0 969M 0% /dev
tmpfs 984M 0 984M 0% /dev/shm
tmpfs 984M 9.2M 975M 1% /run
tmpfs 984M 0 984M 0% /sys/fs/cgroup
/dev/sda1 950M 179M 772M 19% /boot
tmpfs 197M 4.0K 197M 1% /run/user/42
tmpfs 197M 48K 197M 1% /run/user/0
/dev/sr0 4.3G 4.3G 0 100% /var/www/html/centos7
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir backup
[root@localhost yum.repos.d]# mv *.repo backup/
[root@localhost yum.repos.d]# ls
backup
[root@localhost yum.repos.d]# vim httpd.repo
[httpd]
name=httpd
baseurl=http://192.168.147.100/centos7
gpgcheck=0
:wq!
[root@localhost yum.repos.d]# yum clean all && yum makecache
已加载插件:fastestmirror, langpacks
正在清理软件源: httpd
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
已加载插件:fastestmirror, langpacks
httpd | 3.6 kB 00:00:00
(1/4): httpd/group_gz | 156 kB 00:00:00
(2/4): httpd/primary_db | 3.1 MB 00:00:00
(3/4): httpd/filelists_db | 3.1 MB 00:00:00
(4/4): httpd/other_db | 1.2 MB 00:00:00
Determining fastest mirrors
元数据缓存已建立
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost yum.repos.d]# yum -y install vsftpd
[root@localhost yum.repos.d]# systemctl start vsftpd
[root@localhost yum.repos.d]# umount /dev/cdrom /var/www/html/centos7/ //解挂载 umount: /var/www/html/centos7/:未挂载 [root@localhost yum.repos.d]# cd /var/ftp/ [root@localhost ftp]# mkdir centos7 [root@localhost ftp]# ls centos7 pub [root@localhost ftp]# mount /dev/cdrom /var/ftp/centos7/ mount: /dev/sr0 写保护,将以只读方式挂载 [root@localhost ftp]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 47G 3.7G 43G 8% / devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.2M 975M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/sda1 950M 179M 772M 19% /boot tmpfs 197M 4.0K 197M 1% /run/user/42 tmpfs 197M 48K 197M 1% /run/user/0 /dev/sr0 4.3G 4.3G 0 100% /var/ftp/centos7
[root@localhost ftp]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf httpd.repo
[root@localhost yum.repos.d]# ls
backup
[root@localhost yum.repos.d]# vim ftpd.repo
[ftpd]
name=ftpd
baseurl=ftp://192.168.147.100/centos7
gpgcheck=0
:wq!
[root@localhost yum.repos.d]# yum clean all && yum makecache
已加载插件:fastestmirror, langpacks
正在清理软件源: ftpd
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
已加载插件:fastestmirror, langpacks
ftpd | 3.6 kB 00:00:00
(1/4): ftpd/group_gz | 156 kB 00:00:00
(2/4): ftpd/filelists_db | 3.1 MB 00:00:00
(3/4): ftpd/primary_db | 3.1 MB 00:00:00
(4/4): ftpd/other_db | 1.2 MB 00:00:00
Determining fastest mirrors
元数据缓存已建立
NFS是网络上共享文件系统的协议,允许多个服务器通过,共享文件和目录
服务端:将指定的目录标记为共享目录,给这个目录权限。(777,全部权限)
客户端:通过NFS协议,发送请求到服务端,获取操作这个共享目录的权限
共享文件服务器,集群环境,分布式存储系统
服务名 | 作用 | 端口号 | 协议 |
---|---|---|---|
rpcbind | 远程共享调用 | 111 | TCP |
nfs-utils | 提供共享服务 | 2049 | TCP |
权限 | 含义 |
---|---|
rw | 读写权限 |
ro | 只能读 |
no_root_squash | 客户端以root用户访问服务器,赋予本地root权限 |
root_squash | 客户端以root用户访问服务器,root用户映射成匿名用户 |
all_squash | 所有访问服务器的用户都映射为匿名用户 |
虚拟机1
[root@localhost ~]# vim /etc/exports
/opt/share 192.168.147.0/24(rw,sync,no_root_squash)
:wq!
[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir share
[root@localhost opt]# chmod 777 share
[root@localhost opt]# systemctl start rpcbind
[root@localhost opt]# systemctl start nfs
虚拟机2
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# mkdir /myshare
[root@localhost ~]# mount 192.168.147.100:/opt/share /myshare
验证:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。