首页 > 系统相关 >Linux - 配置file & ftp方式的yum源

Linux - 配置file & ftp方式的yum源

时间:2023-05-28 20:45:03浏览次数:44  
标签:ftp vsftpd yum os65 file node1 root

 

 

环境准备

1、两台Centos服务器:node1、node2

2、配置ip:node1(192.168.56.111)、node2(192.168.56.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、在node1节点上传iso文件作为本地yum源

# 把/mnt/iso目录下的iso文件,挂载至/dev/cdrom
mount -o loop /mnt/iso/CentOS-6.5-x86_64-bin-DVD1.iso /dev/cdrom

2、创建本地的yum仓库目录,将iso文件的内容(/dev/cdrom目录下的内容)拷贝到yum仓库目录

mkdir -p /var/ftp/pub/os65
cp -a /dev/cdrom/* /var/ftp/pub/os65/

3、配置yum的配置文件(在/etc/yum.repos.d目录下进行配置)

[root@node1 yum.repos.d]# cat os65.repo
[os65]
name=Local yum package
baseurl=file:///var/ftp/pub/os65
gpgcheck=0
proxy=_none_

 4、清理(索引和下载包)缓存,将软件包信息提前在本地索引缓存,用来提高搜索安装软件的速度

yum clean all && yum makecache fast

 5、显示已配置的软件仓库列表及各个软件仓库的软件包数量

[root@node1 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id                        repo name                      status
os                             Local yum package              6,367
repolist: 6,367
[root@node1 yum.repos.d]#
[root@node1 yum.repos.d]#

 

 

配置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]#

 

标签:ftp,vsftpd,yum,os65,file,node1,root
From: https://www.cnblogs.com/harleyblogs/p/17438818.html

相关文章

  • dockerfile里的EXPOSE
    在Dockerfile中,`EXPOSE`指令用于声明容器运行时将要监听的网络端口。`EXPOSE`并不会实际打开容器的端口,它只是向用户和开发人员提供了容器内部服务的网络接口信息。通过在Dockerfile中使用`EXPOSE`,你可以向其他人传达容器暴露的网络服务和端口,以便更好地理解容器的使用和......
  • mysql监控工具sqlprofiler,类似sqlserver的profiler工具
    最近无意发现了mysql的客户端监控工具“NeroProfileSQL”,刚开始还不知道怎么使用,经过半小时摸索,现将使用步骤写下来。背景:开发的时候,如果数据存储层这块使用EF,或者其他orm框架,数据库是mysql,想知道最终执行的sql语句,那么这款工具就帮你忙了。1、去官网下载安装windows......
  • 文件管理类 FileUtils 打印工具LogUtil
    FileUtilsobjectFileUtils{constvalSIZETYPE_B=1//获取文件大小单位为B的double值constvalSIZETYPE_KB=2//获取文件大小单位为KB的double值constvalSIZETYPE_MB=3//获取文件大小单位为MB的double值constvalSIZETYPE_GB=4//获取......
  • CMake vs Makefile: 如何选择适合你的项目构建工具
    在软件开发中,构建(build)是一个非常重要的过程。我们需要将源代码转换为可执行文件或库文件。为了完成此过程,我们通常使用构建工具来自动化构建过程。CMake和Makefile都是用于构建和管理软件项目的工具。CMake是一个跨平台的构建工具,它可以自动生成Makefile,而Makefile是一个GNU工具,......
  • CMake vs Makefile: 如何选择适合你的项目构建工具
    在软件开发中,构建(build)是一个非常重要的过程。我们需要将源代码转换为可执行文件或库文件。为了完成此过程,我们通常使用构建工具来自动化构建过程。CMake和Makefile都是用于构建和管理软件项目的工具。CMake是一个跨平台的构建工具,它可以自动生成Makefile,而Makefile是一个GNU工具......
  • nginx 配置中的sendfile 的作用
    http{...sendfileon...}sendfile配置的具体意思:设置为on表示,使用零拷贝技术来传输文件:sendfile,这样只需要2次上下文切换,和2次数据拷贝。设置为off表示,使用传统的文件传输技术:read+write,这时就需要4次上下文切换,和4次数据拷贝。当然,要使用sendfil......
  • 文件句柄(File Handle)
     文件句柄(FileHandle)是操作系统中用于访问文件的一种数据结构,通常是一个整数或指针。文件句柄用于标识打开的文件,每个打开的文件都有一个唯一的文件句柄。在Linux和Unix系统中,文件句柄是通过调用open()系统调用打开文件时返回的。当打开一个文件时,操作系统会为该文件分......
  • How to fix CMake error Could not find a package configuration file provided by
    CMakeErrorat/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117(find_package):Couldnotfindapackageconfigurationfileprovidedby"boost_filesystem"(requestedversion1.71.0)withanyofthefollowingnames:boos......
  • .env.development(开发环境)、.env.prodction(正式环境)、自定义环境 例如:读取vue项目根
    .env.development(开发环境)、.env.prodction(正式环境)、自定义环境原文链接:https://blog.csdn.net/qq_42855675/article/details/114261585文章目录1.配置文件:2.命名规则3.关于文件的加载使用自定义环境1.配置文件:      .env.development:开发环境下的配置文件 ......
  • C++ write batch files via filstream
    #include<assert.h>#include<atomic>#include<chrono>#include<fstream>#include<iomanip>#include<iostream>#include<mutex>#include<numeric>#include<thread>#include<unistd.h>#includ......