在Debian Lenny Server上安装PlaySMS和SMS Server Tools 3
在我们开始之前
本教程将向您展示如何在Debian上使用playms和smstools设置SMS服务器。 在我的例子中,我使用了一个老的诺基亚5140i与USB数据。
我们开始之前我们需要的是apache2,mysql server,php5,lynx,wget,curl。
现在我们安装更新,并安装依赖关系:
apt-get update
apt-get upgrade
apt-get install apache2 libapache2-mod-php5 mysql-server php5 php5-cli php5-cgi php-pear php-db phpmyadmin make gcc sendmail sendmail-bin lynx wget curl
现在为mysql root用户创建密码,并记住它。
安装剧本
adduser playsms
mkdir -p /var/www/playsms
mkdir -p /var/spool/playsms
mkdir -p /var/log/playsms
chown -R www-data /var/www/playsms
chown -R www-data /var/spool/playsms
chown -R www-data /var/log/playsms
然后下载最新版本的playSMS,在这里找到最新版本,或者抓住我的url:http: //sourceforge.net/projects/playsms/
wget http://downloads.sourceforge.net/project/playsms/playsms/Version%200.9.7.2/playsms-0.9.7.2.tar.gz
这将解压缩到/ usr / local / src
。
tar -zxvf playsms-0.9.7.2.tar.gz -C /usr/local/src
现在转到以下文件夹:
cd /usr/local/src/playsms-0.9.7.2/web
现在运行以下命令:
键入mysql root密码,当您被要求输入密码。
cp -rR * /var/www/playsms
chown -R www-data /var/www/playsms
mysqladmin -u root -p create playsms
现在我们从playms导入mysql数据库,如果你安装另一个版本,记得改变路径。
键入mysql root密码,当您被要求输入密码。
mysql -u root -p playsms < /usr/local/src/playsms-0.9.7.2/db/playsms.sql
这里我们将配置文件,你必须填写这些字段:
cd /var/www/playsms
cp config-dist.php config.php
nano config.php
所以看起来像这样(用你的密码替换'my_password_for_mysql_root_user'
,不要删除''
):
<?php
// PHP PEAR DB compatible database engine:
// msql, mssql, mysql, oci8, odbc, pgsql, sqlite
$core_config['db']['type'] = 'mysql'; // database engine
$core_config['db']['host'] = 'localhost'; // database host/server
$core_config['db']['port'] = '3306'; // database port
$core_config['db']['user'] = 'root'; // database username
$core_config['db']['pass'] = 'my_password_for_mysql_root_user'; // database password
$core_config['db']['name'] = 'playsms'; // database name
$core_config['db']['pref'] = 'playsms'; // table's prefix without trailing underscore
// SMTP configuration
$core_config['smtp']['relm'] = ''; // yes, not realm, its relm
$core_config['smtp']['user'] = '';
$core_config['smtp']['pass'] = '';
$core_config['smtp']['host'] = 'localhost';
$core_config['smtp']['port'] = '25';
// Do not change anything below this line unless you know what to do
// -----------------------------------------------------------------
// you can turn on or off PHP error reporting
// on production level you should turn off PHP error reporting (set to 0), by default its on
//error_reporting(0);
//error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
// logs directories
$apps_path['logs'] = '/var/log/playsms';
// log level: 0=disabled, 1=info, 2=warning, 3=debug, 4=verbose
// WARNING: log level 3 and 4 will also save sensitif information such as password for used gateway
$core_config['logstate'] = 0;
// 0 for single session login; 1 for multi session login
// multi session login is not secure because playsms leaves md5 crypted username and password
// on admin's computer
$core_config['multilogin'] = 0;
// are we using http or https ? the default is using http instead https
$core_config['ishttps'] = false;
?>
现在运行以下命令:
cd /usr/local/src/playsms-0.9.7.2/bin
cp playsmsd playsmsd.php playsmsd_start /usr/local/bin/
cp playsms /etc/default/
现在我们必须确保该程序将在系统启动时启动; 请执行以下操作:
nano /etc/init.d/rc.local
添加在文件的底部(退出之前,如果有一个退出命令)。 这样playmsd_start将在启动时自动启动。 保存并退出。
.... last line ....
/usr/local/bin/playsmsd_start
安装smstools
cd
wget http://smstools3.kekekasvi.com/packages/smstools3-3.1.15.tar.gz
tar -zxvf smstools3-3.1.15.tar.gz -C /usr/local/src
cd /usr/local/src/smstools3
make
make install
现在我们让剧情和smstools一起工作:
cd /usr/local/src/playsms-0.9.7.2
cp contrib/smstools/smsd.conf /etc/
现在我们必须编辑配置文件。
我的诺基亚5140i与USB数据可以被检测为ttyUSB0,所以我不必编辑端口,但如果您的手机被检测为别的东西,将其更改在第27行到ttyUSB1,ttyACM0
nano /etc/smsd.conf
我的配置文件如下所示:
# Global configuration
devices = modem1
loglevel = 4
logfile = /var/log/sms/smstools.log
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent
delaytime = 6
errorsleeptime = 12
blocktime = 180
autosplit = 3
receive_before_send = yes
# Modem configuration # iTegno 3000 USB
[modem1]
#init = device = /dev/ttyUSB0 incoming = yes #pin = baudrate = 115200
现在运行以下命令:
mkdir -p /var/spool/sms/checked
mkdir -p /var/spool/sms/failed
mkdir -p /var/spool/sms/incoming
mkdir -p /var/spool/sms/outgoing
mkdir -p /var/spool/sms/sent
mkdir -p /var/log/sms
chown -R www-data /var/spool/sms
update-rc.d sms3 defaults
浏览http:// your-server-ip / playsms /
并使用默认管理员用户登录:
用户名: admin
密码: admin
单击网关,单击管理smstools,单击(单击此处激活)。
您的服务器已启动并运行,准备使用。