操作系统:centos5.9 i686
proftpd版本:proftpd-1.3.5rc3
ProFTPD是继Wu-FTP之后最为流行的FTP服务器软件。我带大家看看Centos是如何编译安装Proftpd。
centos不能直接yum安装proftpd,有两种方法可解决:
1、用yum安装ProFTPD需要定义非官方的库。
2、手动编译。
这里就说说怎样手动编译。
先下载proftpd:
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5rc3.tar.gz
编译前记得安装gcc、make等:
yum install -y gcc make
解压:
tar -zxvf proftpd-1.3.5rc3.tar.gz
进入解压的目录:
cd proftpd-1.3.5rc3
配置makefile:
./configure --prefix=/usr/local/proftpd
编译
make
安装:
make install
编辑启动脚本:
拷贝 proftpd.init.d 到 /etc/rc.d/init.d 文件夹中,重命名为proftpd
cp contrib/dist/rpm/proftpd.init.d/etc/rc.d/init.d/proftpd
编辑/etc/rc.d/init.d/proftpd
vi /etc/rc.d/init.d/proftpd
将"[ -x /usr/sbin/proftpd ] || exit 5"改为
[ -x /usr/local/proftpd/sbin/proftpd ] || exit 5
将start部分中的daemon proftpd改为
daemon /usr/local/proftpd/sbin/proftpd
最后/etc/rc.d/init.d/proftpd就像下面这个样子,你也可以直接复制下面的内容覆盖/etc/rc.d/init.d/proftpd的原内容
#!/bin/sh # # Startup script for ProFTPD # # chkconfig: - 85 15 # description: ProFTPD is an enhanced FTP server with a focus towards \ # simplicity, security, and ease of configuration. \ # It features a very Apache-like configuration syntax, \ # and a highly customizable server infrastructure, \ # including support for multiple 'virtual' FTP servers, \ # anonymous FTP, and permission-based directory visibility. # processname: proftpd #config: /etc/local/proftpd/etc/proftpd.conf # pidfile: /var/run/proftpd/proftpd.pid ### BEGIN INIT INFO # Provides: proftpd ftpserver # Required-Start: $local_fs $network $named $remote_fs # Required-Stop: $local_fs $network $named $remote_fs # Default-Stop: 0 1 6 # Short-Description: ProFTPd FTP Server # Description: ProFTPd is an enhanced FTP server with a focus towards # simplicity, security, and ease of configuration. # It features a very Apache-like configuration syntax, # and a highly customizable server infrastructure, # including support for multiple 'virtual' FTP servers, # anonymous FTP, and permission-based directory visibility. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Source ProFTPD configuration. PROFTPD_OPTIONS="" if [ -f /etc/sysconfig/proftpd ]; then . /etc/sysconfig/proftpd fi # Check that networking is enabled. [ ${NETWORKING} = "no" ] && exit 1 # Make sure the binary is present. [ -x /usr/local/proftpd/sbin/proftpd ] || exit 5 RETVAL=0 prog="proftpd" start() { echo -n $"Starting $prog: " daemon /usr/local/proftpd/sbin/proftpd RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd } stop() { echo -n $"Shutting down $prog: " killproc proftpd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status proftpd RETVAL=$? ;; restart) stop start ;; try-restart|condrestart) if [ -f /var/lock/subsys/proftpd ]; then stop start fi ;; reload|force-reload|reread) echo -n $"Re-reading $prog configuration: " killproc proftpd -HUP RETVAL=$? echo ;; configtest) echo -n $"Testing $prog configuration: " proftpd -n -t RETVAL=$? echo ;; suspend) hash ftpshut >/dev/null 2>&1 if [ $? = 0 ]; then if [ $# -gt 1 ]; then shift echo -n "Suspending with '$*'" ftpshut "$@" echo -n "Suspending NOW" ftpshut now "Maintenance in progress" RETVAL=$? fi else fi echo ;; resume) if [ -f /etc/shutmsg ]; then echo -n "Allowing sessions again" rm -f /etc/shutmsg else echo -n "Was not suspended" RETVAL=2 fi echo ;; *) echo -n "Usage: $prog {start|stop|restart|try-restart|reload|sta tus|reread|resume" hash ftpshut if [ $? = 1 ]; then echo '}' else echo '|suspend}' echo 'suspend accepts additional arguments, which are pa ssed to ftpshut(8)' fi exit 2 esac exit $RETVAL
增加/etc/rc.d/init.d/proftpd执行权限
chmod +x /etc/rc.d/init.d/proftpd
修改配置文件,注释掉Group选项
vi /usr/local/proftpd/etc/proftpd.conf
#Group nogroup
centos注册proftpd服务
chkconfig --add proftpd
设置开机启动
chkconfig --level 35 proftpd on
启动proftpd
service proftpd start
通过本文的描写,其实Centos编译安装Proftpd 很简单。
参考文档:
http://os.51cto.com/art/201102/246128.htm