tar 包安装vsftp3.0.3
2018-09-13 本文已影响282人
咖啡大象不含咖啡
- 查找现有vsftpd
#rpm -qa | grep vsftp
vsftpd-2.2.2-21.el6.x86_64
- 卸载原有vsftp
rpm -e vsftpd-2.2.2-21.el6.x86_64
-
下载指定版本vsftpd
下载tar包:http://download.chinaunix.net/download.php?id=43934&ResourceID=19
下载得到vsftpd-3.0.2.tar.gz。 -
上传至服务器。
-
编译安装
#tar -zvxf vsftpd-3.0.3.tar.gz
#cd vsftpd-3.0.3/;
#make
#make install
如果出现
/usr/bin/ld: cannot find -lcap
collect2: ld returned 1 exit status
make: *** [vsftpd] Error 1
yum install libcap-devel -y
即可
重新make && make install
- 拷贝配置文件
在vsftpd-3.0.3/目录下:
cp vsftpd.conf /etc/vsftpd/
- 制作启动脚本
vim /etc/init.d/vsftpd
,输入
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: vsftpd
# Required-Start: $local_fs $network $named $remote_fs $syslog
# Required-Stop: $local_fs $network $named $remote_fs $syslog
# Short-Description: Very Secure Ftp Daemon
# Description: vsftpd is a Very Secure FTP daemon. It was written completely from
# scratch
### END INIT INFO
# vsftpd This shell script takes care of starting and stopping
# standalone vsftpd.
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
# that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="vsftpd"
start() {
# Start daemons.
if [ -d /etc ] ; then
for i in `ls /etc/vsftpd/vsftpd.conf`; do
site=`basename $i .conf`
echo -n $"Starting $prog for $site: "
/usr/local/sbin/vsftpd $i &
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog $site"
}
echo
done
else
RETVAL=1
fi
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
修改其权限
chmod 755 /etc/init.d/vsftpd
- 启动vsftpd
service vsftpd restart
- 查看其版本
vsftpd -v
vsftpd: version 3.0.3