Installing Labs 3 on Linux with command line interface

From alfrescowiki

Jump to: navigation, search

Contents

Introduction

These instructions worked for me on an install for CentOS 5.2 running on VMWare Server 2.0. My CentOS install had little to no packages installed. I tried to make this as generic as possible so it should work on other distributions. Sorry for the references to yum.

Install JAVA

Before you install Alfresco Labs 3b, ensure that you have JDK 5 or 6 installed on your machine.

Install JDK 1.6

First we need to go to Sun and get the Java files:

http://java.sun.com/javase/downloads/index.jsp[1]

Select Download for JDK 6 Update 6

Select Linux from the Platform drop down list.

Select Agree if you decide too.

Select Continue.

Download this file jdk-6u6-linux-i586-rpm.bin

[root@localhost alfresco]# chmod +x jdk-6u6-linux-i586-rpm.bin
[root@localhost alfresco]# ./jdk-6u6-linux-i586-rpm.bin

You will have to agree to a few things, but it self installs.

[root@localhost alfresco]# rpm –Uvh java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm

To make sure your system is configured to use this latest version of Java by default, run the command:

[root@localhost alfresco]# alternatives --config java

You should see that there are two programs that provide Java.

   Selection    Command
 
    1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
 *+ 2           /usr/lib/jvm/jre-1.6.0-sun/bin/java

If number 2 has the *+ next to it, you should be fine. There is no need to do anything, just press Enter. If, for some reason, 1 is selected, then type 2 and press Enter.

As a final Java configuration test, you can run:

[root@localhost alfresco]# rpm -qa | grep java

Check to see that java-1.6.0-sun-compat-1.6.0.06-1jpp is listed

[root@localhost alfresco]#rpm -qa | grep java
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
sun-javadb-demo-10.3.1-4.1
java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.112
sun-javadb-common-10.3.1-4.1
sun-javadb-docs-10.3.1-4.1
gcc-java-4.1.2-14.el5
sun-javadb-core-10.3.1-4.1
sun-javadb-javadoc-10.3.1-4.1
sun-javadb-client-10.3.1-4.1
java-1.6.0-sun-compat-1.6.0.06-1jpp

Install Alfresco Labs 3b

64 bits setup

If you are running a x64 kernel, you should consider installing the "ia32-libs" package in order to run the Alfresco installer in console mode.

apt-get install ia32-libs

If not, the installer will simply not run without returning any error. (Tested with lenny x64 under OpenVZ)

Then follow the general setup instructions.

General setup

  1. Ensure you have downloaded Alfresco-Labs-3b-Linux-x86-Install.

Now make it an executable file.

chmod 777 Alfresco-Labs-3b-Linux-x86-Install.
  1. Run Alfresco-Labs-3b-Linux-x86-Install.
./Alfresco-Labs-3b-Linux-x86-Install
  1. The installer will ask you if you want to install Alfresco [n/Y]
  2. The installer will ask you where you want to install Alfresco. The default is /opt/Alfresco.

For example:

[root@alfresco tmp]# ./Alfresco-Labs-3b-Linux-x86-Install
This will install Alfresco Labs on your computer.  Continue? [n/Y]
Where do you want to install Alfresco Labs? [/opt/Alfresco]
Installing Alfresco Labs...
Installing Program Files...
Installing Program Files Linux...
Installing Samples...
Installing WCM...
Installing WCM Linux...
Installation complete.
[root@alfresco tmp]#

Now change a few variables in the /opt/Alfresco/alfresco.sh file:

  1. Change ALF_HOME=@@ALF_HOME@@ to ALF_HOME=/opt/Alfresco or where ever you installed Alfresco.
  2. Change export JAVA_HOME="@@JAVA_HOME@@" to export JAVA_HOME=/usr/java/jdk1.6.0_06/ or where ever you put the Java files.
#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
ALF_HOME=/opt/Alfresco
cd "$ALF_HOME"
APPSERVER="${ALF_HOME}/tomcat"
export JAVA_HOME=/usr/java/jdk1.6.0_06/
......

The installation is complete.

Start Alfresco, you might have to to give tomcat a minute to start up.

/opt/Alfresco/alfresco.sh start

The website can be found at

http://HOSTNAME:8080/share

Login as:

user: admin
pass: admin


If you wish to use the Website Preview feature, you will need to start the Alfresco Virtualization server:

vi /opt/Alfresco/virtual_alf.sh
  1. Change ALF_HOME=@@ALF_HOME@@ to ALF_HOME=/opt/Alfresco or where ever you installed Alfresco.
  2. Change export JAVA_HOME="@@JAVA_HOME@@" to export JAVA_HOME=/usr/java/jdk1.6.0_06/ or where ever you put the Java files.
#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
ALF_HOME=/opt/Alfresco
cd "$ALF_HOME"
APPSERVER="$ALF_HOME"/virtual-tomcat
export JAVA_HOME=/usr/java/jdk1.6.0_06/
.........

Start Alfresco

sh virtual_alf.sh start

Then the website can found at:

http://HOSTNAME:8080/alfresco/

Login into Alfresco

Login as:

user: admin
pass: admin


For SMB access try:

\\HOST_IP_ADDRESS\alfresco

Login as:

user: admin
pass: admin

For FTP access try:

ftp HOST_IP_ADDRESS

Login as:

user: admin
pass: admin

Change HSQL Database to MySQL Database

Install mysql from packages:

yum install mysql-server

Start mysql

/etc/init.d/mysqld start

Test mysql is running:

mysql -u root -p

Add Alfresco user etc to mysql

mysql < /opt/Alfresco/extras/databases/mysql/db_setup.sql\

See if the database is there:

#mysql
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| alfresco           |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> quit


Browse to the tomcat\shared\classes\alfresco\extension\ directory. Locate and open the following two files:

  • custom-hibernate-dialect.properties
  • custom-repository.properties
vi custom-repository.properties

Change the dir.root to the absolute path of the data folder:

# Sample custom content and index data location
#
dir.root=/opt/Alfresco/alf_data


Add comments to HSQL connection options Remove comments from MySQL connection options So it looks like below:

.....
# Derby connection
#
#db.driver=org.apache.derby.jdbc.EmbeddedDriver
#db.url=jdbc:derby:alf_data/derby_data/alfresco;create=true
#
# HSQL connection
#
#db.driver=org.hsqldb.jdbcDriver
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;
#
# MySQL connection (This is default and requires mysql-connector-java-5.0.3-bin.jar, which ships with the Alfresco server)
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco
......

We need to change one more file:

vi custom-hibernate-dialect.properties
.......
#
# Derby dialect
#
#hibernate.dialect=org.hibernate.dialect.DerbyDialect
#
# HSQL dialect
#
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
#
# MySQL dialect (default)
#
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
#
# PostgreSQL dialect
#
......

Remove extra data from the alf_data directory.

DON'T DO THIS IF YOU HAVE DATA IN YOUR ALFRESCO INSTALL!!!!

rm -rf /opt/Alfresco/alf_data/*

Ok to restart Alfresco

./alfresco.sh stop
./virtual_alf.sh stop
./alfresco.sh start
./virtual_alf.sh start


Adding Docasu to Alfresco 3.0b Lab

This adds a nice interface. http://docasu.sourceforge.net/

Stop alfresco:

/opt/alfresco/alfresco.sh stop

Get the Docasu amp file: (Check to see if there is a new version) http://forge.alfresco.com/projects/docasu/

cd /tmp
wget http://downloads.sourceforge.net/docasu/docasu-1.4.1-alfresco-3.amp
mv /opt/alfresco/tomcat/webapps/alfresco ./
java -jar /opt/alfresco/bin/alfresco-mmt.jar install /tmp/docasu-1.4.1-alfresco-3.amp /opt/alfresco/tomcat/webapps/alfresco.war -force

Start Alfresco:

/opt/alfresco/alfresco.sh start

Go to Docasu web interface:

http://[SERVER]:8080/alfresco/wcs/docasu/ui

A Concise Install on Ubuntu 8.x Using MySQL

The following Bash script will install dependencies, download Alfresco, install it, and alter the configuration for MySQL. You may need to alter /etc/apt/sources.list in Hardy. Cut and paste the following code into a file called alfresco-install.sh

#!/bin/bash
#
# Installs and configures Alfresco Labs 3.0 on Ubuntu
# 2009/04/01 Gregory Buchenberger
#

##Install dependencies using Apt
apt-get -y update
apt-get -y install openoffice.org-headless \
openoffice.org-writer \
openoffice.org-calc \
openoffice.org-impress \
openoffice.org-java-common \
imagemagick \
libjpeg62-dev \
libfreetype6-dev \
build-essential \
linux-headers-$(uname -r) \
zlib1g-dev \
sun-java6-jdk

##Build SWF Tools
cd /tmp
wget http://www.swftools.org/swftools-2009-02-16-1757.tar.gz
tar -xvf swftools-2009-02-16-1757.tar.gz
cd swftools-2009-02-16-1757
./configure
make 
make install
cd /tmp
rm swftools-2009-02-16-1757.tar.gz
rm -rf swftools-2009-02-16-1757

##Create MySQL Database
mysql -u root -e 'create database alfresco;
grant all on alfresco.* to "alfresco"@"localhost" identified by "alfresco" with grant option;
grant all on alfresco.* to "alfresco"@"localhost.localdomain" identified by "alfresco" with grant option;'

##Install Alfresco
mkdir /opt/alfresco
cd /opt/alfresco
wget http://downloads.sourceforge.net/alfresco/alfresco-labs-tomcat-3Stable.tar.gz
tar -xvf alfresco-labs-tomcat-3Stable.tar.gz
rm alfresco-labs-tomcat-3Stable.tar.gz
mkdir -p /var/alfresco/alf_data

##Install MySQL
cd /opt/alfresco/tomcat/lib/
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.7.tar.gz/from/http://mirror.sourceshare.org/mysql/
tar -xvf mysql-connector-java-5.1.7.tar.gz
cp ./mysql-connector-java-5.1.7/mysql-connector-java-5.1.7-bin.jar ./
rm -rf ./mysql-connector-java-5.1.7
rm mysql-connector-java-5.1.7.tar.gz

##Create Alfresco initiation script at /etc/init.d/alfresco
echo '#! /bin/bash
#
# alfresco      This shell script takes care of starting and stopping Alfresco
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: alfresco
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Alfresco Labs 3.0
# Short-Description: start and stop Alfresco
### END INIT INFO
#

NAME="$(basename $0)"
unset ISBOOT
if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then
    NAME="${NAME:3}"
    ISBOOT="1"
fi

# Path to alfresco root dir
_ALFRESCO="/opt/alfresco"

# Path to the alfresco launch script
_SCRIPT="${_ALFRESCO}/alfresco.sh"

# Alfresco program name
_PROG="$NAME"

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:/usr/bin
echo $PATH
SHUTDOWN_WAIT=30

RETVAL="0"

function checkpid() {
    local i
    for i in $* ; do
        if [ -d "/proc/${i}" ]; then
            return 0
        fi
    done
    return 1
}

function echo_failure() {
    echo -en "\\033[60G"
    echo -n "[  "
    echo -n $"FAILED"
    echo -n "  ]"
    echo -ne "\r"
    return 1
}

function echo_success() {
    echo -en "\\033[60G"
    echo -n "[  "
    echo -n $"OK"
    echo -n "  ]"
    echo -ne "\r"
    return 0
}

function getIP() {
	ipaddr=""

    inet=$(ip addr show dev eth0 | grep "inet")

	if [ "$inet" != "" ]; then 
    		set -- $inet
    		shift
		
		echo ${1%%/*} | grep -E \([0-9]\{1,3\}.\{3\}\)[0-9]\{1,3\} > /dev/null

		if [ $? -ne 1 ]; then
    			ipaddr=$(echo ${1%%/*} | sed -e s/[.]/-/g)
		fi
	fi

	if [ $ipaddr = "" ]; then
		return -1
	fi
}

function updateVirtDomain() {
	virt_server=${_ALFRESCO}/virtual-tomcat/conf/alfresco-virtserver.properties
	virt_server_property=alfresco.virtserver.domain
	
	if [ -e $virt_server ]; then
		grep -E ^alfresco\.virtserver\.domain=\([0-9]\{1,3\}-\)\{3\}[0-9]\{1,3\} $virt_server
		if [ $? -eq 0 ]; then
			sed -i -r -e s/^${virt_server_property}=\([0-9]\{1,3\}-\)\{3\}[0-9]\{1,3\}/${virt_server_property}=${ipaddr}/ \
			$virt_server
		else
			sed -i -r -e s/^${virt_server_property}=/${virt_server_property}=${ipaddr}/ \
			$virt_server
		fi
	fi
}

# See how we were called.
function start() {
    echo -n "Starting ${_PROG}: "
        if [ -f "/var/run/${NAME}.pid" ]; then
            read kpid < /var/run/${NAME}.pid
                if checkpid $kpid 2>&1; then
                    echo "$NAME process already running"
                        return -1
                    else
                        echo "lock file found but no process running for"
                        echo "pid $kpid, continuing"
                fi
        fi
    
	###Insert start script here###
	getIP
	if [ $? -ne -1 ]; then
		updateVirtDomain
	else
		echo_failure
		exit
	fi	
	$_SCRIPT start

    RETVAL="$?"
    if [ "$RETVAL" -eq 0 ]; then 
	sleep 3
	pidof -s java > /var/run/${NAME}.pid
        echo_success
    else
        echo_failure
    fi
    echo
    return $RETVAL
}

function status() {
    RETVAL="1"
    if [ -f "/var/run/${NAME}.pid" ]; then
        read kpid < /var/run/${NAME}.pid
        if checkpid $kpid 2>&1; then
            echo "$0 is already running (${kpid})"
            RETVAL="0"
        else
            echo "lock file found but no process running for pid $kpid"
        fi
    else
        pid="$(pgrep -u root java)"
        if [ -n "$pid" ]; then
            echo "$0 running (${pid}) but no PID file exists"
            RETVAL="0"
        else
            echo "$0 is stopped"
        fi
    fi
    return $RETVAL
}

function stop() {
    local STOP_VERBOSE="false"
    echo -n "Stopping $_PROG: "
        
	###Insert Stop script here###
	$_SCRIPT stop

	RETVAL="$?"
        if [ "$RETVAL" -eq "0" ]; then
            count="0"
            if [ -f "/var/run/${NAME}.pid" ]; then
                read kpid < /var/run/${NAME}.pid
                until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \
                      [ "$count" -gt "$SHUTDOWN_WAIT" ]; do
                    if [ "$STOP_VERBOSE" = "true" ]; then
                        echo -n -e "\nwaiting for processes $kpid to exit"
                    fi
                    sleep 1
                    let count="${count}+1"
                done
                if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
                    if [ "$STOP_VERBOSE" = "true" ]; then
                        echo -n -e "\nkilling processes which did not stop"
                        echo -n -e "after "
                        echo -n "$SHUTDOWN_WAIT seconds"
                    fi
                    kill -9 $kpid
                fi
                echo_success
                if [ "$count" -gt "0" ]; then
                    echo -n -e "\n"
                fi
            fi
	    rm -f /var/run/${NAME}.pid
	else
		echo_failure
	fi	
}


# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        sleep 2    
        start
        ;;
    status)
        status
        ;;
    *)
        echo "Usage: $_PROG {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL' > /etc/init.d/alfresco

chmod +x /etc/init.d/alfresco
update-rc.d -f alfresco start 99 2 3 4 5 .
update-rc.d -f alfresco stop 90 0 6 .

##Create Alfresco launch script at /opt/alfresco/alfresco.sh
echo '#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
ALF_HOME=/opt/alfresco
APPSERVER="${ALF_HOME}/tomcat"
# Set any default JVM values
export JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=128m -server"
if [ "$1" = "start" ]; then
  "${APPSERVER}/bin/startup.sh"
elif [ "$1" = "stop" ]; then
  "${APPSERVER}/bin/shutdown.sh"
fi' > /opt/alfresco/alfresco.sh
chmod +x /opt/alfresco/alfresco.sh


##Configure custom repository properties
echo 'swf.exe=/usr/local/bin/pdf2swf
ooo.exe=/usr/lib/openoffice/program/soffice
img.root=/usr
dir.root=/var/alfresco/alf_data
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco' > /opt/alfresco/tomcat/shared/classes/alfresco/extension/custom-repository.properties


##Configure custom hibernate dialect properties
echo 'hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect' > /opt/alfresco/tomcat/shared/classes/alfresco/extension/custom-hibernate-dialect.properties

##Install SharePoint protocol support
wget http://downloads.sourceforge.net/alfresco/alfresco-mmt-3Stable.jar
wget http://downloads.sourceforge.net/alfresco/vti-module.amp
java -jar alfresco-mmt-3Stable.jar install vti-module.amp /opt/alfresco/tomcat/webapps/alfresco.war
rm alfresco-mmt-3Stable.jar
rm vti-module.amp

Use some method (scp, ftp, samba, cd, usb) to get the file to your home folder on the server and make the script executable like so:

chmod +x alfresco-install.sh

Execute the script as root:

sudo ./alfresco-install.sh
Personal tools
Download and go
© 2012 Alfresco Software, Inc. All Rights Reserved. Legal | Privacy | Accessibility