#!/bin/bash
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/America/Edmonton /etc/localtime
echo "[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1" > /etc/yum.repos.d/10gen.repo
yum -y update
yum -y install vim-enhanced wget at zip unzip vixie-cron crontabs iptables system-config-firewall-tui
yum -y install httpd mod_ssl php php-pear php-devel php-xml httpd-devel make gcc zlib-devel curl-devel pcre-devel
yum -y install subversion java mongo-10gen mongo-10gen-server
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum -y update
yum -y install pdftk
rm -rf rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
echo "upload_max_filesize = 50M" > /etc/php.d/upload_settings.ini
echo "post_max_size = 50M" >> /etc/php.d/upload_settings.ini
pecl channel-update pecl.php.net
printf "\n" | pecl install pecl_http
echo "extension=http.so" > /etc/php.d/pecl.ini
printf "\n" | pecl install apc
echo "extension=apc.so" > /etc/php.d/apc.ini
echo "apc.rfc1867 = on" >> /etc/php.d/apc.ini
printf "\n" | pecl install mongo
echo "extension=mongo.so" > /etc/php.d/mongo.ini
echo "auth = true" >> /etc/mongod.conf
echo "rest = true" >> /etc/mongod.conf
echo '<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/json
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>' > /etc/httpd/conf.d/deflate.conf
## mongo connection problem
/usr/sbin/setsebool -P httpd_can_network_connect 1
## centos iptables problem
#/etc/init.d/iptables stop
#chkconfig iptables off
chkconfig crond on
service crond start
chkconfig mongod on
service mongod start
service iptables start
chkconfig --level 345 iptables on
svn checkout --non-interactive --trust-server-cert --username zawaung --password "$%^Aung789" svn://testing.medcloud.ca/trunk/ /var/www/html
chmod -R 777 /var/www/html/forms/tmp
echo "syntax on" > ~/.vimrc
ln -s /var/www/html ~/www
echo "display_errors = on" >> /etc/php.d/debug_settings.ini
echo "
<VirtualHost *:80>
ServerAdmin admin@medcloud.ca
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options FollowSymLinks MultiViews
Options -Indexes
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory ~ '\.svn'>
Order allow,deny
Deny from all
</Directory>
</VirtualHost>
" > /etc/httpd/conf.d/vhost.conf
chkconfig --levels 235 httpd on
service httpd start
mongodump -h testing.medcloud.ca -u Administrator -p 'A!8;0minT35t;ing'
mongorestore --drop