一、準備操做:html
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld Removed 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
二、掛載光盤:python
上傳光盤鏡像(centos就上傳centos的),並虛擬掛載:linux
[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
三、安裝vsftp:sql
[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-10.el7.x86_64.rpm
四、拷貝文件到vsftp目錄,並進行設置:centos
[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 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
卸載虛擬光盤:bash
[root@localhost Packages]# umount /haha [root@localhost Packages]# cd /var/ftp/pub/ [root@localhost pub]# ls
啓動vsftp服務:ide
[root@localhost yum.repos.d]# systemctl start vsftpd [root@localhost yum.repos.d]# systemctl enable vsftpd Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
配置yum源:oop
[root@localhost Packages]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# vi server.repo [server] name=server baseurl=ftp://192.168.146.129/pub enabled=1 gpgcheck=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-manager server | 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,922 server server 4,687 repolist: 28,609 [root@localhost yum.repos.d]# yum search lrzsz