CentOS6.5 (64bit) 光盘内部FTP源

一、启动系统,用ISO镜像挂载
[root@yum ~]# mkdir -p /mnt/cdrom01
[root@yum ~]# mkdir -p /mnt/cdrom02

[root@yum ~]# mount -a -t iso9660 -o loop /root/CentOS-6.5-x86_64-bin-DVD1.iso /mnt/cdrom01
[root@yum ~]# mount -a -t iso9660 -o loop /root/CentOS-6.5-x86_64-bin-DVD2.iso /mnt/cdrom02

二、安装FTP服务器
[root@yum ~]# cd /mnt/cdrom01/Packages
[root@yum ~]# rpm -ivh vsftpd*
[root@yum ~]# chkconfig vsftpd on
[root@yum ~]# service vsftpd start

三、安装createrepo软件包
[root@yum ~]# cd /mnt/cdrom01/Packages
[root@yum ~]# rpm -ivh createrepo-0.9.9-18.el6.noarch.rpm libxml2-python-2.7.6-14.el6.x86_64.rpm  python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm

四、COPY系统盘到CentOS
[root@yum ~]# cp -R /mnt/cdrom01/ /var/ftp/pub/CentOS
[root@yum ~]# cp -v /mnt/cdrom02/Packages/*.rpm /var/ftp/pub/CentOS/Packages

五、合并TRANS.TBL
[root@yum ~]# cat /mnt/cdrom02/Packages/TRANS.TBL >> /var/ftp/pub/CentOS/Packages/TRANS.TBL

六、生成依赖关系
[root@yum ~]# createrepo -g /var/ftp/pub/CentOS/repodata/repomd.xml /var/ftp/pub/CentOS/
Spawning worker 0 with 6367 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

七、建立仓库文件(FTP)
[root@yum ~]# mkdir -p /etc/yum.repos.d/backup
[root@yum ~]# mv /etc/yum.repos.d/CentOS* /etc/yum.repos.d/backup

[root@yum ~]# vim /etc/yum.repos.d/yum.repo
[Yum-ftp]
name=base
baseurl=ftp://192.168.25.10/pub/CentOS/           //*修改成本地IP*//
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

八、更新YUM源
[root@yum ~]# yum clean all
[root@yum ~]# rpm --rebuilddb
[root@yum ~]# yum upgrade

九、开防火墙、SELinux

#查看selinux的FTP相关
[root@yum ~]# sestatus -b | grep ftp

#打开FTP权限   
[root@yum ~]# setsebool -P allow_ftpd_full_access on

vsftpd有主动与被动两种模式,我们使用被动模式

#编辑iptables配置
[root@yum ~]#vim /etc/sysconfig/iptables-config

IPTABLES_MODULES="ip_conntrack_ftp"

[root@master01 ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter            [  OK  ]
iptables: Flushing firewall rules:                                  [  OK  ]
iptables: Unloading modules:                                     [  OK  ]
iptables: Applying firewall rules:                                  [  OK  ]
iptables: Loading additional modules: ip_conntrack_ftp [  OK  ]

上一篇:Coursera课程笔记----计算导论与C语言基础----Week 1


下一篇:Coursera课程笔记----计算导论与C语言基础----Week 4