#!/bin/sh # rootで実行してください。 WHOAMI=`/usr/bin/whoami` if [ $WHOAMI != "root" ]; then echo "You must be root to this process" exit 1 fi # apacheの実行ユーザ・グループに書き換えてください。(デフォルトはapache,apache) apacheuser=apache apachegrp=apache # 必要なパッケージをインストールします。 # 既にソースからインスコしてる場合はその部分を削除orコメントアウトしてください。 yum -y install yum-fastestmirror yum -y install wget yum -y install unzip yum -y install subversion yum -y install automake yum -y install gcc yum -y install gcc-c++ yum -y install libtool yum -y install ruby yum -y install mysql-server yum -y install php php-cli php-gd php-mysql yum -y install php-devel # RPMForgeリポジトリを追加 wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm rm -f rpmforge-release-0.3.6-1.el5.rf.i386.rpm # --enablerepo=rpmforgeで有効になるように変更 sed -i "s/enabled = 1/enabled = 0/g" /etc/yum.repos.d/rpmforge.repo # Dagリポジトリの追加。 cat <> /etc/yum.repos.d/dag.repo [dag] name=Dag RPM Repository for Redhat EL5 baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag gpgcheck=1 enabled=0 gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt EOF # 追加リポジトリからインストール yum -y --enablerepo=dag install yasm git # コーデック類のインストール # 作業用ディレクトリの作成 mkdir /tmp/install/ cd /tmp/install/ # x264のインストール git clone git://git.videolan.org/x264.git cd x264 ./configure --enable-shared make && make install cd /tmp/install/ # xvidのインストール wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz tar zxvf xvidcore-1.2.1.tar.gz cd xvidcore/build/generic ./configure make && make install cd /tmp/install/ # lameのインストール wget http://jaist.dl.sourceforge.net/sourceforge/lame/lame-3.98.4.tar.gz tar zxvf lame-3.98.4.tar.gz cd lame-3.98.4 ./configure make && make install cd /tmp/install # flvtoolのインストール wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz tar zxvf flvtool2-1.0.6.tgz cd flvtool2-1.0.6 ruby setup.rb config ruby setup.rb setup ruby setup.rb install cd /tmp/install/ # 残りのコーデックをインストール yum -y --enablerepo=rpmforge install a52dec-devel faac-devel # コーデックを有効にする echo "/usr/local/lib" >> /etc/ld.so.conf.d/lib.conf ldconfig # ffmpegとmplayerの入手及びインストール svn co svn://svn.mplayerhq.hu/mplayer/trunk mplayer svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg cd mplayer ./configure make && make install cd /tmp/install/ffmpeg ./configure --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libfaac --enable-pthreads --enable-gpl --enable-shared --enable-nonfree make && make install cd /tmp/install/ ldconfig # ffmpeg-phpのインストール wget http://jaist.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.2.tbz2 tar jxvf ffmpeg-php-0.6.2.tbz2 cd ffmpeg-php-0.6.2 phpize ./configure make && make install # ffmpeg-phpの有効化 echo "extension=ffmpeg.so" >> /etc/php.ini cd /tmp/install/ # 設定を有効化するためにapacheの再起動(reloadでもおk) /etc/init.d/httpd restart /etc/init.d/mysqld restart # phpinfoを作成 cat <> /var/www/html/phpinfo.php EOF cd /root unzip phpmotion.zip mv phpmotion /var/www/html/video chown -R $apacheuser:$apachegrp /var/www/html/video cd /var/www/html/video chmod -R 755 cgi-bin/* # cgi-bin内の書き換え sed -i 's/\/temp\//\/video\/temp\//g' /var/www/html/video/cgi-bin/uu_default_config.pm sed -i 's/\/uploads\/avi\//\/video\/uploads\/avi\//g' /var/www/html/video/cgi-bin/uu_default_config.pm sed -i 's/\/uploader_finished.php/\/video\/uploader_finished.php/g' /var/www/html/video/cgi-bin/uu_default_config.pm sed -i 's/\/temp\//\/video\/temp\//g' /var/www/html/video/cgi-bin/audio/uu_default_config.pm sed -i 's/\/uploads\/audio\//\/video\/uploads\/audio\//g' /var/www/html/video/cgi-bin/audio/uu_default_config.pm sed -i 's/\/audio_uploader_finished.php/\/video\/audio_uploader_finished.php/g' /var/www/html/video/cgi-bin/audio/uu_default_config.pm # uploader_conlib.php,audio_uploader_conlib.phpの書き換え sed -i 's/\/cgi-bin\/audio\/uu_upload.pl/\/video\/cgi-bin\/audio\/uu_upload.pl/g' /var/www/html/video/audio_uploader_conlib.php sed -i 's/\/cgi-bin\/audio\/uu_ini_status.pl/\/video\/cgi-bin\/audio\/uu_ini_status.pl/g' /var/www/html/video/audio_uploader_conlib.php sed -i 's/\/cgi-bin\/uu_upload.pl/\/video\/cgi-bin\/uu_upload.pl/g' /var/www/html/video/uploader_conlib.php sed -i 's/\/cgi-bin\/uu_ini_status.pl/\/video\/cgi-bin\/uu_ini_status.pl/g' /var/www/html/video/uploader_conlib.php # /.htaccessの書き換え sed -i 's/RewriteBase \//RewriteBase \/video/g' /var/www/html/video/.htaccess