1. 挂载iso镜像,进入Packages目录下安装FTP服务
#rpm -ivh vsftpd-3.0.2-10.el7.x86_64.rpm
2. 修改vsftpd配置文件如下
[root@rusky Packages]# cat /etc/vsftpd/vsftpd.conf | grep -v "#"
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ftpd_banner=Welcome to blah FTP service.
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
anon_root=/yum_repo/rhel7.2 #匿名用户默认目录为/var/ftp/pub,此外修改为/yum_repo/rhel7.2
local_root=/yum_repo
创建匿名用户目录:mkdir -p /yum_repo/rhel7.2
3. 拷贝操作系统iso镜像中的Packages,repodata,RPM-GPG-KEY-redhat-release到/yum_repo/rhel7.2目录下
#cp -rf Packages repodata RPM-GPG-KEY-redhat-release /yum_repo/rhel7.2
[root@rusky rhel7.2]# pwd
/yum_repo/rhel7.2
[root@rusky rhel7.2]# ls
Packages repodata RPM-GPG-KEY-redhat-release
4. 停止防火墙、修改selinux为disabled
# systemctl start firewalld
#chkconfig firewalld off
#vi /etc/selinux/config
SELINUX=disabled
5. 创建repo库
# createrepo -g /yum_repo/rhel7.2/repodata/81c149ffb2267c59a3e6405766b5ff3dc78e0637033e9f5aef564538359ff281-comps-Server.x86_64.xml /yum_repo/rhel7.2/Packages/
6. 创建local.repo文件
[root@rhel7Oracle yum.repos.d]# vi /etc/yum.repos.d/local.repo [RHEL7.2]
name=rhel7_repo
baseurl=ftp://192.168.1.202/Packages
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.1.202/RPM-GPG-KEY-redhat-release
7. 启动vsftpd服务
#systemctl start vsftpd
#chkconfig vsftpd on --开机启动
8. 测试
ftp匿名访问
yum命令测试
[root@rusky rhel7.2]# yum list gcc
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
gcc.x86_64 4.8.5-4.el7 @RHEL7.2
[root@rusky rhel7.2]# yum groups list
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Available Environment Groups:
Minimal Install
Infrastructure Server
File and Print Server
Basic Web Server
Virtualization Host
Server with GUI
Available Groups:
Compatibility Libraries
Console Internet Tools
Development Tools
Graphical Administration Tools
Legacy UNIX Compatibility
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
Done
[root@rusky rhel7.2]#