cancel
Showing results for 
Search instead for 
Did you mean: 

Installation Afresco Community 2.1 sur Ubuntu Server 8.04

vivi
Champ in-the-making
Champ in-the-making
This tutorial is based on Joost Horward's installation method for Ubuntu 7.10
http://wiki.alfresco.com/wiki/Installing_Alfresco_on_Ubuntu_7.10

1. Install required packages
The MySQL database server:
apt-get install mysql-server
OpenOffice for document transformations. The headless is for the framebuffer.
apt-get install openoffice.org openoffice.org-headless
The iptables package required for using the CIFS, FTP, NFS or FTP while running as non-root user:
apt-get install iptables
The Sun Java Development Kit(jdk)required for Tomcat to function. The sun-java6-jre and sun-java6-bin packages will be installed automatically with the jdk:
apt-get install sun-java6-jdk
Imagemagick for image transformation:
apt-get install imagemagick
Portmapper required for NFS server:
apt-get install portmap
NFS common package required for NFS server:
apt-get install nfs-common

2. Create the alfresco user and group
groupadd alfresco
useradd -m -g alfresco alfresco
The alfresco user needs a home directory for OpenOffice, hence the '-m'. The alfresco user never needs to log in, there should be a '!' for the password in the /etc/shadow entry. If not, put it there.

3. Install Alfresco Tomcat bundle
Unpack the tarball:
 mkdir /opt/alfresco
cd /opt/alfresco
tar -xzf alfresco-community-tomcat-2.1.0.tar.gz
Important!!! Make sure that /opt/alfresco/tomcat/ and below is owned by alfresco:
chown -R alfresco:alfresco /opt/alfresco/tomcat/

4. Create the database
Using the mysql command line client:
mysql –u root -p
create database alfresco;
grant all privileges on alfresco.* to alfresco@localhost identified by 'alfresco';
(Choose your own password, just make sure it matches what you configure in custom-repository.properties later on)
To remove the database: drop database alfresco;

5. Create directories for variable data
Create space for the repository, the cache and make the user and group alfresco it's owner:
mkdir -p /var/lib/alfresco/alf_data
mkdir /var/lib/alfresco/tmp
chown -R alfresco:alfresco /var/lib/alfresco
Create a directory for the logs and make the user and group alfresco it's owner:
mkdir -p /var/log/alfresco/tomcat/logs
chown -R alfresco:alfresco /var/log/alfresco
The Alfresco log will be in /var/log/alfresco/alfresco.log.

6. Java variable
Add this line to /etc/environment to set JAVA_HOME:
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
and to /opt/alfresco/alfresco.sh
#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
APPSERVER=/opt/alfresco/tomcat
# Set any default JVM values
export JAVA_OPTS='-Xms128m -Xmx512m -server'
export JAVA_HOME=/usr/lib/jvm/java-6-sun
# Following only needed for Sun JVMs before to 1.5 update 8
export JAVA_OPTS="${JAVA_OPTS} -XX:CompileCommand=exclude,org/apache/lucene/index/IndexReader\$1,doBody -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeIndexes -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo\$Merger,mergeDeletions"
#
if [ "$1" = "start" ]; then
  "$APPSERVER"/bin/startup.sh
#  if [ -r ./virtual_start.sh ]; then
#    sh ./virtual_start.sh
#  fi
  if [ -r ./start_oo.sh ]; then
    sh ./start_oo.sh
  fi
elif [ "$1" = "stop" ]; then
  "$APPSERVER"/bin/shutdown.sh
#  if [ -r ./virtual_start.sh ]; then
#    sh ./virtual_stop.sh
#  fi
  if [ -r ./start_oo.sh ]; then
    killall soffice.bin
  fi
fi

7. OpenOffice
Rename the file zstart_oo.sh to start_oo.sh
mv zstart_oo.sh start_oo.sh
change the line /opt/openOffice.org2.1/program/soffice to /usr/bin/soffice
#!/bin/sh
# —————————————————————————
# Start script for the OpenOffice transform service
# —————————————————————————

echo "Starting OpenOffice service…"

# Comment or uncomment the appropriate location using #
# Assumes OpenOffice is installed in /opt
/usr/bin/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

# If NeoOffice on Mac OS X
#/Applications/NeoOfficeJ.app/Contents/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

8. Configure the repository
Create custom-repository-context.xml in the extensions directory (/opt/alfresco/tomcat/shared/classes/alfresco/extension), if it is not already there:
  <?xml version='1.0' encoding='UTF-8'?>
  <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
  <beans>
    <!– overriding to point to custom properties –>
    <bean id="repository-properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders">
            <value>true</value>
        </property>
        <property name="locations">
            <list>
                <value>classpath:alfresco/repository.properties</value>
                <value>classpath:alfresco/version.properties</value>
                <value>classpath:alfresco/domain/transaction.properties</value>

                <!– Override basic repository properties –>
                <value>classpath:alfresco/extension/custom-repository.properties</value>
            </list>
        </property>
    </bean>
    <bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>classpath:alfresco/domain/hibernate-cfg.properties</value>

                <!– Override hibernate dialect –>
                <value>classpath:alfresco/extension/custom-hibernate-dialect.properties</value>
            </list>
        </property>
    </bean>
  </beans>

Change configuration files in extension/ directory.
Change repository configuration custom-repository.properties (uncomment/comment corresponding lines and add values where missing):
dir.root=/var/lib/alfresco/alf_data
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
#db.driver=org.hsqldb.jdbcDriver
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco
Change the hibernate configuration custom-hibernate-dialect.properties (uncomment/comment corresponding lines):
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
To configure the CIFS server to use non-privileged ports use the following in either file-servers.xml or file-servers-custom.xml configuration file (whichever is present), in the section <config evaluator="string-compare" condition="CIFS Server">:
<alfresco-config area="file-servers">
   <config evaluator="string-compare" condition="CIFS Server">
      <serverEnable enabled="true"/>
      <host name="${localname}_A"/>
      <comment>Alfresco CIFS Server</comment>
      <broadcast>255.255.255.255</broadcast>
      <tcpipSMB platforms="linux,solaris,macosx"/>
      <netBIOSSMB platforms="linux,solaris,macosx"/>
      <tcpipSMB port="1445" platforms="linux,solaris,macosx"/>
      <netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>
      <hostAnnounce interval="5"/>
      <sessionDebug flags="Negotiate,Socket"/>
   </config>
at the start of the file-servers-custom.xml file.

9. Configure logging
Tomcat logging is hard to change because some of the tomcat scripts write to the log directory directly. To move the logs away from the program files we use a symbolic link. Remove the logging directory and create a symlink instead:
rm -r /opt/alfresco/tomcat/logs
ln -s /var/log/alfresco/tomcat/logs /opt/alfresco/tomcat/logs
Configure Alfresco logging: In tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties modify line
log4j.appender.File.File=alfresco.log
to read
log4j.appender.File.File=/var/log/alfresco/alfresco.log
(NOTE: this step needs to be done after Alfresco was started once, as tomcat/webapps/alfresco/ subtree only appears after alfresco.war in tomcat/webapps/ is deployed. So skip this step for now, start Alfresco once, verify that tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties was unpacked, stop Alfresco, do the change, then start Alfresco again):

10. Init script
Store the following script as /etc/init.d/alfresco:
#!/bin/bash
#
# Alfresco init script for Ubuntu server 8.04 based on Joost Horward’s script
# 16:16 02.05.2008 VDo
#

export PIDFILE=/var/run/alfresco
export LOGFILE=/var/log/alfresco/alfresco.log
export ALFRESCO_HOME=/opt/alfresco
#export APPSERVER=/opt/alfresco/tomcat
export JAVA_HOME=/usr/lib/jvm/java-6-sun

cd $ALFRESCO_HOME
#
# redirect FROM TO PROTOCOL
# setup port redirect using iptables
redirect() {
  echo "Redirecting port $1 to $2 ($3)"
  iptables -t nat -A OUTPUT -d localhost -p $3 –dport $1 -j REDIRECT –to-ports $2
  iptables -t nat -A PREROUTING -d $HOSTNAME -p $3 –dport $1 -j REDIRECT –to-ports $2
  iptables -t nat -A OUTPUT -d $HOSTNAME -p $3 –dport $1 -j REDIRECT –to-ports $2
}

#
# setup_iptables
# setup iptables for redirection of CIFS and FTP
setup_iptables () {

  echo "1" >/proc/sys/net/ipv4/ip_forward
  # Clear NATing tables
  iptables -t nat -F
  # FTP NATing
  redirect 21 2021 tcp

  # CIFS NATing
  redirect 445 1445 tcp
  redirect 139 1139 tcp
  redirect 137 1137 udp
  redirect 138 1138 udp
}

#
# start_openoffice
#
start_openoffice(){
  sudo -H -u alfresco /usr/bin/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &
}

case $1 in
start)
  if [ -f $PIDFILE ] ; then
    echo "Alfresco is already running!"
    exit 1
  fi
  touch $PIDFILE

# echo "Starting OpenOffice service …"
# start_openoffice 
 
  echo "Setting up iptables …"
  setup_iptables 

  echo "Starting Alfresco …"
  echo -e "\n\n\n`date` Starting Alfresco …" >>$LOGFILE
  sudo chown alfresco:alfresco $LOGFILE

  sudo -H -u alfresco sh $ALFRESCO_HOME/alfresco.sh start
        ;;
stop) 
  sudo -H -u alfresco sh $ALFRESCO_HOME/alfresco.sh stop
  killall -w -u alfresco
        echo  -e "`date` Stopping Alfresco …" >>$LOGFILE
  rm $PIDFILE
        ;;
restart)
  rm $PIDFILE
  sudo -H -u alfresco sh $ALFRESCO_HOME/alfresco.sh stop
  killall -w -u alfresco
   echo  -e "\n\n\n`date` Restarting Alfresco …" >>$LOGFILE
  sudo -H -u alfresco sh $ALFRESCO_HOME/alfresco.sh start
  touch $PIDFILE
        ;;
zap)
  echo "Zapping $PIDFILE …"
  rm $PIDFILE
  ;;
*)
  echo "Usage: alfresco [start|stop|restart|zap] [tail]"
  exit 1
  ;;

esac  

case $2 in
tail)
  tail -f $LOGFILE
  ;;
esac

exit 0

Make sure that you set the script to be executable by the root only:
chown root:root /etc/init.d/alfresco
chmod 755 /etc/init.d/alfresco

11. Run Alfresco
/etc/init.d/alfresco start|stop|restart|zap [tail]
(Don't forget that you need be a root, or use
sudo /etc/init.d/alfresco start|stop|restart|zap [tail]
command, e.g.
sudo /etc/init.d/alfresco start
to start Alfresco). The tail option just starts a new tail -f on the alfresco log. Alfresco will populate the repository (Database and filesystem) on first start.
After starting alfresco, point your browser at to http://localhost:8080/alfresco or http://localhost:8080/alfresco/webdav.

12. Secures Alfresco
http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html
Prepare the Certificate Keystore:
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
After executing this command, you will first be prompted for the keystore password. The default password used by Tomcat is "changeit" (all lower case), although you can specify a custom password if you like. You will also need to specify the custom password in the server.xml configuration file, as described later.
Next, you will be prompted for general information about this Certificate, such as company, contact name, and so on. This information will be displayed to users who attempt to access a secure page in your application, so make sure that the information provided here matches what they will expect.
Finally, you will be prompted for the key password, which is the password specifically for this Certificate (as opposed to any other Certificates stored in the same keystore file). You MUST use the same password here as was used for the keystore password itself. (Currently, the keytool prompt will tell you that pressing the ENTER key does this for you automatically.)
If everything was successful, you now have a keystore file with a Certificate that can be used by your server.
Edit the Tomcat Configuration File
<– Define a SSL Coyote HTTP/1.1 Connector on port 8443 –>
<!–
<Connector
           port="8443" minProcessors="5" maxProcessors="75"
           enableLookups="true" disableUploadTimeout="true"
           acceptCount="100" debug="0" scheme="https" secure="true";
           clientAuth="false" sslProtocol="TLS"/>
–>

Add keystoreFile if the keystore is not at the place expected by tomcat
Add keystorePass if the password is different to the one expected by tomcat.
After starting alfresco, point your browser at to https://localhost:8443/alfresco  or https://localhost:8443/alfresco/webdav.

13. FTP Connection
Edit /opt/alfresco/tomcat/shared/classes/alfresco/extension/file-servers-custom.xml And add
<config evaluator="string-compare" condition="FTP Server">
   <serverEnable enabled="true" />
   <port>2021</port>
   <rootDirectory>/Alfresco</rootDirectory>
   <charSet>UTF8</charSet>
</config>
Connection to ftp://localhost:2021/alfresco
6 REPLIES 6

fariik
Champ in-the-making
Champ in-the-making
Hello Vivi,

Thank you for your tutorial intallation of alfresco on ubuntu server 8.04.

I ask you a question you could activate access CIFS on your server Ubuntu?

If so can you give us the procedure to follow to activate it.

Thank you! Smiley Very Happy

michaelh
Champ on-the-rise
Champ on-the-rise
Si en même temps on pouvait se concentrer sur l'usage du Français, ça justifierait l'appellation de ce forum 😉

Merci !

fariik
Champ in-the-making
Champ in-the-making
Bonjour Vivi,

Merci pour ce tutoriel vraiment parfait d'Alfresco sous ubuntu 8.04.
Je voudrais te poser une question, as tu pu activer le CIFS sur ton serveur ?
Si oui donne moi la procedure à suivre pour l'activer !

Merci beaucoup !

vivi
Champ in-the-making
Champ in-the-making
Bonjour,

Oui j'ai russit à activer le CIFS.
Le script du point 10 se charge d'activer le transfert de port pour acceder à Alfresco


# Clear NATing tables
  iptables -t nat -F
  # FTP NATing
  redirect 21 2021 tcp

  # CIFS NATing
  redirect 445 1445 tcp
  redirect 139 1139 tcp
  redirect 137 1137 udp
  redirect 138 1138 udp


Il faut aussi ajouter ceci au fichier file-servers.xml

<alfresco-config area="file-servers">
   <config evaluator="string-compare" condition="CIFS Server">
      <serverEnable enabled="true"/>
      <host name="${localname}_A"/>
      <comment>Alfresco CIFS Server</comment>
      <broadcast>255.255.255.255</broadcast>
      <tcpipSMB platforms="linux,solaris,macosx"/>
      <netBIOSSMB platforms="linux,solaris,macosx"/>
      <tcpipSMB port="1445" platforms="linux,solaris,macosx"/>
      <netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx"/>
      <hostAnnounce interval="5"/>
      <sessionDebug flags="Negotiate,Socket"/>
   </config>

Normalement tout devrait fonctionner correctement.

fariik
Champ in-the-making
Champ in-the-making
Merci Vivi,

J'essaye ça dès demain ! Et je te donne les résultat !

Bonne soirée. Smiley Very Happy

jerem285
Champ in-the-making
Champ in-the-making
Bonjour je viens de suivre votre tutoriel j'ai tout fait de A à Z, mais je tombe toujours sur une erreur http 404 quand j'essaye de me connecter a mon serveur par le naviguateur:
Voici l'erreur plus précisément:
Etat HTTP 404 - /alfresco/

type Rapport d'état

message /alfresco/

description La ressource demandée (/alfresco/) n'est pas disponible.
Apache Tomcat/5.5.23
Avez vous une idée pour m'aider, sachant que si je supprime le fichier web.xml je me retourve avec l'erreur suivante :
Etat HTTP 500 -

type Rapport d'exception

message

description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.

exception

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:40

37: <%– redirect to the web application's appropriate start page –%>
38: <%
39: // get the start location as configured by the web-client config
40: ConfigService configService = (ConfigService)WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext()).getBean("webClientConfigService");
41: ClientConfigElement configElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement("client");
42: String location = configElement.getInitialLocation();
43:


Stacktrace:
   org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:383)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

cause mère

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
   org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:86)
   org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/5.5.23.
Apache Tomcat/5.5.23
Merci de m'aider  Smiley Tongue