Release Management/Configuring New Amazon Instance
Contents |
Introduction
This wiki is to help configuring a new amazon instance and in this wiki I have taken example of builds.openbravo.com on gentoo system.
Process
To start with one should know the pre-requisites for any process. In this case they would be the packages required to set up the base system and configurations need to be copied from the old system (if any).
Installation & Configuration
System Initialization
- Set Environment
env-update source /etc/profile export PS1="(<hostname>) $PS1"
- Set password of root user
passwd
- Set timezone
cp /usr/share/zoneinfo/Europe/Madrid /etc/localtime nano /etc/conf.d/clock CLOCK="UTC" TIMEZONE="Europe/Madrid" CLOCK_SYSTOHC="yes"
- Set locale
nano /etc/locale.gen en_US.UTF-8 UTF-8 nano /etc/env.d/02locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=en_US.UTF-8 nano /etc/make.conf CFLAGS="-O2 -pipe -march=i686 -mno-tls-direct-seg-refs" CXXFLAGS="${CFLAGS}" CHOST="i686-pc-linux-gnu" MAKEOPTS="-j2" USE="-ipv6 -gdbm -acl apache2 ldap vhosts" GENTOO_MIRRORS="http://ftp.heanet.ie/pub/gentoo/ " SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
- Build base system
emerge --sync emerge -auDvN world emerge -av syslog-ng emerge -av vixie-cron
- Add services to start at bootup
rc-update add vixie-cron default rc-update add syslog-ng default
- Edit /etc/dispatch-conf.conf and change diff with colordiff (only as value)
nano /etc/dispatch-conf.conf
- Run dispatch-conf and select some options as "u" to take the new one. "z" to ignore it, but be carefull and read what it means.
dispatch-conf
- Update /etc/conf.d/hostname and /etc/hosts
Building system specific packages
As these are system specific I took packages required for builds.openbravo.com.
- Emerge required packages
Porstgres
emerge -av emerge -av postgresql-server:8.3 emerge -av emerge -av postgresql-server:8.2 emerge --config postgresql-server:8.3 emerge --config postgresql-server:8.2 /etc/init.d/postgresql-8.3 start /etc/init.d/postgresql-8.2 start rc-update add postgresql-8.3 default rc-update add postgresql-8.2 default * Note before restarting edit /var/lib/postgresql/8.2/data/postgresql.conf file to listen to port 5433
psql -U postgres -p 5432 alter role postgres with password 'new_password'; \q sed -i 's/trust$/md5/' /var/lib/postgresql/8.3/data/pg_hba.conf /etc/init.d/postgresql-8.3 reload
psql -U postgres -p 5433 alter role postgres with password 'new_password'; \q sed -i 's/trust$/md5/' /var/lib/postgresql/8.2/data/pg_hba.conf /etc/init.d/postgresql-8.2 reload
Sun JDK
emerge -av sun-jdk java-config -S sun-jdk-1.6
Tomcat
emerge -av tomcat
touch /etc/env.d/99tomcat echo 'CATALINA_HOME=/usr/share/tomcat-6' >> /etc/env.d/99tomcat echo 'CATALINA_BASE=/var/lib/tomcat-6' >> /etc/env.d/99tomcat
env-update && source /etc/profile CATALINA_OPTS="-server -Xms384M -Xmx1024M -XX:MaxPermSize=256M" mkdir /var/lib/tomcat-6/lib/ cp $JAVA_HOME/lib/tools.jar /var/lib/tomcat-6/lib/
- Edit /etc/tomcat-6/context.xml to comment this line
<WatchedResource>WEB-INF/web.xml</WatchedResource>
- Edit /var/lib/tomcat-6/conf/tomcat-users.xml to look like this
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user username="admin" password="admin" roles="admin,manager"/> </tomcat-users>
/etc/init.d/tomcat-6 restart
ANT
emerge -av dev-java/ant-core echo 'ANT_OPTS="-Xmx1024M"' > /etc/env.d/99ant env-update && source /etc/profile
Mercurial
emerge -av mercurial
Mod_JK
emerge -av www-apache/mod_jk
- Edit /etc/apache2/modules.d/88_mod_jk.conf file to redirect any incoming connection to tomcat
# Pass on mount optionsl globally to all vhosts/contexts JkMountCopy all JkUnMount /japi* ajp13 JkUnMount /pos* ajp13 JkMount /* ajp13