Linux - 关于yum源 file & ftp & http 的三种配置方式
一、环境准备
1、两台Centos服务器:node1、node2
2、配置ip:node1(192.168.2.111)、node2(192.168.2.112)
3、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
4、禁用SELinux:setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@node1 home]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
二、配置yum源(file版)
1、将操作系统的iso映像文件上传到服务器的/mnt/iso目录下(目录不存在的话,手动创建)
[root@ctos79 ~]# mkdir -p /mnt/iso
2、挂载iso到/dev/cdrum目录(centos7.9该目录下的cdrom是个软连接)
[root@ctos79 ~]# mkdir -p /dev/cdrum
[root@ctos79 ~]# mount -o loop /mnt/iso/CentOS-7-x86_64-DVD-2009.iso /dev/cdrum/
3、创建本地的yum仓库目录 /vat/ftp/pub/os79,将iso文件的内容(/dev/cdrom
目录下的内容)拷贝到yum仓库目录
拷贝过之后,可将使用
umount
卸载镜像,以防相关可视化平台检测到“红温”状态的目录。
[root@ctos79 ~]# mkdir -p /var/ftp/pub/os79
[root@ctos79 ~]# cp -a /dev/cdrum/* /var/ftp/pub/os79/
4、配置yum的.repo配置文件(在/etc/yum.repos.d
目录下进行配置)
[root@ctos79 ~]# cat > /etc/yum.repos.d/os79.repo << EOF
> [os79]
> name=Local yum package
> baseurl=file:///var/ftp/pub/os79
> gpgcheck=0
> proxy=_none_
> EOF
5、清理(索引和下载包)缓存,将软件包信息提前在本地索引缓存,用来提高搜索安装软件的速度
[root@ctos79 ~]# yum clean all && yum makecache fast
已加载插件:fastestmirror
正在清理软件源: os79
已加载插件:fastestmirror
Determining fastest mirrors
os79 | 3.6 kB 00:00:00
(1/2): os79/group_gz | 153 kB 00:00:00
(2/2): os79/primary_db | 3.3 MB 00:00:00
元数据缓存已建立
6、显示已配置的软件仓库列表及各个软件仓库的软件包数量
[root@ctos79 ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识 源名称 状态
os79 Local yum package 4,070
repolist: 4,070
7、以下是实际操作截图
三、配置yum源(ftp版)
1、下载安装vsftpd服务
[root@node1 home]# yum -y install vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
vsftpd x86_64 2.2.2-11.el6_4.1 os65 151 k
Transaction Summary
=====================================================================================================================
Install 1 Package(s)
Total download size: 151 k
Installed size: 331 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-11.el6_4.1.x86_64 1/1
Verifying : vsftpd-2.2.2-11.el6_4.1.x86_64 1/1
Installed:
vsftpd.x86_64 0:2.2.2-11.el6_4.1
Complete!
2、修改vsftpd配置文件,添加 anon_root=/var/ftp
(注意:实测不需要配置anon_root目录)
[root@node1 home]# cd /etc/vsftpd
[root@node1 vsftpd]# ll
总用量 20
-rw------- 1 root root 125 3月 1 2013 ftpusers
-rw------- 1 root root 361 3月 1 2013 user_list
-rw------- 1 root root 4599 3月 1 2013 vsftpd.conf
-rwxr--r-- 1 root root 338 3月 1 2013 vsftpd_conf_migrate.sh
[root@node1 vsftpd]# vim vsftpd.conf
[root@node1 vsftpd]# tail vsftpd.conf
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
anon_root=/var/ftp
[root@node1 vsftpd]#
3、修改配置文件之后重启vsftpd服务
# centos6.x
[root@node1 vsftpd]# service vsftpd restart && chkconfig vsftpd on
[root@node1 vsftpd]# chkconfig --list vsftpd
vsftpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@node1 vsftpd]#
# centos7.x
[root@node1 vsftpd]# systemctl restart vsftpd && systemctl enable vsftpd
4、配置node2的yum配置文件(在/etc/yum.repos.d
目录下)
[root@node2 yum.repos.d]# cat os65.repo
[os65]
name=Local yum package
baseurl=ftp://192.168.56.111/pub/os65
gpgcheck=0
proxy=_none_
enabled=1
5、清理(索引和下载包)缓存,将软件包信息提前在本地索引缓存,用来提高搜索安装软件的速度
yum clean all && yum makecache fast
6、显示已配置的软件仓库列表及各个软件仓库的软件包数量
[root@node2 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
os65 Local yum package 6,367
repolist: 6,367
[root@node2 yum.repos.d]#
四、配置yum源(http版)
1、通过wget
获取到大厂的镜像源repo文件,先安装wget
[root@localhost ~]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.njupt.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================
Package Arch Version Repository Size
===================================================================================
Installing:
wget x86_64 1.14-18.el7_6.1 base 547 k
Transaction Summary
===================================================================================
Install 1 Package
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-18.el7_6.1.x86_64 1/1
Verifying : wget-1.14-18.el7_6.1.x86_64 1/1
Installed:
wget.x86_64 0:1.14-18.el7_6.1
Complete!
[root@localhost ~]#
2、获取阿里的repo文件:https://mirrors.aliyun.com/repo/ (可能有加密处理,不能直接wget到Centos-7.repo,访问该网址之后,右键复制了我想要的那个repo的链接)
[root@localhost yum.repos.d]# wget -O CentOS-Base.repo https://mirrors.aliyum.com/repo/Centos-7.repo
--2023-06-07 16:35:00-- https://mirrors.aliyum.com/repo/Centos-7.repo
Resolving mirrors.aliyum.com (mirrors.aliyum.com)... 47.75.39.85
Connecting to mirrors.aliyum.com (mirrors.aliyum.com)|47.75.39.85|:443... failed: Connection refused.
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# wget -O CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo?spm=a2c6h.25603864.0.0.1d2f5969P1c04G
--2023-06-07 16:36:10-- https://mirrors.aliyun.com/repo/Centos-7.repo?spm=a2c6h.25603864.0.0.1d2f5969P1c04G
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 119.167.164.119, 112.122.156.209, 112.122.156.207, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|119.167.164.119|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘CentOS-Base.repo’
100%[============================>] 2,523 --.-K/s in 0.008s
2023-06-07 16:36:10 (311 KB/s) - ‘CentOS-Base.repo’ saved [2523/2523]
[root@localhost yum.repos.d]#
— 要养成终生学习的习惯 —
Linux - 关于yum源 file & ftp & http 的三种配置方式的更多相关文章
- Linux基石【第二篇】虚拟网络三种连接方式(转载)
在虚拟机上安装完Centos系统后,开始配置静态IP,以方便在本宿主机上可以访问虚拟机,在曲折的配置中,了解到虚拟机还有三种连接方式:Bridged,NAT和Host-only,于是,我又一轮新的各种 ...
- 基于ftp服务的三种登录方式及其相关的访问控制和优化
ftp(简单文件传输协议),是一种应用广泛的网络文件传输协议和服务,占用20和21号端口,主要用于资源的上传和下载. 在linux对于ftp同widows一样具有很多的种类,这里主要介绍vsfptd( ...
- Spring AOP源码分析(二):AOP的三种配置方式与内部解析实现
AOP配置 在应用代码中,可以通过在spring的XML配置文件applicationContext.xml或者基于注解方式来配置AOP.AOP配置的核心元素为:pointcut,advisor,as ...
- Linux 本地yum源搭建和网络yum源搭建
一.本地yum源搭建 首先挂载上光盘 [root@www /]# mount /dev/cdrom /media/cdrom/ 系统默认已经安装了可使用yum的软件包,所以可以直接配置: [root@ ...
- 【Linux】YUM源搭建
YUM是什么? YUM是什么 基于rpm但更胜于rpm的软件管理工具: YUM有服务端和客户端: 如果服务端和客户端在同一台机器,这是本地YUM: 如果服务端和客户端不在同一台机器,这是网络YUM. ...
- yum源仓库的三种搭建方式
yum源的三种搭建方式 一. 本地yum仓库的搭建 1.1.获取软件包资源 将iso镜像挂载在本地目录中,此次挂载目录为/var/www/html/repo/,此目录本身不存在,需要创建.软件宝资源 ...
- Linux操作系统下三种配置环境变量的方法
现在使用linux的朋友越来越多了,在linux下做开发首先就是需要配置环境变量,下面以配置java环境变量为例介绍三种配置环境变量的方法. 1.修改/etc/profile文件 如果你的计算机仅仅作 ...
- Linux操作系统下三种配置环境变量的方法——转载
来源:赛迪网 作者:millio 现在使用linux的朋友越来越多了,在linux下做开发首先就是需要配置环境变量,下面以配置java环境变量为例介绍三种配置环境变量的方法. 1.修改/e ...
- Linux 双线策略路由的三种实现方式总结+端口映射
Linux 双线策略路由的三种实现方式总结+端口映射 Linux 双线策略路由的三种实现方式总结+端口映射 网络环境 服务器(网关): eth0 为LAN口,IP为 LAN_IP = 192.168. ...
- linux学习之centos(二):虚拟网络三种连接方式和SecureCRT的使用
---操作环境--- 虚拟机版本:VMware Workstation_10.0.3 Linux系统版本:CentOS_6.5(64位) 物理机系统版本:win10 一.虚拟网络三种连接方式 当在V ...
随机推荐
- #oscp#渗透测试 kioptix level 3靶机getshell及提权教程
声明! 文章所提到的网站以及内容,只做学习交流,其他均与本人以及泷羽sec团队无关,切勿触碰法律底线,否则后果自负!!!! 一.靶机搭建 点击扫描虚拟机 选择靶机使在文件夹即可 二.信息收集 前言 信 ...
- 在docker中使用主机串口通讯
在进行软件docker化的过程时,很大的一个阻碍就是软件与各种外围硬件设备的交互,网口通信的设备能够很容易地接入容器,但是串口设备则要复杂一些.本文讨论在windows和linux下docker容器使 ...
- 【数据库】MongoDB服务启动失败的问题。
1.确保MongoDB所在文件夹拥有所有权限 2.确保打开CMD窗口是以管理员身份运行的 3.配置文件中的路径应该为完整路径,且不包含空格和特殊字符(不建议包含) systemLog: destina ...
- 一套十万级TPS的IM综合消息系统的架构实践与思考
本文由作者jhon_11分享,有大量修订和改动. 1.引言 如何设计一款高性能.高并发.高可用的im综合消息平台是很多公司发展过程中会碰到且必须要解决的问题.比如一家公司内部的通讯系统.各个互联网平台 ...
- 推荐一个双语对照的 PDF 翻译工具的开源项目:PDFMathTranslate
今天给大家推荐一个双语对照的 PDF 翻译工具的开源项目:PDFMathTranslate . 项目介绍: 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Oll ...
- windows平台下,web与app交互方式探索
前言 web与app孰优孰劣暂且不争论,也许一方永远代替不了另一方.一个系统有可能同时包含web和app:web和app紧密配合下,才能给用户更好的体验.web如何将信息传达给app?这就是本文要探索 ...
- 深入LinkedBlockingQueue实现原理
学习BlockingQueue之LinkedBlockingQueue实现原理 一:概念 LinkedBlockingQueue是一个用链表实现的有界阻塞队列.此队列的默认和最大长度为 Integ ...
- python脚本抓取省市县区乡镇村庄(五级行政区划)
用python脚本抓取省市县区乡镇村庄(五级行政区划)的过程如下: 1,抓取国家统计局官网上的行政区划名称和对应的代码(5级是不同的网页,所以涉及多层跳转): 2,数据量大约几十万条,频繁访问考虑防屏 ...
- YUV 格式
1. YUV比例 分三种:YUV44,YUV422,YUV420 2. YUV排布 分三种:YUV planar,YUV Semi-Plannar,YUV packed 以YUV422 8*4 为例 ...
- zabbix监控网络设备流量
项目环境 一台liunx服务器,这里使用的为ubuntu22.04(192.168.86.140) 一台华为交换机,本次监控的就是该交换机的端口流量(192.168.86.20) 一台pc主机,使用该 ...