アンケートシステム構築:LimeSurvey
LimeSurveyはオープンソースで配布されており、人気の高いアンケートシステム。
やりたいこと
IE等のWebブラウザから、アンケートシステムを提供可能とする。
http://192.168.0.10/LimeSurvey/
条件
使用OS | CentOS5.5 64bit |
アプリ | Apache+PHP+MySQL (CentOS付属) |
文字コード | utf-8 |
ファイル入手
- LimeSurvey Documentation Wiki
http://docs.limesurvey.org/
- 今回は以下ファイルを入手
limesurvey187plus-build8518-20100323.zip
http://sourceforge.net/projects/limesurvey/files/1._LimeSurvey_stable/1.87%2B/limesurvey187plus-build8518-20100323.zip/download
MySQLデータベース作成
(1)MySQLデータベース作成
【telnet】
- スーパーユーザでログイン
$ su パスワード:
- MySQLにログイン
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 45 Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- 「limeservey」データベース作成
mysql> create database limesurvey ; Query OK, 1 row affected (0.02 sec)
- 「limeservey」ユーザ作成
mysql> grant all privileges on limesurvey.* to limesurveyuser@localhost identified by 'limesurveypass'; Query OK, 0 rows affected (0.00 sec)
- 終了
mysql> exit Bye #
- データベース接続に問題が無いか確認
# mysql -u limesurveyuser -plimesurveypass limesurvey Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 223 Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> exit Bye
インストール
(1)ファイル転送
【FTP】
ftp にて、ユーザエリア「/home/hogehoge」にlimesurvey187plus-build8518-20100323.zipをアップ
(2)インストール
【telnet】
- パッケージがあるか確認
# ls -l -rw-r--r-- 1 hogehoge hogehoge 23365860 7月 26 15:14 limesurvey187plus-build8518-20100323.zip
- パッケージを解凍
# unzip limesurvey187plus-build8518-20100323.zip Archive: limesurvey187plus-build8518-20100323.zip creating: limesurvey/ inflating: limesurvey/COPYRIGHT.php inflating: limesurvey/LICENSE.php :
- 確認
# ls -l drwxr-xr-x 12 root root 4096 3月 23 22:23 limesurvey -rw-r--r-- 1 hogehoge hogehoge 23365860 7月 26 15:14 limesurvey187plus-build8518-20100323.zip
(3)limesurveyファイルをhtml直下にコピー
- ファイルコピー
# cp -R limesurvey /var/www/html/
- 確認
[root@hogehogeServer hogehoge]# ls -l /var/www/html/ drwxr-xr-x 12 root root 4096 7月 26 15:21 limesurvey
- 所有者変更
# chown -R apache:apache /var/www/html/limesurvey/
- 確認
# ls -l /var/www/html/ drwxr-xr-x 12 apache apache 4096 7月 26 15:21 limesurvey
- 権限変更
# chmod 775 /var/www/html/limesurvey/tmp/
- 確認
# ls -l /var/www/html/limesurvey/ drwxrwxr-x 2 apache apache 4096 7月 26 15:21 tmp
設定
(1)limesurvey config.php設定
- config編集
# vi /var/www/html/limesurvey/config.php
$databasetype = 'mysql'; $databaselocation = 'localhost'; $databasename = 'limesurvey'; $databaseuser = 'root'; $databasepass = '';
↓
$databasetype = 'mysql'; ← 変更なし確認 $databaselocation = 'localhost'; ← 変更なし確認 $databasename = 'limesurvey'; ← 変更なし確認 $databaseuser = 'limesurveyuser'; $databasepass = 'limesurveypass';
(3)limesurvey設定
【Web】
- 以下URLにアクセス
http://192.168.0.10/limesurvey/admin/install/index.php → LimeSurvey Setup 設定画面が表示
- 「Populate datbase」ボタン押下
「Database `limesurvey` has been successfully populated.」と表示
- 「Main admin screen」ボタンを押下
「Everything is fine - you just forgot to delete or rename your LimeSurvey installation directory (/admin/install).
Please do so since it may be a security risk.」と表示
(4)後処理
【telnet】
- installディレクトリ削除
# rm -Rf /var/www/html/limesurvey/admin/install/
- 終了
# exit exit $
動作確認
以下URLにアクセス
http://192.168.0.10/limesurvey/admin/admin.php → 「You have to login first.」画面が表示
→以下名称でログイン
Username:admin
Password:password
Language:日本語-Japanese
・・・管理画面になる。
★完了
遭遇したトラブル
「Everything is fine - you just ~」エラー発生
問題:
http://192.168.0.10/limesurvey/admin/admin.php にアクセスしても「Everything is fine - you just ~」になる。
原因:
/var/www/html/limesurvey/admin/install/ 削除漏れ
「Can't connect to LimeSurvey database. Reason:~」エラー発生
問題:
・http://192.168.0.10/limesurvey/admin/admin.php にアクセスしても
「Can't connect to LimeSurvey database. Reason: Access denied for user 'limesurvey'@'localhost' (using password: YES)」となる
原因:
mysql作成ミス。db名、ユーザ名、パスワード再確認、わからない場合はMysql再作成すること。
謝辞
テキスト作成に当たり、以下サイトを参考にさせて頂きました。ありがとうございます。
http://docs.limesurvey.org/tiki-index.php?page=%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB#LimeSurvey__2
http://blog.olivesystem.com/1403.html