创建yum源仓库服务器

作者: admin 分类: Linux 发布时间: 2019-07-02 15:05 浏览:1,659 次    

环境:centos7.4

server ip:10.0.0.3

  • 服务器端配置:

1、配置nginx

[root@yum_server ~]#  yum -y install nginx
[root@yum_server ~]# mkdir -p /data/yum-server/os
[root@yum_server ~]# cat << eof > /etc/nginx/conf.d/yum.conf
autoindex on;  #显示目录
autoindex_exact_size on;   # 显示文件大小
autoindex_localtime on;    # 显示文件时间
server {
listen 80;
root /data/yum-server;
}
eof
[root@yum_server ~]# systemctl start nginx

2、复制rpm文件

[root@yum_server ~]# mount /dev/sr0 /mnt
[root@yum_server ~]# cp /mnt/Packages/* /data/yum-server/os/

3、创建yum数据库

[root@yum_server ~]# yum install createrepo -y
[root@yum_server ~]# createrepo /data/yum-server/os/
Spawning worker 0 with 445 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
  • 客户端配置:
[root@qunniao ~]# cat << eof > /etc/yum.repos.d/centos.repo
[base]
name=centos yum server
baseurl=http://10.1.1.3/os/
gpgcheck=0
eof
[root@qunniao ~]# yum clean all
[root@qunniao ~]# yum list
[root@qunniao ~]# yum install gcc -y #安装测试

温馨提示:如无特殊说明,本站文章均为作者原创,转载时请注明出处及相应链接!

发表评论