CentOS下mysql+pureftpd的编译安装

操作系统:CentOS

软件:mysql-5.0.22.tar.gz pure-ftpd-1.0.22.tar.gz

一、编译安装mysql

1、下载并解压mysql和pure-ftpd软件包

[root@localhost chenye]# ls
mysql-5.0.22 mysql-5.0.22.tar.gz pure-ftpd-1.0.22 pure-ftpd-1.0.22.tar.gz

2、编译并安装mysql

[root@localhost chenye]# cd mysql-5.0.22

[root@localhost mysql-5.0.22]# ./configure --prefix=/usr/local/mysql --with-mysql-user=mysql --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/var/mysql.sock ;make ;make install

--with-mysql-user指定mysql运行的用户
--with-extra-charsets支持扩展字符集
--with-unix-socket-path指定mysql运行后,套接字文件存放位置

3、配置mysql
[root@localhost mysql-5.0.22]# cd /usr/local/mysql/

建立配置文件
[root@localhost mysql]# cp share/mysql/my-large.cnf /etc/my.cnf

建立启动数据库所用的用户mysql
[root@localhost mysql]# adduser -d /usr/local/mysql/var mysql

在用户宿主目录中修改.bashrc文件,添加命令的搜索路径
[root@localhost mysql]# vi var/.bashrc
set PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin/nologin

初始化数据库
[root@localhost mysql]# ./bin/mysql_install_db --user=mysql

[root@localhost mysql]# ls var
mysql mysql-bin.000001 mysql-bin.000002 mysql-bin.index test

4、启动数据库
[root@localhost mysql]# ./bin/mysqld_safe &

[root@localhost mysql]# ls var
ibdata1 localhost.localdomain.err mysql-bin.000001 mysql-bin.index
ib_logfile0 localhost.localdomain.pid mysql-bin.000002 mysql.sock
ib_logfile1 mysql mysql-bin.000003 test

开机自动运行
[root@localhost mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
[root@localhost mysql]# chkconfig --level 35 mysqld on

5、建立数据库管理员
[root@localhost mysql]# ./bin/mysqladmin -u root password xxxxxxxx

登陆测试
[root@localhost mysql]# ./bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

数据库常用管理命令,在/usr/local/mysql/bin目录下:
Mysql 显示和使用mysql数据库
Mysqladmini 创建和维护mysql数据库
Isamachk 修复、检查和优化.ism后缀的数据文件
Mysqldump 备份数据库
Myisamchk 修复.myi后缀的数据文件
Mysql.server start stop 启动和停止mysql

二、编译安装pure-ftpd

1、编译安装pureftp 源代码http://www.pureftpd.org/

[root@localhost pure-ftpd-1.0.22]# ./configure --prefix=/usr/local/pureftpd --with-cookie --with-throttling --with-ratios --with-quotas --with-sysquotas --with-largefile --with-welcomemsg --with-upload_script_ --with-virtualhosts --with-virtualroot --with-virtualchroot --with-diraliases --with-peruserlimits --with-language=simplified-chinese --with-mysql=/usr/local/mysql --with-paranoidmsg --with-altlog --with-puredb

如果出现类似configure: error: Your MySQL client libraries aren't properly installed 的错误,将mysql目录下的 include/mysql下的mysql.h文件以及lib/mysql下的全部文件,连接(直接复制过去或许也可)到 /usr/lib 目录下.

[root@localhost pure-ftpd-1.0.22]# make ; make install

2、建立配置文件

[root@localhost pure-ftpd-1.0.22]# mkdir -m 755 /usr/local/pureftpd/etc

[root@localhost pure-ftpd-1.0.22]# cp pureftpd-mysql.conf /usr/local/pureftpd/etc/
[root@localhost pure-ftpd-1.0.22]# cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/
[root@localhost pure-ftpd-1.0.22]# cp configuration-file/pure-config.pl /usr/local/pureftpd/bin/
[root@localhost pure-ftpd-1.0.22]# chmod u+x /usr/local/pureftpd/bin/pure-config.pl

三、建立mysql认证数据库表
[root@localhost pure-ftpd-1.0.22]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

mysql> create database pureftpd;
mysql> grant all on pureftpd.* to pureftpd@localhost identified by 'pureftpd';
mysql> use pureftpd

mysql> CREATE TABLE users (
id int(32) unsigned NOT NULL auto_increment,
User varchar(16) NOT NULL default '*',
Password varchar(64) NOT NULL default '*',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '-1',
QuotaSize smallint(5) NOT NULL default 0,
QuotaFiles int(11) NOT NULL default 0,
ULBandwidth smallint(5) NOT NULL default 0,
DLBandwidth smallint(5) NOT NULL default 0,
ULRatio smallint(6) NOT NULL default 0,
DLRatio smallint(6) NOT NULL default 0,
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
status enum('0','1') NOT NULL default '0',
create_date datetime NOT NULL default '0000-00-00 00:00:00',
modify_date datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id,User),
UNIQUE KEY User (User)
) TYPE=MyISAM AUTO_INCREMENT=5;

建立用户
INSERT INTO users VALUES (1,'chenye', 'qqqqqq', '2000', '2000', '/var/pureftp', 0, 0, 0, 0, 0, 0, '*', '*', '1', '2009-7-11 09:20:33', '2009-7-11 09:20:33');

四、建立用于pureftpd认证用户的系统信息

[root@localhost /]# groupadd -g 2000 pureftp
[root@localhost /]# useradd -u 2000 -g pureftp -d /var/pureftp -s /sbin/nologin pureftp

五、修改pureftpd的配置文件

[root@localhost var]# vi /usr/local/pureftpd/etc/pure-ftpd.conf

MySQLConfigFile /usr/local/pureftpd/etc/pureftpd-mysql.conf
NoChmod yes
IPV4Only yes
DisplayDotFiles no 不显示隐藏文件

CreateHomeDir yes 自动建立家目录

[root@localhost var]# vi /usr/local/pureftpd/etc/pureftpd-mysql.conf

MYSQLSocket /usr/local/mysql/var/mysql.sock
MYSQLUser pureftpd
MYSQLPassword pureftpd
MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L"
MySQLGetQTASZ SELECT QuotaSize FROM users WHERE User="\L"

六、运行pureftpd

启动pureftpd
[root@localhost ~]# /usr/local/pureftpd/bin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf

启动自动运行
[root@localhost ~]# vi /etc/init.d/pureftpd

#!/bin/bash
#
# Startup script for the pure-ftpd FTP Server $Revision: 1.3 $
#
# chkconfig: 2345 85 15
# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd
# processname: pure-ftpd
# pidfile: /var/run/pure-ftpd.pid
# config: /etc/pure-ftpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

# Path to the pure-ftp binaries.
prog=pure-config.pl
fullpath=/usr/local/pureftpd/bin/$prog
pureftpwho=/usr/local/pureftpd/sbin/pure-ftpwho

start() {
echo -n $"Starting $prog: "
$fullpath /usr/local/pureftpd/etc/pure-ftpd.conf --daemonize
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
echo
}

stop() {
echo -n $"Stopping $prog: "
kill $(cat /var/run/pure-ftpd.pid)
RETVAL=$?
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)

stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ] ; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $prog
RETVAL=$?
if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then
$pureftpwho
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL

**********不能把用户的dir放在其他用户的dir下面,否则会出现不能登录的问题。************

QUICK TAGS

centosmysqlpureftpd

8 USER COMMENTS

  1. 喜多福,乾拌麵,拌麵,乾麵,呷什麵,關廟麵,手工麵,手作麵,沙茶咖哩,川味麻辣 牛肉風味,油蔥香菇,香蒜麻醬,紅油烏醋,麻辣麻醬,川味麻辣,團購美食,sidofu,日曬麵條,古法手工精製,日光自然曬乾

    https://www.sidofu.net/

  2. 【揚歌-教學麥克風直營店】官方線上購物網站─JM-180B有線麥克風擴音器│無線麥克風擴音器│揚歌小蜜蜂│專營教學麥克風及教學擴音器

    https://mic-shop.com/

  3. Thanks for finally writing about >CentOS下mysql+pureftpd的编译安装 - PageDNS
    主机播报|VPS主机|美国VPS|美国主机|Linux vps|低价VPS|主机代购|免费空间

  4. Hello my name is Britney and I just wanted to drop you a quick note here instead of calling you. I discovered your CentOS下mysql pureftpd的编译安装 - PageDNS 主机播报|VPS主机|美国VPS|美国主机|Linux vps|低价VPS|主机代购|免费空间 page and noticed you could have a lot more hits. I have found that the key to running a successful website is making sure the visitors you are getting are interested in your website topic. There is a company that you can get keyword targeted traffic from and they let you try their service for free for 7 days. I managed to get over 300 targeted visitors to day to my site. https://oje.lol/4n

  5. Anetheron美服魔兽世界100-110级代练。PLS173.com这个平台不错,24小时客服很方便,价格不是最便宜的,但是代练要的是安全。我的职业是德鲁伊。

  6. Whhat you posted was very logical. However, what about this?

    what if you added a little content? I am not suggesting your
    information isn't good, however suppose you added a title that grabbed folk's attention? I mean CentOS下mysql+pureftpd的编译安装 - PageDNS 主机播报|VPS主机|美国VPS|美国主机|Linux vps|低价VPS|主机代购|免费空间 is kinda plain.
    You could look at Yahoo's front page and watch how they create article titles to grab viewers to open the links.
    You might try adding a video or a related picture or two to grab readers excited about what
    you've written. Just my opinion, it might bring your posts
    a little livelier.

  7. Hallo!Schön dass das Forum so schnell online gegangen ist!Golden Carriage (chin. Jin Yu 金輿) wird anhand der TD mit den Ez berechnet:+H -H +F -F +E -E +M -M +W -WE+ F- E2- M+ E2- M+ E2+ W- E- H+Über die Bedeutung habe ich nichts gefunden.

  8.  ( 2012.12.20 05:13 ) : 感谢博主,前几次借助博主的分享成功卸载了几次,但是反复多卸载重装个几次,不管用了,卸载不干净。后来用这个搞定了如果运行这些第二步、apt-get rvoeme mysql-server purge第三步、apt-get rvoeme mysql-common purge 您没卸载干净,那你可以 第一步、apt-get -f autoremove 第二步、apt-get rvoeme mysql-server purge 第三步、apt-get rvoeme mysql-common purge

Leave a Comment

Other

Copyright © 2007-2010 PageDNS, Some Rights Reserved. Theme by M4 | Powered by Typecho))) | Hosted by 37hi.com.