yum &&nfs&&nginx

2 篇文章 0 订阅
2 篇文章 0 订阅

 Yum -nfs

1.1.关于yum的命令使用

扩展yum  yum install yuum-ytils -y

[root@localhost /]# yum install yum-utils -y

已加载插件:fastestmirror, langpacks

1.2.生成缓存

[root@localhost /]# yum makecache

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

                                              

1.3.查看所有的yum源

[root@localhost /]# yum repolist

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached

1.4.查看安装软件包

[root@localhost /]# yum list zabbix*

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * alibase: mirrors.aliyun.com

 * aliextras: mirrors.aliyun.com

 * aliupdates: mirrors.aliyun.com

1..5查看包得信息

 

[root@localhost /]# yum info nginx

1.6安装包

[root@localhost /]# yum install nginx

1.7重新安装包

[root@localhost /]# yum reinstall nginx

1.8查看文件有那个包提供

[root@localhost /]# yum provides  wget

.

2.1搭建本地源

创建挂载文件目录

[root@localhost /]# mkdir -p /mnt/cdrom

2.2.实现挂载

[root@localhost /]# mount /mnt/cdrom/ /dev/cdrom

mount: /mnt/cdrom 不是一个块设备

2.3创建local yum源

[root@localhost yum.repos.d]# vim local.repo

[local]

name=Centos-7-local

baseurl=file:///mnt/cdrom

3.1nfs的搭建

3.2关闭防火墙和selinux

[root@localhost yum.repos.d]# systemctl stop firewalld

[root@localhost yum.repos.d]# setenforce 0

3.3安装nfs的安装包

[root@localhost yum.repos.d]# yum  install nfs-utils -y

 

3.4配置服务端

[root@localhost yum.repos.d]# vim /etc/exports

/data/jackios    192.168.217.133(rw,sync)

(sync,wdelay,hide,no_subtree_check,sec=sys,

rw,secure,no_root_squash,no_all_squash)

其中:

rw:可读可写

ro:仅可读

sync:是指数据同步写入内存和磁盘

root_squash:如果客户端用root身份访问,则被压缩成nobody,权限也将受

到限制。

no_root_squash:也就是不压缩,客户端使用root身份登录,全有所有权

限,很危险。

all_squash:不管访问者是什么身份,包括root,全部压缩至匿名用户。

no_all_squash:保留访问用户的身份uid以及gid,一般只能查看,不能修

改,权限问题,但是可以强制保存。

~

3.5重启rpcbind和nfs 导出广播

~

[root@localhost yum.repos.d]# systemctl start rpcbind

[root@localhost yum.repos.d]# systemctl start nfs

[root@localhost yum.repos.d]# exportfs -r

3.6 查看挂载点

[root@v1 ~]# showmount -e 192.168.217.131

3.7安装autonfs

[root@v1 ~]# yum install autofs -y

3.8配置/etc/auto.master

/misc   /etc/auto.misc

/data/nfs /etc/nfs.misc

 

viim  /etc/nfs.misc

xiaoming -fstype=nfs,rw,sync 192.168.217.131:/data/jackios

xiaowang -fstype=nfs,ro,sync 192.168.217.131:/data/jackios

3.8启动autofs服务

[root@v1 nfs]# systemctl start autofs

效果如图

4.1配置epel源

[root@v1 nfs]# vim /etc/yum.repos.d/epel.repo

[epel]

name=epel-qinghua-7

baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/

gpgcheck=1

gpgkey=https://mirrors.tuna.tsinghua.edu.cn/epel/RPM-GPG-KEY-EPEL-7

4.2 安装nginx

[root@v1 nfs]# yum install nginx -y

4.3启动nginx

[root@v1 nfs]# nginx

4.4安装yum扩展和createrepo包和发布目录

reposync由yum-utils提供

[root@v1 nfs]# mkdir -p /usr/share/nginx/html/centos/7

[root@v1 nfs]# yum install yum-utils createrepo -y

4.5将update同步到发布目录

原因其他的太大就不一一同步了

[root@v1 nfs]# reposync -r updates -p /usr/share/nginx/html/centos/7

 

-r 是repolist的id  -p指定下载路径

4.6修改nginx的配置文件

[root@v1 ~]# vim /etc/nginx/nginx.conf

 

    location / {

        root   /usr/share/nginx/html/centos/7;

        index  index.html index.htm;

        autoindex on;

    }

在location中 index后面添加

 

  autoindex on;

4.7 生成元数据

[root@v1 nfs]# createrepo  /usr/share/nginx/html/centos/7

 

[root@v1 nfs]# ls -rtl /usr/share/nginx/html/centos/7

总用量 4

drwxr-xr-x 3 root root   22 5月  14 17:54 updates

drwxr-xr-x 2 root root 4096 5月  14 18:15 repodata

出现repodata就可以了

4.8看效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值