1、准备操作:

[root@localhost ~]# systemctl stop firewalld[root@localhost ~]# systemctl disable firewalldRemoved symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.[root@localhost ~]# cat /etc/sysconfig/selinux# 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 three two values:#     targeted - Targeted processes are protected,#     minimum - Modification of targeted policy. Only selected processes are protected.#     mls - Multi Level Security protection.SELINUXTYPE=targeted[root@localhost ~]# setenforce 0

2、挂载光盘:

上传光盘镜像(centos就上传centos的),并虚拟挂载:

[root@localhost ~]# mkdir /haha[root@localhost ~]# mount -o loop rhel-server-7.4-update-4-x86_64-dvd.iso /haha[root@localhost ~]# cd /haha/Packages/[root@localhost Packages]# ls

3、安装vsftp:

[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-10.el7.x86_64.rpm

4、拷贝文件到vsftp目录,并进行设置:

[root@localhost Packages]# cd /haha[root@localhost haha]# cp -r * /var/ftp/pub/
#以下三行好像可以忽略[root@localhost haha]# cd /var/ftp/pub/[root@localhost pub]# rm -f *.html[root@localhost pub]# rm -f repodata/TRANS.TBL[root@localhost pub]# cd /haha/Packages/[root@localhost Packages]# rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm准备中...                          ################################# [100%]正在升级/安装...   1:deltarpm-3.6-3.el7               ################################# [100%][root@localhost Packages]# rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm准备中...                          ################################# [100%]正在升级/安装...   1:python-deltarpm-3.6-3.el7        ################################# [100%][root@localhost Packages]# rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm准备中...                          ################################# [100%]正在升级/安装...   1:createrepo-0.9.9-23.el7          ################################# [100%][root@localhost Packages]# createrepo -g /var/ftp/pub/repodata/repomd.xml /var/ftp/pub/Spawning worker 0 with 4687 pkgsWorkers FinishedSaving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete

卸载虚拟光盘:

[root@localhost Packages]# umount /haha[root@localhost Packages]# cd /var/ftp/pub/[root@localhost pub]# ls

启动vsftp服务:

[root@localhost yum.repos.d]# systemctl start vsftpd[root@localhost yum.repos.d]# systemctl enable vsftpdCreated symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

配置yum源:

[root@localhost Packages]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# vi server.repo[server]name=serverbaseurl=ftp://192.168.146.129/pubenabled=1gpgcheck=0[root@localhost yum.repos.d]# yum clean all[root@localhost yum.repos.d]# yum makecache[root@localhost yum.repos.d]# yum repolist已加载插件:product-id, search-disabled-repos, subscription-managerserver                                                                                                                                              | 3.6 kB  00:00:00     (1/2): server/group_gz                                                                                                                              | 1.2 kB  00:00:00     (2/2): server/primary_db                                                                                                                            | 3.6 MB  00:00:00     源标识                                                                         源名称                                                                                状态rhel-7-server-rpms/7Server/x86_64                                              Red Hat Enterprise Linux 7 Server (RPMs)                                              23,922server                                                                         server                                                                                 4,687repolist: 28,609[root@localhost yum.repos.d]# yum search lrzsz