系统版本:OracleLinux-R5-U7-Server-x86_64-dvd.iso
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
BASEDIR=/etc/yum.repos.d
IPADDR=$(ifconfig eth0 | grep 'inet addr' | cut -d ':' -f2 | cut -d ' ' -f1)
mkdir -p /mnt/dvd
mkdir -p /yum
mount /dev/cdrom /mnt/dvd 2> /dev/null
cp -urf /mnt/dvd/* /yum/
function vsftpdinstall()
{
cd /yum/Server
rpm -ivh vsftpd-2.0.5-21.el5.x86_64.rpm
}
function vsftpdconfig()
{
cat >>/etc/vsftpd/vsftpd.conf<
anon_upload_enable=YES
anon_root=/yum
EOF
/etc/init.d/vsftpd restart
}
function ftpyum()
{
cat >$BASEDIR/yum.repo<< EOF
[Server]
name=Server
baseurl=ftp://$IPADDR/Server
gpgcheck=0
enabled=1
[VT]
name=VT
baseurl=ftp://$IPADDR/VT
gpgcheck=0
enabled=1
[CLuster]
name=Cluster
baseurl=ftp://$IPADDR/Cluster
gpgcheck=0
enabled=1
[ClusterStorage]
name=ClusterStorage
baseurl=ftp://$IPADDR/ClusterStorage
gpgcheck=0
enabled=1
EOF
}
function testyum()
{
yum clean all && yum repolist all
}
vsftpdinstall
vsftpdconfig
ftpyum
testyum