为什么需要私有YUM仓库
1.下载速度慢
2.需要有外网
3.有些Base源和epel源软件没有,需要单独创建下载源
需要的软件:
createrepo
nginx
操作步骤:
1.配置nginx索引模块
[root@web01 ~]# cat /etc/nginx/conf.d/index.conf
server {
listen 80;
server_name yum.mysun.com;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
autoindex_format html;
charset utf-8,gbk;
root /data/yum;
index index.html index.htm;
}
}
2.安装createrepo
yum install createrepo -y
3.准备软件仓库目录并下载需要的软件
yum install --downloadonly --downloaddir=/data/yum nginx screen vim tree -y
4.生成yum元数据
createrepo /data/yum
5.客户端生成本地源
[root@web02 ~]# cat /etc/yum.repos.d/local.repo
[local]
name=local
enable=1
gpgcheck=0
baseurl=http://10.0.0.7
6.客户端测试安装
yum makecache
yum search nginx
yum install nginx
更新软件包的操作步骤:
第一种方法:真实下载
1.打开yum缓存
[root@web01 /data/yum]# grep "keepcache" /etc/yum.conf
keepcache=1
2.清空原来的缓存
yum clean all
3.下载软件php
yum remove php-mysql-5.4 php php-fpm php-common
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache -y
4.移动已经缓存下来的rpm包到yum仓库目录
find /var/cache/yum/ -type f -name "*.rpm"|xargs mv -t /data/yum/
5.生成新的yum元数据
createrepo --update /data/yum/
第二种方法:只下载不安装
yum install --downloadonly --downloaddir=/data/yum php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache
网友评论