cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic (kickstart) install script

sakkaje
Champ in-the-making
Champ in-the-making
Hi,

I have tried now in between 100 or 200 times to install Alfresco on a virtual CentOS server. So far without a good result. Puzzling for me is the installer is working fine on the CentOS 6 platform: download the .bin file execute it and done! However, call me old fashioned, i want to deploy Alfresco on Tomcat myself using the .zip install.

I have read all the CentOS documents in the wiki and all are not very useful and quite old actually. I suggest they should be removed because they are a waste of time and frustrating for new users. I mean, nobody uses CentOS 4 anymore or Tomcat 5. On the internet outside the wiki there are some blogs with more up to date information, but they are the typical blog-style install documents: a sum up of things you need to install and the blogger probably passes on work from somebody else. I can conclude that by far the best work i found on the web on installing a headless and gui-less Alfresco is located here: http://code.google.com/p/alfresco-ubuntu-qs/source/browse/trunk/install.sh

Yes, a script. At least there is one person, Will Abson, who seems to really know what it takes to install Alfesco. It is really great work he did, the script looks exceptional. For me unfortunately it has two challenges. First it is for Ubuntu (who still wants to use Ubuntu in 2011?) and second it requires user interaction. So i started to use Will's script as inspiration for my own script that installs Alfresco without user interaction in a so-called kickstart file (see below). This file will create a new virtual server, installs the necessary packages, downloads Alfresco, edits the configuration files, creates the MySQL database and finally reboots. Alfresco is then available at port 8080.

On a side note, my feeling is, maybe Alfresco is a bit picky about versions of software you use. Connector/J: 5.1.18, Tomcat 7.0.22 and 6.0.33 (share the same problems) and Oracle's MySQL 5.1.47 and JDK6. Are there issues know on these versions if any?

Here is the script (i remove the openoffice and swf parts and if yo want to run it you must provide your own source server, mine is behind the firewall). Can anyone see what is wrong with it? Apart from copying a bunch of .sample files it seems pretty identical to me compared to what the .bin installer does or what Will's script does.

install
reboot
lang en_US.UTF-8
keyboard us
skipx
%include /tmp/network-with-hostname.sh
rootpw linux
firewall –disabled
selinux –disabled
authconfig –enableshadow –enablemd5
timezone –isUtc Asia/Shanghai
bootloader –location=mbr
services –enabled=mysqld
bootloader –location=mbr
clearpart –all –initlabel
part swap –size=500 –ondisk=vda
part / –fstype ext4 –grow –size=100 –ondisk=vda

%packages –excludedocs –instLangs=en
@core
-mdadm
curl
wget
gcc
make
openoffice.org-headless

ImageMagick

mysql-server
mysql

#swftools dependencies
gcc-c++
zlib-devel
libjpeg-devel
giflib-devel
freetype-devel
%end

%pre
#!/bin/sh
wget -O - http://office:90/flexshare/os/common/remove-firmware.sh | bash
wget -O - http://office:90/flexshare/os/common/set-hostname.sh | bash
%end

%post –log=/root/post.log
#!/bin/sh
export ALFRESCO=alfresco-community-4.0.a
service network restart
chkconfig crond off
chkconfig atd off

wget -O - http://office:90/flexshare/os/components/java/install.sh | bash
wget -O - http://office:90/flexshare/os/components/tomcat/install.sh | bash
. /etc/profile.d/tomcat.sh
echo "JAVA_OPTS=\"-Xms128m -Xmx1024m -Xss96k -XX:MaxPermSize=160m -Dalfresco.home=$CATALINA_HOME -Dcom.sun.management.jmxremote\"" >> /etc/profile.d/tomcat.sh
echo "TOMCAT6_SECURITY=no" >> /etc/profile.d/tomcat.sh

echo "setup mysql"
sed -i 's/\[mysqld\]/&\
default-storage-engine=InnoDB/' /etc/my.cnf
sed -i 's/\[mysqld\]/&\
default-character-set=utf8/' /etc/my.cnf
service mysqld restart
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS alfresco;"
mysql -uroot -e "GRANT ALL PRIVILEGES ON alfresco.* TO alfresco@localhost IDENTIFIED BY 'alfresco';"
#TODO weird: but this seems necessary
mysqladmin -uroot password alfresco

echo "downloading alfresco"
mkdir /root/alfresco-down
cd /root/alfresco-down
wget -q http://office:90/flexshare/os/alfresco/$ALFRESCO.zip
unzip -q $ALFRESCO.zip

echo "copying and unpacking the wars"
cp /root/alfresco-down/web-server/webapps/*.war $CATALINA_HOME/webapps
cd $CATALINA_HOME/webapps
unzip -q share.war -d share
unzip -q alfresco.war -d alfresco
#TODO i don't think we need the war archives anymore, so delete them
#rm -f *.war

echo "copying alfresco files to $CATALINA_HOME"
cp /root/alfresco-down/bin/* $CATALINA_HOME/bin
rm -rf /root/alfresco-down

echo "config alfresco web apps"
mkdir -p $CATALINA_HOME/shared/classes
cd $CATALINA_HOME/shared/classes
wget -q http://office:90/flexshare/os/alfresco/alfresco-global.properties
cd $CATALINA_HOME/lib
wget -q http://office:90/flexshare/os/alfresco/mysql-connector-java-5.1.18-bin.jar
sed -i 's/shared.loader=/shared.loader=${catalina.home}\/shared\/classes/g' $CATALINA_HOME/conf/catalina.properties

chown -R tomcat.tomcat $CATALINA_HOME

mkdir -p /var/alfresco/alf_data
chown -R tomcat.tomcat /var/alfresco

#default logging traps into a permission problem, set the path
sed -i 's/alfresco.log/${catalina.home}\/logs\/alfresco-share.log/g' $CATALINA_HOME/webapps/share/WEB-INF/classes/log4j.properties
sed -i 's/alfresco.log/${catalina.home}\/logs\/alfresco-alfresco.log/g' $CATALINA_HOME/webapps/alfresco/WEB-INF/classes/log4j.properties
%end

I think the mayor problem is memory related. There are loads of these messages:

15:47:27,046 WARN  [org.alfresco.util.AbstractTriggerBean] Job ehCacheTracerJob is not active/enabled
15:47:36,402 ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroy method on bean with name 'replicationParams' threw an exception
java.lang.OutOfMemoryError: PermGen space
        at java.lang.Class.getDeclaredConstructors0(Native Method)

When both share and alfresco are deployed it can happen Tomcat will crash on startup. However this forum tells me to ignore them and i have tried several JAVA_OPTS but it did not resolve. The other often recurring issue are the database connections.

16:06:25,327  WARN  [hibernate.cfg.SettingsFactory] Could not obtain connection metadata
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)

No idea what that means, the alfresco DB should be accessible. And sometimes it manages create the tables in the DB, but mostly it fails.
2 REPLIES 2

darryl_staflund
Champ in-the-making
Champ in-the-making
H there,

If you haven't done so already, try running the Alfresco Environmental Validation Tool that can be found on Google Code at http://code.google.com/p/alfresco-environment-validation/.  It might alert you to problems with your configuration or environment.  And if you have an Alfresco subscription, check out the Zero Day Configuration Guide at http://support.alfresco.com/ics/support/default.asp?deptID=15026.

Hope it helps,
Darryl

mrogers
Star Contributor
Star Contributor
You need to increase the permgen memory (-XX:MaxPermSize=200M).   I can't see that in your script.

And a second point, as and when you find the wiki is incomplete or out of date then please go ahead and correct it, that way it gets better Smiley Happy