1、准备操作:
[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
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 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite 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 vsftpd Created 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=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
转载于:https://blog.51cto.com/net881004/2374591