一、服务端
1、挂载光盘镜像文件
[root@node1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 40185208 315028 37822180 1% / tmpfs 506144 76 506068 1% /dev/shm /dev/sda1 194241 27906 156095 16% /boot /dev/sda6 20027260 45024 18958236 1% /home /dev/sda2 60344404 2689168 54583236 5% /usr /dev/sda5 40185208 318824 37818384 1% /var /dev/sr0 3747454 3747454 0 100% /media/RHEL-6.6 Server.x86_64
2、复制光盘镜像文件
[root@node1 ~]# mkdir -p /var/ftp/rhel6 [root@node1 ~]# cp -rf /media/RHEL-6.6\ Server.x86_64/* /var/ftp/rhel6 & [root@node1 ~]# du -sh /var/ftp/rhel6/ 3.6G /var/ftp/rhel6/
3、安装vsfptd、ftp软件
[root@node1 ~]# yum -y install vsftpd >> /dev/null [root@node1 ~]# yum -y install ftp >> /dev/null [root@node1 ~]# rpm -qa |grep vsftpd vsftpd-2.2.2-12.el6_5.1.x86_64 [root@node1 ~]# rpm -qa ftp ftp-0.17-54.el6.x86_64
4、删除默认网关与DNS解析
[root@node1 ~]# cd /etc/sysconfig/network-scripts/ [root@node1 network-scripts]# vim ifcfg-eth0 DEVICE=eth0 HWADDR=00:0C:29:A3:DA:45 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=172.16.0.11 NETMASK=255.255.0.0 [root@node1 network-scripts]# service network restart [root@node1 network-scripts]# ping baidu.com ping: unknown host baidu.com
5、关闭防火墙和SELinux
[root@node1 ~]# service iptables stop [root@node1 ~]# setenforce 0 [root@node1 ~]# getenforce Permissive
6、验证FTP服务
[root@node1 ~]#service vsftpd restart [root@node1 ~]#ftp 172.16.0.11 Connected to 172.16.0.11 (172.16.0.11). 220 (vsFTPd 2.2.2) Name (172.16.0.11:root): ftp 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (172,16,0,11,50,82). 150 Here comes the directory listing. drwxr-xr-x 2 0 0 4096 Jul 29 2014 pub drwxr-xr-x 3 0 0 4096 Sep 06 08:49 rhel6 226 Directory send OK. ftp> cd rhel6 250 Directory successfully changed. ftp> ls ........................................................................................... dr-xr-xr-x 3 0 0 4096 Sep 06 08:49 HighAvailability dr-xr-xr-x 3 0 0 4096 Sep 06 08:49 LoadBalancer dr-xr-xr-x 2 0 0 266240 Sep 06 08:52 Packages -r--r--r-- 1 0 0 16435 Sep 06 08:52 README -r--r--r-- 1 0 0 3375 Sep 06 08:52 RPM-GPG-KEY-redhat-beta -r--r--r-- 1 0 0 3211 Sep 06 08:52 RPM-GPG-KEY-redhat-release ........................................................................................... 226 Directory send OK. ftp>
二、客户端
1、编辑yum源配置文件
[root@node2 yum.repos.d]# ls [root@node2 yum.repos.d]# vim rhel6.repo [base] name=rhel6.local baseurl=ftp://172.16.0.11/rhel6/ enabled=1 gpgcheck=0
2、删除默认网关与DNS解析
[root@node2 yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=00:0C:29:9D:C8:FC TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=172.16.0.12 NETMASK=255.255.0.0 [root@node2 yum.repos.d]# service network restart [root@node2 yum.repos.d]#ping baidu.com ping: unknown host baidu.com [root@node2 yum.repos.d]# ping 172.16.0.11 PING 172.16.0.11 (172.16.0.11) 56(84) bytes of data. 64 bytes from 172.16.0.11: icmp_seq=1 ttl=64 time=1.27 ms
3、清除并更新缓存
[root@node2 yum.repos.d]# yum clean all [root@node2 yum.repos.d]# yum makecache
4、验证安装
[root@node2 yum.repos.d]# yum list [root@node2 yum.repos.d]# rpm -qa |grep gcc [root@node2 yum.repos.d]# yum -y install gcc >> /dev/null [root@node2 yum.repos.d]# rpm -qa |grep gcc libgcc-4.4.7-11.el6.x86_64 gcc-4.4.7-11.el6.x86_64 [root@node2 yum.repos.d]#
补充:
非RHEL光盘自带的更多其它软件包,必须包括存在依赖关系的所有安装文件,除了应准备相应的目录外,还需要手动创建repodata数据文件,通过createrepo工具实现
例:
[root@node1 ~]#mkdir -p /var/ftp/other [root@node1 ~]#createrepo -g /media/RHEL-6.6\ Server.x86_64/repodata/repomd.xml /var/ftp/other
转载于:https://blog.51cto.com/zjzd86/1714940