- #!/bin/bash
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
- export PATH
- if [ $(id -u) != "0" ]; then
- quit "You must be root to run this script!"
- fi
- cur_dir=`pwd`
- #download pure-ftpd
- cd $cur_dir
- if [ -s pure-ftpd-1.0.36.tar.gz ]; then
- echo "pure-ftpd-1.0.36.tar.gz [found]"
- else
- echo "pure-ftpd-1.0.36.tar.gz not found!!!download now......"
- if ! wget -c http://teddysun.googlecode.com/files/pure-ftpd-1.0.36.tar.gz;then
- echo "Failed to download pure-ftpd-1.0.36.tar.gz,please download it to /lamp directory manually and rerun the install script."
- exit 1
- fi
- fi
- #install pure-ftpd
- echo "============================pure-ftpd install============================================"
- tar xzf pure-ftpd-1.0.36.tar.gz
- cd pure-ftpd-1.0.36
- ./configure
- make && make install
- cp -pr contrib/redhat.init /etc/init.d/pure-ftpd
- chmod 755 /etc/init.d/pure-ftpd
- chkconfig --add pure-ftpd
- chkconfig --level 3 pure-ftpd on
- cp -pr configuration-file/pure-ftpd.conf.in /etc/pure-ftpd.conf
- cp -pr configuration-file/pure-config.pl /usr/local/sbin/pure-config.pl
- chmod 744 /etc/pure-ftpd.conf
- chmod 755 /usr/local/sbin/pure-config.pl
- service pure-ftpd start
- #see if iptables is start
- /sbin/service iptables status 1>/dev/null 2>&1
- if [ $? -eq 0 ]; then
- /sbin/iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
- /etc/rc.d/init.d/iptables save
- echo 'IPTABLES_MODULES="ip_conntrack_ftp"' >>/etc/sysconfig/iptables-config
- /etc/init.d/iptables restart
- fi
- echo "============================pure-ftpd install completed============================================"