最近把主機換到Linode VPS後,發現OpenMeetings也更新了版本,於是就跟著修改了OpenMeetings的自動安裝程式,主要是增加對64位元作業系統的支援,並且增加安裝中文字型,以解決轉檔時出現中文字型變成問號的問題,這次的自動安裝程式可以在新增好一個新的Linode VPS CentOS 5.4後直接執行,大約只需要花15分鐘就可以完成安裝。
#!/bin/bash
# Name: openmeetings.sh
# Author: Andowson Chang (andowson [at] gmail [dot] com)
# Version: 1.3
# Since: 2009-05-10
# Last Modified: 2010-05-17
# Modify here for newer version
SWFTOOLS_VERSION=0.9.0
FFMPEG_VERSION=0.5.1
SOX_VERSION=14.3.1
FLASH_PLAYER_VERSION=10.0.45.2
OPENMEETINGS_VERSION=1_1_r3087
# install PostgreSQL
yum -y install postgresql-server
/etc/init.d/postgresql start
sed -i -e "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /var/lib/pgsql/data/postgresql.conf
sed -i -e "s/local all all ident sameuser/local all all trust/g" /var/lib/pgsql/data/pg_hba.conf
sed -i -e "s/host all all 127.0.0.1\/32 ident sameuser/host all all 127.0.0.1\/32 md5/g" /var/lib/pgsql/data/pg_hba.conf
chkconfig --level 235 postgresql on
/etc/init.d/postgresql restart
#
# install openoffice-service running on port 8100 in headless mode
#
yum -y install openoffice.org-base openoffice.org-headless openoffice.org-writer openoffice.org-impress openoffice.org-calc
#
# generate openoffice startup script
#
echo '#!/bin/bash
# openoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik, Andowson Chang
#
# Source function library.
. /etc/rc.d/init.d/functions
if [ "`uname -p | grep 64`" != "" ]; then
OOo_HOME=/usr/lib64/openoffice.org3/program
else
OOo_HOME=/usr/lib/openoffice.org3/program
fi
SOFFICE_PATH=$OOo_HOME/soffice.bin
PIDFILE=/var/run/openoffice-server.pid
set -e
case "$1" in
start)
if [ -f $PIDFILE ]; then
echo "OpenOffice headless server has already started."
sleep 5
exit
fi
echo "Starting OpenOffice headless server"
$SOFFICE_PATH -headless -nologo -nofirststartwizard -accept="socket,host=127.0.0.1,port=8100;urp" & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo "Stopping OpenOffice headless server."
killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo "Openoffice headless server is not running."
exit
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0' > /etc/init.d/openoffice
chmod 755 /etc/init.d/openoffice
chkconfig --level 235 openoffice on
/etc/init.d/openoffice start
#
# install ImageMagick(=>GhostScript will be installed as dependency)
#
yum -y install ImageMagick
yum -y install make gcc gcc-c++
#
# install SWFTools
#
yum -y install giflib-devel libjpeg-devel freetype-devel
if [ ! -r swftools-${SWFTOOLS_VERSION}.tar.gz ]; then
wget http://www.swftools.org/swftools-${SWFTOOLS_VERSION}.tar.gz
fi
tar zxvf swftools-${SWFTOOLS_VERSION}.tar.gz
cd swftools-*
./configure
make
make install
cd ..
#
# install FFmpeg
#
if [ ! -r ffmpeg-${FFMPEG_VERSION}.tar.bz2 ]; then
wget http://www.ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2
fi
tar jxvf ffmpeg-${FFMPEG_VERSION}.tar.bz2
cd ffmpeg-*
./configure
make
make install
cd ..
#
# install SoX (Version > 12.xx)
#
if [ ! -r sox-${SOX_VERSION}.tar.gz ]; then
wget http://sourceforge.net/projects/sox/files/sox/${SOX_VERSION}/sox-${SOX_VERSION}.tar.gz/download
fi
tar zxvf sox-${SOX_VERSION}.tar.gz
cd sox-*
./configure
make
make -s && make install
cd ..
#
# install Flash player 10
#
rpm -Uvh http://fpdownload.macromedia.com/get/flashplayer/current/flash-plugin-${FLASH_PLAYER_VERSION}-release.i386.rpm
#
# install Chinese Font(reboot if needed)
#
yum -y install fonts-chinese fonts-ISO8859-2-75dpi
service xfs restart
#
# install OpenMeetings with Red5
#
if [ ! -r openmeetings_${OPENMEETINGS_VERSION}.zip ]; then
wget http://openmeetings.googlecode.com/files/openmeetings_${OPENMEETINGS_VERSION}.zip
fi
unzip openmeetings_${OPENMEETINGS_VERSION}.zip -d /var
# modify hibernate.cfg.xml
cd /var/red5/webapps/openmeetings/conf
cp -fp postgres_hibernate.cfg.xml hibernate.cfg.xml
sed -i -e '7c\ <session-factory>' hibernate.cfg.xml
sed -i -e '9c\ <property name="connection.username">openmeetings</property>' hibernate.cfg.xml
sed -i -e '10c\ <property name="connection.password">openmeetings</property>' hibernate.cfg.xml
#
# create user and database openmeetings
#
sudo -u postgres psql -c "create user openmeetings with encrypted password 'openmeetings' createdb;" template1
sudo -u postgres psql -c "create database openmeetings with encoding 'unicode';" -U openmeetings template1
sudo -u postgres psql -c "alter user openmeetings nocreatedb;" template1
#
# start up red5
#
chmod 755 /var/red5/red5*.sh
cd /var/red5
nohup ./red5.sh &
echo "SWFTools Path: `which pdf2swf`"
echo "ImageMagick Path: `which convert`"
echo "FFMPEG Path: `which ffmpeg`"
echo "SoX Path: `which sox`"
如果有找不到檔案問題,請修改/etc/sysconfig/i18n
LANG="zh_TW.UTF-8"
SUPPORTED="zh_TW.UTF-8:zh_TW:zh"
透過Apache存取,請修改/etc/httpd/conf.d/proxy_ajp.conf,加上下列設定
ProxyPass /openmeetings http://localhost:5080/openmeetings
ProxyPassReverse /openmeetings http://localhost:5080/openmeetings
安裝完成或日後升級OpenMeetings後,建議執行reboot重新開機。