マイクロブログ構築 StatusNet
マイクロブログを提供する。
マイクロブログとは、「つぶやき」と呼ばれる短い文を投稿、フォローしあうことにより互いにメッセージを交換し合えるサービス。
同サービスの草分け的存在である「Twitter」により一気に利用が広がった。
StatusNetはTwitterクローンとしてオープンソースで配布されており、完成度も高い。
目的
IE,FireFox等のWebブラウザから マイクロブログを提供可能とする。
http://192.168.0.10/statusnet/
構築条件
構築機器
- 仮想サーバ SUN VirtualBox 4.0 で構築
作成環境
OS | CentOS 6.0 64bit版 |
サーバ作成条件
サーバIP | 192.168.0.10/24 |
ホスト名 | hogehogeServer |
user | hogehoge |
userpasswd | hogehogepass |
mysqldb名 | mysql |
mysqluser名 | mysqluser |
mysqluserpasswd | mysqlpass |
作業ディレクトリ | /home/hogehoge |
手順記入ルール
- コマンド行頭記号で 「$」はユーザ権限 「#」はスーパーユーザー権限 を表示
- コマンドが長くなる場合は、行末に「\」を記述し複数行に記述。
ファイル入手
サイト
- StatusNet
http://status.net/open-source
今回インストールしたファイル
- 今回は以下ファイルを入手
statusnet-1.0.1.tar.gz
http://status.net/statusnet-1.0.1.tar.gz
前準備
- CentOSインストール 実施
- yumリポジトリ設定 実施
- LAMPサーバ構築 実施
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 2 Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- 「statusnet」データベース作成
mysql> create database statusnet ;
Query OK, 1 row affected (0.01 sec)
- 「statusnet」ユーザ作成
mysql> grant all privileges on statusnet.* to statusnetuser@localhost identified by 'statusnetpass';
Query OK, 0 rows affected (0.00 sec)
- 終了
mysql> exit Bye
- データベース接続に問題が無いか確認
# mysql -u statusnetuser -pstatusnetpass statusnet
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- 終了
mysql> exit Bye
インストール
(1) ファイル転送
【FTP】
ftp にて、ユーザエリア「/home/hogehoge」にstatusnet-1.0.1.tar.gzをアップ
(2)ファイルを展開
【Telnet】
- パッケージがあるか確認
# ls -l
-rw-rw-r-- 1 hogehoge hogehoge 11085894 10月 4 01:57 2011 statusnet-1.0.1.tar.gz
- パッケージを解凍
# tar zxvf statusnet-1.0.1.tar.gz
statusnet-1.0.1/ statusnet-1.0.1/.gitignore statusnet-1.0.1/CONFIGURE :
- 解凍ファイルがあるか確認
# ls -l
drwxrwxr-x 19 root root 4096 10月 4 01:46 2011 statusnet-1.0.1 -rw-rw-r-- 1 hogehoge hogehoge 11085894 10月 4 01:57 2011 statusnet-1.0.1.tar.gz
(3)html直下にコピー
【telnet】
- ディレクトリ名変更
# mv statusnet-1.0.1 statusnet
- 確認
# ls -l
drwxrwxr-x 19 root root 4096 10月 4 01:46 2011 statusnet -rw-rw-r-- 1 hogehoge hogehoge 11085894 10月 4 01:57 2011 statusnet-1.0.1.tar.gz
- ファイルコピー
# cp -R statusnet /var/www/html/
- ディレクトリがあるか確認
# ls -l /var/www/html/
drwxr-xr-x 19 root root 4096 11月 29 21:45 2011 statusnet
- 所有者変更
# chown -R apache:apache /var/www/html/statusnet/
- 確認
# ls -l /var/www/html/
drwxr-xr-x 19 apache apache 4096 11月 29 21:45 2011 statusnet
(4)追加ファイルインストール
- 追加モジュールをyumでインストール
# yum install php-xml
========================================================================================== Package Arch Version Repository Size ========================================================================================== Installing: php-xml x86_64 5.3.2-6.el6_0.1 updates 100 k
Transaction Summary ========================================================================================== Install 1 Package(s) Upgrade 0 Package(s)
- 再起動
# /etc/rc.d/init.d/httpd restart
httpd を停止中: [ OK ] httpd を起動中: [ OK ]
動作確認
【Web】
以下URLにアクセス
http://192.168.0.10/statusnet/install.php → StatusNet 設定画面が表示
設定
(1)StatusNet 初期設定
【Web】
- インストール画面を表示
statusnet
http://192.168.0.10/statusnet/install.php → Install StatusNet 定画面が表示
- 以下を設定
→「submit」をクリック
Site settings Site name hogehoge StatusNet Fancy URLs disable Database settings Hostname localhost Type MySQL Name statusnet DB username statusnetuser DB password statusnetpass Administrator settings Administrator nickname statusnetadmin Administrator password statusnetadminpass Confirm password (password再入力) Administrator e-mail statusnetadmin@hogehoge.com Subscribe to announcements (チェックを入れる) Site profile Type of site Public
(2)日本語化
【telnet】
- 初期画面を日本語化
# vi /var/www/html/statusnet/lib/language.php
- 329行目付近に行を追加
'ia' => array('q' => 0.8, 'lang' => 'ia', 'name' => 'Interlingua', 'direction' => 'ltr'), 'is' => array('q' => 0.1, 'lang' => 'is', 'name' => 'Icelandic', 'direction' => 'ltr'), 'it' => array('q' => 1, 'lang' => 'it', 'name' => 'Italian', 'direction' => 'ltr'), 'ja' => array('q' => 0.5, 'lang' => 'ja', 'name' => 'Japanese', 'direction' => 'ltr'), ←追加 'jp' => array('q' => 0.5, 'lang' => 'ja', 'name' => 'Japanese', 'direction' => 'ltr'), 'ka' => array('q' => 0.8, 'lang' => 'ka', 'name' => 'Georgian', 'direction' => 'ltr'),
- config設定
# vi /var/www/html/statusnet/config.php
- 最終行に以下2行を追加
$config['site']['timezone'] = ‘Asia/Tokyo’; $config['site']['language'] = ‘ja_JP’;
- 終了
# exit exit
(3)確認
【Web】
- 以下アドレスにアクセス
http://192.168.0.10/statusnet/ → ログイン画面が表示されることを確認
遭遇したトラブル
StatusNet 初期設定 画面でxmlwriterエラーが出る
問題:
StatusNet 初期設定でsubmitクリック時以下エラーが出る。
Cannot load required extension: xmlwriter
Cannot load required extension: dom
原因:
PHP-xmlのモジュール不足。以下手順で追加すること
# yum install php-xml
========================================================================================== Package Arch Version Repository Size ========================================================================================== Installing: php-xml x86_64 5.3.2-6.el6_0.1 updates 100 k
StatusNet アカウントユーザが登録できない
問題:
アカウント追加画面が無くアカウント追加が出来ない
原因:
Site profileを「Private」としたため
「Public」で登録すると、アカウント追加が任意で出来るようになる。
修正する場合は以下コマンドで
# vi config.php
- 修正
$config['site']['profile'] = 'private';
↓$config['site']['profile'] = 'public';
インストール画面でPCREエラーが出る
問題:
http://192.168.0.10/statusnet/install.php で以下エラーが出る。
PHP is linked to a version of the PCRE library that does not support Unicode properties. If you are running Red Hat Enterprise Linux / CentOS 5.4 or earlier, see our documentation page on fixing this.
原因:
PHPにリンクされているPCREのライブラリが古い。以下手順でPCREをアップデート
# yum update pcre
========================================================================================== Package Arch Version Repository Size ========================================================================================== Updating: pcre x86_64 8.11-1.el5_1.wing wing 1.0 M
Transaction Summary ========================================================================================== Install 0 Package(s) Upgrade 1 Package(s)
つぶやきの表示が崩れる
問題:
つぶやきを投稿すると、表示が縦に並ばす、下のメッセージが右にずれていく
原因:
症状が出たのが、「statusnet-0.9.6」を「Firefox3.6.13」で表示させたとき。
IE8で確認するときちんと表示されるため、ブラウザとの相性で発生か?
利用ブラウザを変更する。・・か?
謝辞
テキスト作成に当たり、以下サイトを参考にさせて頂きました。ありがとうございます。
http://masutaka.net/chalow/2010-04-18.html
http://d.hatena.ne.jp/matoken/20090903/1251994078