Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonatw/3496983 to your computer and use it in GitHub Desktop.
Save jonatw/3496983 to your computer and use it in GitHub Desktop.
RightImage_CentOS_5.4_x64_v5.6.8.1 (ami-f2423ca0) singapore
#!/bin/bash
#bash <(curl -fsSLk https://raw.github.com/gist/3496983)
yum -y install sudo
yum -y install ImageMagick
yum -y install wget
yum -y install make
yum -y install gcc
yum -y install libtool
yum -y install zlib-devel
yum -y install openssl-devel
yum -y install libxml2 libxml2-devel
yum -y install bzip2 bzip2-devel
yum -y install curl
yum -y install libjpeg-devel libpng-devel
yum -y install mysql mysql-devel
yum -y install freetype freetype-devel
yum -y install make
yum -y install gmp-devel
yum -y install epel
yum -y install libmcrypt libmcrypt-devel
yum -y install libtidy libtidy-devel
yum -y install libxslt-devel
yum -y install libtool.x86_64 libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64
yum -y install mhash
yum -y install mhash-devel
yum -y install cronolog
yum -y install gdbm-devel db4-devel
yum -y install pcre-devel
yum -y install libc-client-devel
yum -y install ncurses ncurses-devel
yum -y install postgresql postgresql-libs postgresql-devel
yum -y install sqlite-devel sqlite
yum -y install aspell-devel
yum -y install readline-devel
yum -y install net-snmp net-snmp-devel
yum -y install lynx
yum -y install libcurl
yum -y install curl
yum -y install curl-devel
yum -y install krb5-devel
yum -y install openldap
yum -y install openldap-devel
yum -y install unixODBC-devel
yum -y install ntp
cd /usr/local/src/
wget http://archive.apache.org/dist/httpd/httpd-2.2.11.tar.gz
cd /usr/local/src/
tar -zxvf httpd-2.2.11.tar.gz
cd /usr/local/src/
wget http://museum.php.net/php5/php-5.2.10.tar.gz
cd /usr/local/src/
tar -zxvf php-5.2.10.tar.gz
cd /usr/local/src/httpd-2.2.11
#./configure '--prefix=/opt/httpd' '--enable-modules=all' '--enable-mods-shared=all' '--enable-authn-dbm' '--enable-authn-anon' '--enable-authn-dbd' '--enable-authz-dbm' '--enable-authz-owner' '--enable-file-cache' '--enable-dbd' '--enable-expires' '--enable-headers' '--enable-logio' '--enable-ident' '--enable-usertrack' '--enable-proxy' '--enable-proxy-connect' '--enable-proxy-ftp' '--enable-proxy-http' '--enable-proxy-scgi' '--enable-proxy-ajp' '--enable-proxy-balancer' '--enable-info' '--enable-dav-fs' '--enable-vhost-alias' '--enable-imagemap' '--enable-speling' '--enable-rewrite' '--enable-so' '--enable-readline' '--enable-cache' '--enable-disk-cache' '--enable-mem-cache'
./configure --prefix=/opt/httpd-2.2.11 --enable-modules=all --enable-mods-shared=all --enable-proxy --enable-ssl --enable-so --with-mpm=prefork --with-pcre
make -j8
make install
ln -s /opt/httpd-2.2.11 /opt/httpd
ln -s /opt/httpd/bin/* /usr/local/bin/
ln -s /opt/httpd/include/* /usr/local/include/
ln -s /opt/httpd/lib/* /usr/local/lib/
cd /usr/local/src/php-5.2.10
./configure '--with-apxs2=/opt/httpd/bin/apxs' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-ncurses=shared' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-mysql=shared,/usr/lib64/mysql' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--enable-dbase=shared' '--with-mhash=shared' '--with-mcrypt=shared'
make -j8
make install
ln -s /opt/php/bin/* /usr/local/bin/
ln -s /opt/php/etc/* /usr/local/etc/
ln -s /opt/php/include/* /usr/local/include/
ln -s /opt/php/lib/* /usr/local/lib/
cp ../php-5.2.10/php.ini-recommended /etc/php.ini
cd /usr/local/src/
wget http://lnamp-shell.googlecode.com/files/eaccelerator-0.9.6.tar.bz2
tar -jxvf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6
phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/bin/php-config
make -j8
make install
ldconfig
echo '#Setting php eaccelerator
extension="eaccelerator.so"
eaccelerator.shm_size="0"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"' >> /etc/php.ini
mkdir -p /var/cache/eaccelerator
chmod -R 777 /var/cache/eaccelerator
sed -i 's|#RSAAuthentication|RSAAuthentication|g' /etc/ssh/sshd_config
sed -i 's|#PubkeyAuthentication|PubkeyAuthentication|g' /etc/ssh/sshd_config
sed -i 's|#AuthorizedKeysFile|AuthorizedKeysFile|g' /etc/ssh/sshd_config
/etc/init.d/sshd restart
sed -i 's|extension_dir = "./"|extension_dir = "/usr/local/lib/php/20060613/"|g' /etc/php.ini
#sed -i 's|extension_dir = "/usr/local/lib/php/20060613/"|extension_dir = "/usr/lib/php/modules"|g' /etc/php.ini
sed -i ':a;N;$!ba;s|#AddOutputFilter INCLUDES .shtml|#AddOutputFilter INCLUDES .shtml\n AddHandler php5-script .php\n AddType text/html .php|g' /opt/httpd/conf/httpd.conf
sed -i ':a;N;$!ba;s|DirectoryIndex index.html|DirectoryIndex index.html index.php|g' /opt/httpd/conf/httpd.conf
echo '<?php
phpinfo();' > /opt/httpd/htdocs/info.php
rpm -qa | grep ImageMagick | xargs rpm -e --allmatches
yum -y install postfix dovecot
echo -e '2' | alternatives --config mta
sed -i 's/HOSTNAME=/#HOSTNAME=/g' /etc/sysconfig/network
echo '
#Setting hostname
myhostname = mail4.urcosme.com
#Setting trusted domain
mynetworks = 127.0.0.0/8, 211.78.82.0/24, 61.62.79.127/32' >> /etc/postfix/main.cf
sed -i 's/#inet_interfaces = all/inet_interfaces = all/g' /etc/postfix/main.cf
sed -i 's/inet_interfaces = localhost/#inet_interfaces = localhost/g' /etc/postfix/main.cf
sed -i 's/#myorigin = $myhostname/myorigin = $myhostname/g' /etc/postfix/main.cf
sed -i 's/mydestination = $myhostname, localhost.$mydomain, localhost/mydestination = $myhostname, localhost.$mydomain, localhost,mail4.urcosme.com/g' /etc/postfix/main.cf
service sendmail stop
service postfix stop
service postfix start
apachectl -k start
mkdir /var/www
#s3fs build part
cd /usr/local/src/
wget http://www.kernel.org/pub/linux/utils/util-linux/v2.21/util-linux-2.21.2.tar.gz
tar -zxvf util-linux-2.21.2.tar.gz
cd util-linux-2.21.2
./configure
make
make install
cd /usr/local/src/
#wget "http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.1/fuse-2.9.1.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffuse%2Ffiles%2Ffuse-2.X%2F2.9.1%2F&ts=1346747354&use_mirror=nchc" -O fuse-2.9.1.tar.gz
wget http://nchc.dl.sourceforge.net/project/fuse/fuse-2.X/2.9.1/fuse-2.9.1.tar.gz
tar -zxvf fuse-2.9.1.tar.gz
cd fuse-2.9.1
./configure --prefix=/usr
make -j8
make install
cd /usr/local/src/
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
tar -zxvf s3fs-1.61.tar.gz
cd s3fs-1.61
./configure --prefix=/usr
make -j8
make install
#end if build s3fs
#mount -t ext3 /dev/sdf /var/www
#mkdir -p /opt/httpd/logs/httpd_memcachedphp_itrue/
#mkdir -p /opt/httpd/logs/httpd_womac/
#mkdir -p /opt/httpd/logs/httpd_kp_itrue/
#mkdir -p /opt/httpd/logs/httpd_itrue_buzz/
#mkdir -p /opt/httpd/logs/httpd_itrue/
#mkdir -p /opt/httpd/logs/httpd_urclick_urcosme/
#mkdir -p /opt/httpd/logs/httpd_oneclick_urcosme/
#mkdir -p /opt/httpd/logs/httpd_brand_urcosme/
#mkdir -p /opt/httpd/logs/httpd_buzz_urcosme/
#mkdir -p /opt/httpd/logs/httpd_mobile_urcosme/
#mkdir -p /opt/httpd/logs/httpd_labs_urcosme/
#mkdir -p /opt/httpd/logs/httpd_urwawa/
#mkdir -p /opt/httpd/logs/httpd_urcosme/
#mkdir -p /opt/httpd/logs/httpd_marsz_utf8/
#mkdir -p /opt/httpd/logs/httpd_openitruecomtw/
#mkdir -p /opt/httpd/logs/httpd_urcosme_img2/
#mkdir -p /opt/httpd/logs/httpd_blog_urstyle/
#mkdir -p /opt/httpd/logs/httpd_urstyle/
#sed -i 's|/usr/local/sbin/cronolog|/usr/sbin/cronolog|g' /opt/httpd/conf/httpd.conf
#sed -i 's|/usr/lib/php/modules|/usr/local/lib/php/20060613/|g' /etc/php.ini
#sed -i 's|192.168.0.10|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/itrue/include/db_config/*.php
#sed -i 's|192.168.0.2|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/itrue/include/Jersus/JersusFramework.abstract.php
#sed -i 's|192.168.0.2|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/itrue/include/Jersus/class/Cache/Memcached.class.php
#sed -i 's|192.168.0.2|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/urstyle/urcosme/include/MarsZ/class/UrCosme/UrCosme.class.php
#sed -i 's|192.168.0.9|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/itrue/include/Jersus/JersusFramework.abstract.php
#sed -i 's|192.168.0.9|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/itrue/include/Jersus/class/Cache/Memcached.class.php
#sed -i 's|192.168.0.9|urcosme-test.lwvhxq.0001.apse1.cache.amazonaws.com|g' /var/www/html/urstyle/urcosme/include/MarsZ/class/UrCosme/UrCosme.class.php
# copy php config
# copy php httpd config
# copy pear to /usr/local/share/pear/
# reconfigure pear path in php.ini
#useradd apache
cd /usr/local/src/
wget http://pear.php.net/go-pear.phar
php /usr/local/src/go-pear.phar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment