
Streeme
Googleの音楽ストリーミング用のオープンソース。
iTunesライクなインターフェイスで、MITライセンスなので自由に使えます。
さくらのVPSにインストールしたので、そのメモ
1 さくらのVPSの準備
さくらのVPSを借りたあとに設定した事。
1-1. SSH設定
vim /etc/ssh/sshd_config
Port 10415
PermitRootLogin no
1-2. 不要なデーモンを停止
chkconfig haldaemon off
chkconfig acpid off
chkconfig messagebus off
chkconfig autofs off
chkconfig auditd off
chkconfig lvm2-monitor off
chkconfig mdmonitor off
chkconfig messagebus off
chkconfig netfs off
chkconfig restorecond off
chkconfig smartd off
chkconfig yum-updatesd
1-3. PHP5.3.10とMYSQL5.5.23をインストール
[]$ yum -y update
[]$ rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
[]$ rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm (↑が繋がらない場合)
[]$ rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[]$ yum -y install httpd httpd-server
[]$ yum -y install –enablerepo=remi php-mysql
[]$ yum -y install –enablerepo=remi mysql mysql-server
[]$ yum -y install –enablerepo=remi php
[]$ yum -y install –enablerepo=remi php-pear*
[]$ chkconfig mysqld on
[]$ chkconfig httpd on
[]$ /etc/init.d/mysqld start
[]$ /etc/init.d/httpd start
1-4. FTPのインストール(必要であれば)
FTPをインストール。
[]$ yum -y install –enablerepo=remi vsftpd
[]$ chkconfig –level 3 vsftpd on
/etc/vsftpd/vsftpd.conf
# 匿名でのアクセス禁止
anonymous_enable=NO
# chroot設定
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
# ローカルタイム設定
use_localtime=YES
2 Streemeのインストール
公式ドキュメントを参考にインストール。
http://code.google.com/p/streeme/wiki/InstallingStreemeLinux
2-1. Streemeソースのダウンロード
[]$ cd /var/www/
[]$ svn checkout http://streeme.googlecode.com/svn/trunk/ yourdomain.com
[]$ chown apache:apache -R yourdomain.com
[]$ chmod g+w -R yourdomain.com
2-2. Apaceh設定
vim /etc/httpd/conf.d/streeme.conf
# This is the configuration for the streeme app communication path NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/var/www/yourdomain.com/web" DirectoryIndex index.php ServerName yourdomain.com <Directory "/var/www/yourdomain.com/web"> AllowOverride All Allow from All </Directory> Alias /sf "/var/www/yourdomain.com/lib/vendor/symfony/data/web/sf" <Directory "/var/www/yourdomain.com/lib/vendor/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost> # ストリーミング用サーバーの設定 Listen *:8096 NameVirtualHost *:8096 <VirtualHost *:8096> DocumentRoot "/var/www/yourdomain.com/web" DirectoryIndex index.php <Directory "/var/www/yourdomain.com/web"> AllowOverride All Allow from All </Directory> </VirtualHost> #Disable SVN directory sniffing through apache <Directory ~ ".*\.svn"> Order allow,deny Deny from all Satisfy All </Directory>
設定できたらサーバーを再起動。
2-3. PHP設定
[]$ vim /etc/php.ini
magic_quotes_gpc = Off
short_open_tag = Off
memory_limit = 256M or higher
date.timezone = “Asia/Tokyo”
必要なライブラリをインストール。
[]$ yum -y install --enablerepo=remi php-cli (既にインストールされている)
[]$ yum -y install --enablerepo=remi php-pear
[]$ yum -y install --enablerepo=remi curl php-curl (既にインストールされている)
[]$ yum -y install --enablerepo=remi php-gd (既にインストールされている)
[]$ yum -y install --enablerepo=remi php-pecl-apc
[]$ yum -y install --enablerepo=remi php-posix
[]$ pear install -a HTTP_Download
2-4. MYSQL設定
[]# vim /etc/my.cnf
************** my.cnf ************
[mysqld]
# メモリ容量に合わせて調整
query_cache_type=1
query_cache_size=32M
innodb_buffer_pool_size=512M
thread_cache=1M
table_cache=1M
sort_buffer=1M
join_buffer_size = 4M
key_buffer=16M[mysql]
default-character-set=utf8
**********************************
[]# /etc/init.d/mysqld restart
2-5. FFMPEGをインストール
CentOS6のrpmforgeからFFMPEGをインストールします。
(FFMPEGをなくてもOK。あるとビットレートを動的に変更できるようになる。)
[]$ mkdir ~/sources
[]$ cd ~/sources
[]$ wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
[]$ rpm -Uhv rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
[]$ yum –enablerepo=rpmforge install -y ffmpeg
2-6. サーバー再起動
ここまでできたら、一旦再起動
[]$ /etc/init.d/httpd restart
[]$ /etc/init.d/mysqld restart
3 Streeme設定
3-1. DB作成&設定
MySQLでデータベース「streeme」を作成。
[]# mysql -u root
mysql> CREATE DATABASE `streeme` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
mysql> CREATE DATABASE `streemetest` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
mysql> exit
streemeでDB設定。
[]# cd /var/www/mydomain.com/
[]# cp config/databases.template.yml config/databases.yml
[]# vim config/databases.ymlusername: your_mysql_username
password: your_mysql_pass
3-2. フォルダの権限変更
logフォルダとcacheフォルダの権限を777に変更。
[]$ chmod 777 log cache
3-3. アプリ設定
[]$ cp apps/client/config/app.template.yml apps/client/config/app.yml
[]$ vim apps/client/config/app.yml
# 変更した場所
itunes_xml_location: “/home/notroot/music/iTunes Music Library.xml” # iteunsと連携させる場合は適切なパスに変更
results_per_page: 100
wf:
watched_folders:
– “/home/{username}/music” # 音楽データを保存する任意のパスを指定
3-4. Amazon連携
Amazon Web Serviceと連携するための設定。
ファイルだけ作っておく。。
cp config/cloudfusion.template.php config/cloudfusion.php
3-5. キャッシュクリア&テスト
こんな感じで表示されれば完了。
[]# ./symfony cc
[]# php check_configuration.php
********************************
* *
* symfony requirements check *
* *
********************************php.ini used by PHP: /etc/php.ini
** WARNING **
* The PHP CLI can use a different php.ini file
* than the one used with your web server.
* If this is the case, please launch this
* utility from your web server.
** WARNING **** Mandatory requirements **
OK PHP version is at least 5.2.4 (5.3.10)
OK PEAR HTTP_Download is Installed
OK Symfony is Installed** Optional checks **
OK PDO is installed
OK PDO has some drivers installed: mysql, pgsql, sqlite
OK PHP-XML module is installed
OK XSL module is installed
OK The token_get_all() function is available
OK The mb_strlen() function is available
OK The iconv() function is available
OK The utf8_decode() is available
OK The posix_isatty() is available
OK A PHP accelerator is installed
OK php.ini has short_open_tag set to off
OK php.ini has magic_quotes_gpc set to off
OK php.ini has register_globals set to off
OK php.ini has session.auto_start set to off
OK PHP version is not 5.2.9
3-5. サイトにアクセス
サイトにアクセスして下記の画面が表示されればOK!
はまった箇所
{StreemeMediaProxy} The file for key *********************** could not be read from the filesystem
【確認事項】
1. php check_configuration.phpで全てOKがでているか確認
2. mod_rewriteが正しくインストールできているか確認。
3. musicフォルダの権限が正しいか確認。
※3で、home直下のディレクトリの権限を変更するのを忘れていたため音楽が再生されなかった・・。