【实验:按照下述要求安装一台Server】
/boot 100M
/ 10G
/data 50G
/var/ftp LVM 6G :/dev/vg_ftp/lv_ftp
swap 2048M
主机名:server.yimiao.com
ip:192.168.10.254
网络设置为VMNET1
关闭防火墙
一、准备CENTOS镜像,并安装虚拟机
二、安装ISO,并设置逻辑卷,先分区物理卷,然后设置物理卷为逻辑卷,操作如下图所示
三、安装ftp并设置开机启动
[root@localhost CentOS]# rpm -ivh vsftpd-2.0.5-28.el5.x86_64.rpm
[root@localhost CentOS]# service vsftpd start
[root@localhost CentOS]# chkconfig --list vsftpd vsftpd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭 [root@localhost CentOS]# chkconfig vsftpd on [root@localhost CentOS]# chkconfig --list vsftpd vsftpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
在windows环境下访问ftp://172.17.4.77可以正常访问/var/ftp/pub
四、拷贝系统ISO文件到/var/ftp/pub/OS/CentOs/5.10/
[root@localhost /]# cp -r /media/* /var/ftp/pub/OS/CentOs/5.10/ [root@localhost /]# du -sh /var/ftp/pub/OS/CentOs/5.10/ 4.4G /var/ftp/pub/OS/CentOs/5.10/
拷贝RedHat时候发现ftp目录大小不够,增加逻辑卷大小
[root@localhost /]# fdisk /dev/sda Command (m for help): n
First cylinder (8689-10443, default 8689): Using default value 8689 Last cylinder or +size or +sizeM or +sizeK (8689-10443, default 10443): +4G
Command (m for help): t Partition number (1-7): 7 Hex code (type L to list codes): L
Hex code (type L to list codes): 8e Changed system type of partition 7 to 8e (Linux LVM) Command (m for help): w The partition table has been altered!
[root@localhost /]# partprobe /dev/sda
[root@localhost /]# pvcreate /dev/sda7
[root@localhost /]# vgextend vg_ftp /dev/sda7
[root@localhost /]# lvextend /dev/vg_ftp/lv_ftp /dev/sda7
[root@localhost /]# resize2fs /dev/vg_ftp/lv_ftp
五、增加yum源 用ftp做源
[CentOS Server] name=CentOS-5-10 baseurl=ftp://172.17.4.77/pub/OS/CentOs/5.10/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
通过ftp下载repo文件
[root@localhost yum.repos.d]# lftp 172.17.4.77 lftp 172.17.4.77:~> ll 未知命令 `ll'. lftp 172.17.4.77:~> ls drwx------ 2 0 0 16384 Sep 14 16:13 lost+found drwxr-xr-x 4 0 0 4096 Sep 21 11:38 pub lftp 172.17.4.77:/> cd pub/ lftp 172.17.4.77:/pub> ls drwxr-xr-x 4 0 0 4096 Sep 20 16:32 OS drwxr-xr-x 2 0 0 4096 Sep 21 11:45 Repo lftp 172.17.4.77:/pub> cd Repo/ lftp 172.17.4.77:/pub/Repo> LS -rw-r--r-- 1 0 0 556 Sep 21 11:45 CentOS-5-10.repo lftp 172.17.4.77:/pub/Repo> get CentOS-5-10.repo 556 bytes transferred lftp 172.17.4.77:/pub/Repo> exit [root@localhost yum.repos.d]# ll 总计 4 -rw-r--r-- 1 root root 556 09-21 19:45 CentOS-5-10.repo