搭建yum仓库服务器

安装

1.安装linux

1.1安装依赖

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

1.2下载

cd /opt/nginx
wget http://nginx.org/download/nginx-1.25.3.tar.gz

1.3解压

tar -xvf nginx-1.25.3.tar.gz

1.4配置

cd nginx-1.25.3
./configure --prefix=/opt/nginx/nginx-1.25.3-installed

1.5安装

make && make install 

2.配置nginx

2.1修改nginx.conf

vim nginx.conf

内容修改为如下 

        location / {
            #root   html;
            #index  index.html index.htm;
            autoindex on;  ##autoindex模块,服务器自动列出目录中的文件和子目录
            root /opt/nginx/nginx-1.25.3-installed/html;  ##指定根目录为/opt/nginx/nginx-1.25.3-installed/html
        }

2.2挂载

2.2.1放入文件

将CentOS-7-x86_64-Minimal-1810.iso放在/opt目录下

2.2.2创建挂载目录
mkdir -p /opt/nginx/nginx-1.25.3-installed/html/CentOS-7-x86_64-Minimal-1810
2.2.3挂载文件
mount -o loop /opt/CentOS-7-x86_64-Minimal-1810.iso /opt/nginx/nginx-1.25.3-installed/html/CentOS-7-x86_64-Minimal-1810

3.配置yum仓库

3.1备份yum仓库配置

cd /etc/yum.repos.d
cp CentOS-Base.repo CentOS-Base.repo.backup_20210209_0934

3.2 修改yum仓库配置

增加如下内容

[centos]
name=Cent0S1810
baseurl=http://192.168.168.110:20080/CentOS-7-x86_64-Minimal-1810
gpgcheck=0
gpgkey=http://192.168.168.110:20080/CentOS-7-x86_64-Minimal-1810/RPM-GPG-KEY-CentOS-7
enabled=1

3.3清理yum缓存并重新缓存

yum clean all
yum makecache

初体验

1.nginx初体验

打开浏览器

nginx端口号/CentOS-7-x86_64-Minimal-1810

我的地址

http://192.168.168.110:20080/CentOS-7-x86_64-Minimal-1810/

搭建yum仓库服务器_第1张图片

2.yum初体验 

yum -y install vim 

你可能感兴趣的:(服务器,linux,yum)