yum仓库部署

第1章 yum仓库搭建
1.1 创建yum仓库目录

mkdir -p /base
上传rpm包到此目录,此目录下面还可以包括文件夹

1.2 createrepo软件

yum -y install createrepo

1.3 初始化repodata索引文件

createrepo -pdo /base /base

1.4 提供yum服务

可以用Apache或nginx提供web服务,但用Python的http模块更简单,适用于内网环境
cd /base
python -m SimpleHTTPServer 80 &>/dev/null &
可以通过浏览器输入本机IP查看

1.5 添加新的rpm包

只下载rpm包不安装
yum -y install --downloadonly --downloaddir=/tmp/ "要下载的rpm包"
--downloadonly    只下载不安装
--downloaddir=    下载到指定位置
或者
yumdownloader pcre-devel openssl-devel 
createrepo --update /base   
# 每加入一个rpm包就要更新一下

1.5.1 平时yum安装软件时不删除安装包

# cat /etc/yum.conf 
keepcache=1
# 安装包存储目录
cachedir=/var/cache/yum/$basearch/$releasever
# /var/cache/yum/x86_64/6/base/packages

1.6 客户端配置
1.6.1 本地配置方法

cat /etc/yum.repos.d/base.repo    (本地)
[base]
name=local repo
baseurl=file:///base
enable=1
gpgcheck=0

1.6.2 网络配置方法

cat /etc/yum.repos.d/base.repo    (网络)
[base]
name=local repo
baseurl=http://172.16.1.55/base   
enable=1
gpgcheck=0

1.7 配置完yum源执行

yum clean all
yum makecache

第2章 扩展:
2.1 nginx配置方法

yum -y install nginx

# config: /etc/nginx/nginx.conf     安装目录
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# 日志文件在var/log/nginx

2.2 nginx配置文件如下:

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       81;
        server_name  www.tiandi.com;
        location / {
            root   /base/;
            autoindex on;         #开启nginx的目录浏览
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

2.3 启动nginx

/etc/init.d/nginx start
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维那些事~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值