Linux搭建yum仓库

1、安装nginx,修改配置文件

server {
        autoindex on; #显示目录
        autoindex_exact_size on; #显示文件大小
        autoindex_localtime on; #显示创建时间

        listen       80;
        server_name  localhost;
        root /share;
}

2、创建yum存储库
2.1 创建yum存储库目录,即放置rpm包的目录
mkdir -p /share/centos/      #递归创建目录
chown -R 777 /share          #所有者权限设置
2.2 yum安装createrepo
yum install createrepo -y

2.3 创建yum存储库
createrepo /share/centos/    #建立存储库

2.4 创建yum源文件mylocal.repo

vi /etc/yum.repos.d/mylocal.repo
[mylocal]
name=local_repo
baseurl=http://192.168.141.134/centos/$basearch
gpgcheck=0
enabled=1

2.5加载测试

yum clean all           #清空yum缓存
yum makecache           #加载可用yum元数据
yum repolist            #查看yum源rpm包的具体情况

猜你喜欢

转载自www.cnblogs.com/xiaofengfree/p/10809731.html
今日推荐