当前位置: 首页 > news >正文

商丘手机网站制作西安怡佳然网络科技有限公司

商丘手机网站制作,西安怡佳然网络科技有限公司,asp和php的建站区别,北京互联网排名Centos7 用http ftp搭建本地yum源文章标签: centos linux 服务器一、环境准备1.准备2-3台虚拟机,一台为服务端(安装yum源),其余的为客户端(测试yum源安装结果),最好是同网段的。IP地…

Centos7 用http ftp搭建本地yum源

文章标签: centos linux 服务器

一、环境准备

1.准备2-3台虚拟机,一台为服务端(安装yum源),其余的为客户端(测试yum源安装结果),最好是同网段的。

IP地址 角色 备注

192.168.116.5 服务端 将完整镜像上传到这台机器

192.168.116.15 客户端

2.准备镜像文件,这里以CentOS-7-x86_64-2009,当然最好是使用CentOS-7-x86_64-Everything-2207-02.iso(这是完整版,包含了所有软件组件,当然体积也庞大,高达9.58G。对完整版安装盘的软件进行补充,集成所有软件;不要使用mini版)

3.准备远程软件,secucrt或者FinalShell、xshell都可

4.关闭防火墙,每一台都要关闭,包括selinux。

[root@test1 yum.repos.d]# systemctl stop firewalld

[root@test1 yum.repos.d]# systemctl disabled firewalld    //设置防火墙开机不自启

root@test1 yum.repos.d]# setenforce 0        //将selinux临时状态调整为开启

[root@test1 yum.repos.d]# getenforce        //查看selinux状态

5.备份yum源

[root@test1 ~]# cd /etc/yum.repos.d   //yum的配置文件所在

[root@test1 yum.repos.d]# mkdir bak

[root@test1 yum.repos.d]# mv *.repo bak/

[root@test1 yum.repos.d]# ls

bak

//注每台机器都要进行这一步操作

6.创建yum_http.repo文件 (本地yum源)

[root@test1 yum.repos.d]# vi yum_http.repo

将一下内容写入

[centos]

name=centos       

baseurl=file:///opt/centos

gpgcheck=0

enabled=1

7.创建目录将镜像上传至/opt/centos 

[root@test1 yum.repos.d]# mkdir  /opt/centos

[root@test1 yum.repos.d]# cd /opt/centos

[root@test1 centos]# ls

CentOS-7-x86_64-DVD-2009.iso  

[root@test1 centos]# mount /opt/centos/CentOS-7-x86_64-DVD-2009.iso /opt/centos    //挂载镜像文件,简单挂载mount: /dev/loop0 写保护,将以只读方式挂载 

8.安装createrepo  

[root@test1 html]#  yum install -y createrepo  //利用createrepo 创建yum源仓

二、用http服务,配置yum源

1.安装httpd服务

[root@test1 yum.repos.d]# yum -y install httpd

2.配置httpd服务

[root@test1 ~]# cd /var/www/html/            //进入到httpd的默认目录

将/opt/centos下挂载的文件软连接到http默认访问目录下,当然也可以使用cp命令,不过镜像文件较大,使用软连接更快

[root@test1 html]# ln -s /opt/centos/  /var/www/html/

[root@test1 html]# ll

总用量 0

lrwxrwxrwx 1 root root   12 7月   8 16:06 centos -> /opt/centos/

或者cp 复制

[root@test1 html]# mkdir centos

[root@test1 html]# cp -r /opt/centos/*  /var/www/html/centos

[root@test1 html]# createrepo  /var/www/html/centos

Spawning worker 0 with 993 pkgs

Spawning worker 1 with 993 pkgs

Spawning worker 2 with 993 pkgs

Spawning worker 3 with 992 pkgs

3.启动httpd服务

[root@test1 yum.repos.d]# systemctl start httpd

可以在网页上测试一下http://192.168.168.5:8080/centos

4.另外找一台服务器,修改http.repo(这里以自己创建的名字为准)文件中的baseurl为服务端ip

[root@test3 yum.repos.d]# vim http.repo

[centos]

name=centos

baseurl=http://192.168.168.5:8080/centos    

gpgcheck=0

enabled=1

最后做测试

[root@test3 yum.repos.d]# yum -y install vim //可以安装则代表成功

  • 用vsftpd配置yum源

1.安装vsftpd服务

[root@test1 yum.repos.d]# yum -y install vsftpd

2.配置vsftpd服务

[root@test1 ~]# cd /var/ftp/pub/            //进入到vsftpd的默认目录

将/opt/centos下挂载的文件软连接到ftp默认访问目录下,当然也可以使用cp命令,不过镜像文件较大,使用软连接更快

[root@test1 pub]# ln -s /opt/centos/   /var/ftp/pub/

[root@test1 pub]# ll

总用量 0

lrwxrwxrwx 1 root root   12 7月   8 16:06 centos -> /opt/centos/

或者cp 复制

[root@test1 pub]# mkdir centos

[root@test1 pub]# cp -r /opt/centos/*   /var/ftp/pub/centos

用 createrepo 创建仓库

[root@test1 pub]# createrepo /var/ftp/pub/

Spawning worker 0 with 993 pkgs

Spawning worker 1 with 993 pkgs

Spawning worker 2 with 993 pkgs

Spawning worker 3 with 992 pkgs

3.启动vsftpd服务

[root@test1 yum.repos.d]# systemctl start httpd

可以在网页上测试一下ftp://192.168.168.5/pub 有内容则代表成功

4.另外找一台服务器,修改http.repo(这里以自己创建的名字为准)文件中的baseurl为服务端ip

[root@test3 yum.repos.d]# vi ftp.repo

[ftpyum]

name=ftpyum

baseurl=ftp://192.168.168.5/pub

enabled=1

gpgcheck=0

最后做测试

[root@test3 yum.repos.d]# yum -y install vim //可以安装则代表成功

http://www.dtcms.com/a/533283.html

相关文章:

  • 开发制作一个网站北京做网站的公司商集客电话
  • 第七章:理解篇 - 对接云端语音识别,让助手“听懂”人话
  • 长春做网站多少钱全屏背景网站
  • 企业做淘宝网站需要多少钱王烨森
  • 课后作业-2025-10-26
  • 外管局网站先支后收怎么做报告企业网站开发需求
  • 网站域名所有权证书网站后台 全局配置
  • python之pydantic使用小结
  • 有什么好的网站建设的书厚街外贸网站建设
  • 从Google Chrome商店下载CRX文件
  • 做微信公众平台的网站欧美设计网站
  • 网站建设介绍ppt模板下载wordpress谷歌字体库
  • 高职护理专业就业指南:医院就业路径与职业发展
  • STM32F103C8T6--ADC
  • 怎么建设公益网站建公司网站的公司
  • shell脚本练习题1.0
  • 网站开发费的会计处理济南市工程建设技术监督局网站
  • 增城网站公司电话做网站在厦门排前5名
  • 在Linux系统中使用Dockerfile创建Docker
  • 软件下载大全网站阿里巴巴网站怎么做推广
  • 购物网站功能详细介绍开发公司工程部职责
  • python安装freethreaded
  • 专业网站建设收费搜索引擎营销的含义
  • 营销型网站建设公司推荐二级域名iis建立网站
  • C++ 链式前向星
  • 构建智能对话系统:Python实现聊天话题管理与摘要生成
  • 在ps做网站分辨率96可以吗xml网站地图怎么做
  • 如何建造网站视频教程icon psd下载网站
  • ArkTS省市区三级联动选择器实现详解
  • 自己代码做网站做商城的网站用什么框架好