Howto install Alfresco audit analysis and reporting patch from v1.0 to v1.1
In this post I would like to describe howto install the Alfresco audit analysis and reporting patch from v1.0 to v1.1 after the release announced in this post.
In this post I would like to describe howto install the Alfresco audit analysis and reporting patch from v1.0 to v1.1 after the release announced in this post.
Thanking to the contribution of some users with interesting practical cases, a new version 1.1 of the A.A.A.R. – Alfresco audit analisys and reporting has been released.
Here some useful links for the interested of you.
As soon as possible, a post with the instructions to upgrade the v1.0 to the latest v1.1.
In this post is shared the installation of Liferay 6.1.1 Community Edition GA2 IDE on Ubuntu 12.04 LTS 64bit with Apache Tomcat Application Server 7.0.32 and PostgreSQL 8.4.15. The post is based on the installation tutorial described in the ‘Step by step installation of Liferay 6.1.1 CE GA2 on Ubuntu 12.04 LTS 64bit and Tomcat 7… no bundle please!‘ and supposes you have the same environment installed and working in your system.
As we like and prefer, the installation is a step by step list of commands and tasks… simpler to understand, to do and to test. Hope you’ll be agree.
In this paragraph are collected the used sources for the installation. I suggest to download and store them in a safe repository for future purposes (re-installation, maintainance, etc.).
Connect to the server (or the virtual machine like in our case) as ‘liferay’ user. We discourage the use of the root user for security reasons.
cd /home/liferay/Desktop/ cp /mnt/.../eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz . tar zxvf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz rm -rf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz
/home/liferay/Desktop/eclipse/eclipse &
To have a professional version control of your source code you need a CVS, SVN, Git (or similar) module installed on Eclipse. Here we prefer EGit Eclipse that you can install as described below.
Liferay IDE, like all the Liferay suite, it’s very well documented here. Liferay IDE installation is documented here and it’s described below.
Liferay SDK installation
service liferay stop.
chown -R liferay:liferay /opt/liferay-plugins-sdk-6.1.1
Liferay JavaDoc and Source installation
Now you are ready to develop your first portlet.
In the Alfresco wiki is described the backup and restore strategy but is not so clear how to do it in detail. In this post is shared a practical way to perform a restore of a backuped Alfresco in the way I like: a list of commands and tasks to execute… simpler to understand, to do and to test.
In this example is supposed that Alfresco is installed in ‘/opt/alfresco’ folder and the DBMS used is PostgreSQL. The restore strategy supposes that the backup is done as a “cold backup” described in this ‘Alfresco backup script‘ post.
Let’s start…
First of all proceed to stop alfresco.
service alfresco stop
Supposing the DBMS runs using the ‘postgres’ user, proceed as first task to restore the PostgreSQL database.
su - postgres psql DROP DATABASE alfresco; CREATE DATABASE alfresco WITH OWNER alfresco;
Digit CTRL+d to exit from the shell.
psql -U alfresco -d alfresco ALTER USER alfresco WITH PASSWORD 'alfresco';
Digit CTRL+d to exit from the shell. Supposing the DBMS backup is stored in the ‘alfresco_postgres.tar’ file conforming to the backup strategy described here, let’s go ahead with the restoring of the database.
pg_restore -d alfresco alfresco_postgres.tar exit
Now it’s time to restore the ‘alf_data’ folder with documents and indexes. Also in this case is supposed that the files are stored in a ‘alfresco_data.tgz’ file conforming to the backup strategy described here.
cd /opt/alfresco mv alf_data alf_data.old tar zxvf alfresco_data.tgz
That’s all!
Now it’s time to start again Alfresco and use it normally.
service alfresco start
In the Alfresco wiki is described the backup and restore strategy but is not so clear how is defined a script and how to do it more exactly. To be more precise the backup strategy could be a “cold backup” or a “hot backup”. In this post is shared a practical way to perform a “cold backup” in the way I like: a list of commands and tasks to execute… simpler to understand, to do and to test.
In this example is supposed that Alfresco is installed in ‘/opt/alfresco’ folder and the DBMS used is PostgreSQL. The script is developed to have a 10 days backup history. If in your case is requested more or less than 10 days you can simply modify the ‘NUM_DUMP’ variable.
Let’s start…
cd /opt/alfresco nano alfrescoBackup.sh
.
# # Cold backup of Alfresco. # # Configuration. ALF_HOME="/opt/alfresco" NUM_DUMP=10 ALF_DATA_SUBDIR="alf_data" DB_HOME="/opt/postgresql" DB_TYPE="postgresql" # Check if [ -d "$1" ]; then TARGET_FOLDER="$1" CURRENT_FOLDER="$(pwd)" TIMESTAMP="$(date +%F_%H-%M)" CHECK=1 # 1) Alfresco stop. service alfresco stop # 2) Backup of the database of Alfresco with vendor service. DB_DUMP=${TIMESTAMP}_alfresco_${DB_TYPE}.tar if [ "$DB_TYPE" = "postgresql" ]; then cd $TARGET_FOLDER $DB_HOME/bin/pg_dump -Ft -b alfresco > $TARGET_FOLDER/$DB_DUMP cd $CURRENT_FOLDER if [ ! -f "$TARGET_FOLDER/$DB_DUMP" ]; then CHECK=0 fi else echo "Unknown database type '${DB_TYPE}'" CHECK=0 fi # 3) Backup of the Alfresco's data folder. if [ "$CHECK" = 1 ]; then ALF_DUMP=${TIMESTAMP}_alfresco_data.tgz cd $ALF_HOME tar zcf $TARGET_FOLDER/$ALF_DUMP $ALF_DATA_SUBDIR cd $CURRENT_FOLDER if [ ! -f "$TARGET_FOLDER/$ALF_DUMP" ]; then CHECK=0 fi fi # 4) Merge the two backups. if [ "$CHECK" = 1 ]; then BACKUP_FILE="${TIMESTAMP}_alfresco_dump.tgz" cd $TARGET_FOLDER tar zcf $BACKUP_FILE $ALF_DUMP $DB_DUMP if [ ! -f "$BACKUP_FILE" ]; then CHECK=0 else rm $ALF_DUMP rm $DB_DUMP fi cd $CURRENT_FOLDER fi # 5) Alfresco start. service alfresco start # 6) Delete dump older than a certains number of days. if [ "$CHECK" = 1 ]; then find $TARGET_FOLDER/*.tgz -type f -mtime +${NUM_DUMP} -exec rm {} ; fi else echo "usage: $0 [targetPath]" fi
Exit with CTRL+X and confirm saving. Let’s go ahead defining permits and preparing the repository folder. Talking about the repository folder here is presented an example but in practical cases is suggested to mount an external file system used specifically for backup purpose.
chmod uga+x /opt/alfresco/alfrescoBackup.sh mkdir /opt/alfresco/backup
Now everything is set and it’s time to activate the crontab to perform automatic backup, probably during the night time. Please, observe that the user used to run Alfresco is named ‘alfresco’ (do not run it as root) and the crontab is performed as ‘alfresco’ user with ‘-u alfresco’.
sudo crontab -u alfresco -e
.
00 01 * * * /opt/alfresco/alfrescoBackup.sh /opt/alfresco/backup
In this example the cold backup of Alfresco is performed at 01:00 am. To read more about crontab see here.
In this post is shared the installation of Liferay 6.1.1 Community Edition GA2 on Ubuntu 12.04 LTS 64bit with Apache Tomcat 7.0.35 and PostgreSQL 8.4.15. The purpose installation is not the bundle one but the more “robust” alternative for an enterprise configuration.
The post is based on the installation tutorial described in the ‘Step by step installation of Liferay 6.1.1 CE GA2 on Ubuntu 12.04 LTS and JBoss 7 64bit… no bundle please!‘ with the difference that in this case the installation is on Apache Tomcat instead of Jboss Application Server.
As we like and prefer, the installation is a step by step list of commands and tasks… simpler to understand, to do and to test. Hope you’ll be agree.
In this paragraph are collected the used sources for the installation. I suggest to download and store them in a safe repository for future purposes (re-installation, maintainance, etc.).
For development purpose you should create your own environment on a virtual machine useful to customizations and tests. Of course if you are in a production environment you can jump directly to the next paragraph talking about the JDK installation.
In this case we use the Oracle VirtualBox as virtualization product but nothing should happen if you prefer VMPlayer or other solutions.
As first step, create the virtual machine with at least 2Gb RAM and start it using the ‘ubuntu-12.04.1-desktop-amd64.iso’ file. During the installation you receive some easy questions, driving you in the installation task.
Below some suggestions:
sudo apt-get update
sudo mount -t vboxsf Desktop /mnt ls -la /mnt
The last command is done to check everything is properly set.
sudo mkdir -p /opt/java sudo chown liferay:liferay /opt/java sudo cp -r /mn/.../jdk-7u9-linux-x64.tar.gz /opt/java cd /opt/java gunzip jdk-7u9-linux-x64.tar.gz tar xvf jdk-7u9-linux-x64.tar rm jdk-7u9-linux-x64.tar sudo nano /etc/profile.d/java.sh
.
export JAVA_HOME=/opt/java/jdk1.7.0_09 export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
java -version javac -version
We always prefer to compile PostgreSQL from the sources to have a full control of the installation and customizations.
sudo mkdir -p /opt/postgresql sudo chown liferay:liferay /opt/postgresql sudo cp /mnt/.../postgresql-8.4.15.tar.gz /opt/postgresql cd /opt/postgresql gunzip postgresql-8.4.15.tar.gz tar xvf postgresql-8.4.15.tar rm postgresql-8.4.15.tar mkdir -p /opt/postgresql/8.4.15 cd /opt/postgresql/postgresql-8.4.15/ sudo apt-get install libreadline-dev sudo apt-get install zlib1g-dev ./configure exec_prefix=/opt/postgresql/8.4.15 sudo make exec_prefix=/opt/postgresql/8.4.15 sudo make install exec_prefix=/opt/postgresql/8.4.15
mkdir /opt/postgresql/8.4.15/data mkdir /opt/postgresql/8.4.15/log sudo adduser postgres
sudo chown -R postgres:postgres /opt/postgresql su - postgres
nano .environment-8.4.15
.
export POSTGRES_VERSION=8.4.15 export LD_LIBRARY_PATH=/opt/postgres/${POSTGRES_VERSION}/lib export PATH=/opt/postgres/${POSTGRES_VERSION}/bin:${PATH}
chmod 777 .environment-8.4.15 . .environment-8.4.15 /opt/postgresql/8.4.15/bin/initdb -D /opt/postgresql/8.4.15/data/ --encoding=UNICODE exit
sudo nano /etc/init.d/postgresql.8.4.15
.
case "$1" in start) echo "Starting postgres" /bin/su - postgres -c "/home/postgres/postgresql-8.4.15 start" ;; stop) echo "Stopping postgres" /bin/su - postgres -c "/home/postgres/postgresql-8.4.15 stop" ;; * ) echo "Usage: /sbin/service postgresql.8.4.15 {start|stop}" exit 1 esac exit 0
sudo chmod 777 /etc/init.d/postgresql.8.4.15 su - postgres
. .environment-8.4.15 nano /home/postgres/postgresql-8.4.15
.
# Parameters: start or stop. export POSTGRES_VERSION=8.4.15 # Check parameter. if [ "$1" != "start" ] && [ "$1" != "stop" ]; then echo "Specify start or stop as first parameter." exit fi # Add stop switch. __STOP_SWITCH="" if [ "$1" = "stop" ]; then __STOP_MODE="smart" __STOP_SWITCH="-m $__STOP_MODE" echo "Stop switch is: $__STOP_SWITCH" fi # Do it. export LD_LIBRARY_PATH=/opt/postgresql/${POSTGRES_VERSION}/lib ~/.environment-${POSTGRES_VERSION} /opt/postgresql/${POSTGRES_VERSION}/bin/pg_ctl -D /opt/postgresql/${POSTGRES_VERSION}/data -l /opt/postgresql/${POSTGRES_VERSION}/log/postgresql.log $1 $__STOP_SWITCH # Alternative command. # /opt/postgresql/${POSTGRES_VERSION}/bin/postgres -D /opt/postgresql/${POSTGRES_VERSION}/data
chmod 777 /home/postgres/postgresql-8.4.15 service postgresql.8.4.15 start exit
su - postgres
. .environment-8.4.15 /opt/postgresql/8.4.15/bin/psql
.
CREATE ROLE liferay WITH PASSWORD 'liferay' LOGIN; CREATE DATABASE lportal WITH OWNER liferay; <ctrl> + d
.
/opt/postgresql/8.4.15/bin/psql -U liferay -d lportal ALTER USER liferay WITH PASSWORD 'liferay'; <ctrl> + d
.
exit
Now it’s time to install Apache Tomcat.
sudo mkdir /opt/liferay sudo chown liferay:liferay /opt/liferay cp /mnt/.../apache-tomcat-7.0.35.tar.gz /opt/liferay cd /opt/liferay tar -xvf apache-tomcat-7.0.35.tar.gz rm -rf apache-tomcat-7.0.35.tar.gz sudo mv apache-tomcat-7.0.35 /opt/liferay/tomcat
/opt/liferay/tomcat/bin/startup.sh
/opt/liferay/tomcat/bin/shutdown.sh
Not many documentations are well done like the Liferay ones. To this link the steps for Tomcat installation of Liferay.
mkdir /opt/liferay/tomcat/lib/ext cd /opt/liferay/tomcat/lib/ext cp /mnt/.../liferay-portal-dependencies-6.1.1-ce-ga2-...zip /opt/liferay/tomcat/lib/ext unzip liferay-portal-dependencies-6.1.1-ce-ga2-...zip rm -rf liferay-portal-dependencies-6.1.1-ce-ga2-...zip mv liferay-portal-dependencies-6.1.1-ce-ga2/*.jar . rm -rf liferay-portal-dependencies-6.1.1-ce-ga2
mkdir -p /opt/liferay/tomcat/temp/liferay/com/liferay/portal/deploy/dependencies
sudo cp /mnt/.../postgresql-8.4-703.jdbc4.jar $TOMCAT_HOME/lib/ext. sudo cp /mnt/.../jta...jar $TOMCAT_HOME/lib/ext. nano /opt/liferay/tomcat/bin/setenv.sh
.
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
mkdir -p /opt/liferay/tomcat/conf/Catalina/localhost nano /opt/liferay/tomcat/conf/Catalina/localhost/ROOT.xml
.
<Context path="" crossContext="true"> <!-- JAAS --> <!--<Realm className="org.apache.catalina.realm.JAASRealm" appName="PortalRealm" userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal" roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole" />--> <!-- Uncomment the following to disable persistent sessions across reboots. --> <!--<Manager pathname="" />--> <!-- Uncomment the following to not use sessions. See the property "session.disabled" in portal.properties. --> <!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />--> </Context>
nano /opt/liferay/tomcat/conf/catalina.properties
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
with:
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/*.jar
nano /opt/liferay/tomcat/conf/server.xml
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
rm -rf /opt/liferay/tomcat/webapps/ROOT/* cp liferay-portal-6.1.1-ce-ga2-...war /opt/liferay/tomcat/webapps/ROOT cd /opt/liferay/tomcat/webapps/ROOT jar -xf /opt/liferay/tomcat/webapps/ROOT/liferay-portal-6.1.1-ce-ga2-...war rm /opt/liferay/tomcat/webapps/ROOT/liferay-portal-6.1.1-ce-ga2-...war nano /opt/liferay/tomcat/webapps/ROOT/WEB-INF/classes/portal-ext.properties
.
jdbc.default.driverClassName=org.postgresql.Driver jdbc.default.url=jdbc:postgresql://localhost:5432/lportal jdbc.default.username=liferay jdbc.default.password=liferay setup.wizard.enabled=true
/opt/liferay/tomcat/bin/startup.sh tail -f /opt/liferay/tomcat/logs/catalina.out
nano /opt/liferay/tomcat/webapps/ROOT/WEB-INF/classes/portal-ext.properties
.
#setup.wizard.enabled=true
/opt/liferay/tomcat/bin/shutdown.sh sudo nano /etc/init.d/liferay
.
case "$1" in start) /bin/su - liferay -c "/opt/liferay/tomcat/bin/startup.sh" ;; stop) /bin/su - liferay -c "/opt/liferay/tomcat/bin/shutdown.sh" ;; * ) echo "Usage:service liferay {start|stop}" exit 1 esac exit 0
sudo chmod 777 /etc/init.d/liferay service liferay start
My personal compliments… Liferay on Tomcat and PostgreSQL is installed with success!