This document shows how to install Alfresco 4.0 on an Ubuntu
12.04 server that has java 7 already installed on its system.
In this example I am running it on an Ubuntu server in the
amazon AWS cloud it’s a c1.medium instance.
(for those interested it was started from ami-3d4ff254 )
Before you dive into this make sure the machine running
alfresco has
Remember to have those set up especially the port 25 I pulled my hair out once for hours wondering why it was not working.
- port 25 open (for e-mail)
- A DNS record to so emails can be routed to that machine.
Install Tomcat 7
( a lot of this was derived from http://jensontaylor.blogspot.com/2010/09/manually-installing-tomcat-7-on-ubuntu.html
)
·
Download tomcat 7 to the local directory (this address could change see http://tomcat.apache.org/download-70.cgi
)
> wget
http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-7/v7.0.32/bin/apache-tomcat-7.0.32.tar.gz
|
Extract the file
> tar
xvzf apache-tomcat-7.0.32.tar.gz
|
Move the tomcat over
> sudo
mv apache-tomcat-7.0.32 /opt/tomcat
|
Now set up the tomcat users.
> sudo
vi /opt/tomcat/conf/tomcat-users.xml
|
Add the following lines within the <tomcat-users>
element (of course change the password
to your own password)
<role
rolename="manager-gui"/>
<role
rolename="admin-gui"/>
<user
name="admin" password="password"
roles="admin-gui, manager-gui,
manager-script,
admin-script" />
|
Fix the connector,
This has some issue with Hudson if not fixed.
> sudo
vi +70 /opt/tomcat/conf/server.xml
|
And add this to the
connector
URIEncoding="UTF-8"
Set up start up script
> sudo
vi /etc/init.d/tomcat
|
Then place the following in it. (adjust the jvm to the directoy you have it
in)
# Tomcat auto-start
#
# description: Auto-starts
tomcat
# processname: tomcat
# pidfile:
/var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/jre1.7.0_07
export HUDSON_HOME=/opt/hudson
case $1 in
start)
sh /opt/tomcat/bin/startup.sh
;;
stop)
sh /opt/tomcat/bin/shutdown.sh
;;
restart)
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
;;
esac
exit 0
|
Make it executable
> sudo
chmod 755 /etc/init.d/tomcat
|
Add it to autostart
> sudo
update-rc.d tomcat defaults
|
Reboot to test auto start of tomcat
> sudo
reboot now
|
Now open up a web browser
(of course use your IP address, domain name)
http://ec2-72-44-49-158.compute-1.amazonaws.com8080
Should see…
Change memory settings for tomcat
> sudo
vi /opt/tomcat/bin/catalina.sh
|
Add the following line
This gives it 2GiB to use, you may need to change it to your
system
JAVA_OPTS="-XX:MaxPermSize=160m -XX:NewSize=256m
-Xms512m "
JAVA_OPTS="$JAVA_OPTS –Xmx2048m -Xss512K "
|
Restart tomcat
> sudo
/etc/init.d/tomcat restart
|
Open up http://ec2-72-44-49-158.compute-1.amazonaws.com:8080/manager/status
to check the memory settings
Here you can see here that it does have 2GiB of max memory
(roughly)
Install/Setup MySQL
Install mysql on this
server
> sudo
apt-get install mysql-server
|
For the root password set it to “mysqlpassword”
Log into mysql
> mysql
-u root -p -h localhost
|
Run this command in mysql to create alfresco user and to
give it alfresco access
> CREATE
USER 'alfresco'@'localhost' IDENTIFIED BY 'passalfresco';
> CREATE USER
'alfresco'@'%' IDENTIFIED BY 'passalfresco';
> grant
all on alfresco.* to 'alfresco'@'%' identified by 'passalfresco' with grant
option;
> exit
|
Remove localhost restriction edit /etc/mysql/my.cnf
> sudo
vi /etc/mysql/my.cnf
|
Comment out
bind-address
= 127.0.0.1
Change it to
#bind-address
= 127.0.0.1
Restart mysql
> sudo
/etc/init.d/mysql restart
|
Test the connection from another server
> mysql
-u alfresco -p -h localhost
|
Then run the following command to create the database
> create
database alfresco default character set utf8 collate utf8_bin;
> exit
|
Create Alfresco Folder
Make a alfresco folder
> sudo
mkdir /alfresco
|
Download Install Alfresco
Some of the notes I used for this are at
Download the installer (this address will change over time)
> cd
> mkdir
alfresco
> cd
alfresco
> wget
http://dl.alfresco.com/release/community/build-00007/alfresco-community-4.0.e.zip
|
If you do not have unzip install it.
> sudo
apt-get install unzip
|
unzip file
> unzip
alfresco-community-4.0.e.zip
|
Install alfresco.war and share.war on tomcat
Open up the tomcat web page
Then enter
Context Path
/alfresco
War Directory
/home/username/alfresco/web-server/webapps/alfresco.war
Click
Deploy
It
will deploy but fail to start (which is fine)
Now do the same for
share.war
Then enter
Context Path
/share
War Directory
/home/username/alfresco/web-server/webapps/share.war
Click
Deploy
Download
and install mysql connector, it can be found at http://dev.mysql.com/downloads/connector/j/
> cd
> wget http://mysql.he.net/Downloads/Connector-J/mysql-connector-java-5.1.18.zip
> unzip mysql-connector-java-5.1.18.zip
> cd mysql-connector-java-5.1.18/
> cp mysql-connector-java-5.1.18-bin.jar
/opt/tomcat/lib/
|
Set up the shared directory
> cd
> cd alfresco/web-server
> sudo cp -r shared /opt/tomcat/
|
Set
Global Properties
Alfresco requires some additional installs to work. Alfresco out of the box uses a few other
tools like OpenOffice and ImageMagick.
Some of this was gleamed from http://www.howtoforge.com/how-to-install-alfresco-community-3.3-on-ubuntu-server-10.04-lucid-lynx
Edit /etc/apt/sources.list.
> sudo vi /etc/apt/sources.list
|
Add the following at the bottom
deb http://archive.canonical.com/ lucid partner
|
Run this from the command line
> sudo apt-get update
|
Install these via apt-get
> sudo apt-get install
imagemagick
> sudo apt-get install
swftools
> sudo apt-get install libjodconverter-java
|
Edit the /opt/tomcat/conf/catalina.properties file
> sudo vi +74
/opt/tomcat/conf/catalina.properties
|
Updated shared.loader to the following
> shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
|
In the /opt/tomcat/shared/classes directory there is an
alfresco-global.properties.sample folder.
Rename it
> cd /opt/tomcat/shared/classes
> sudo cp
alfresco-global.properties.sample alfresco-global.properties
|
Now edit this file
> sudo
vi alfresco-global.properties
|
Here is the file I made,
Make sure to edit the mail.* portion to an email account you have.
###############################
## Common Alfresco
Properties #
###############################
#
# Sample custom
content and index data location
#
dir.root=/alfresco/alf_data
#dir.keystore=${dir.root}/keystore
#
# Sample database
connection properties
#
db.username=alfresco
db.password=passalfresco
#Disabled the guest login
alfresco.authentication.allowGuestLogin=false
#
# External
locations
#-------------
ooo.exe=/usr/bin/soffice
ooo.enabled=true
ooo.port=8100
img.root=/usr
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/usr/bin/pdf2swf
jodconverter.enabled=true
jodconverter.officeHome=/usr/lib/openoffice
jodconverter.portNumbers=8100
jodconverter.officeHome=/usr/lib/openoffice/program/soffice
jodconverter.portNumbers=8101
jodconverter.enabled=true
#
# Property to
control whether schema updates are performed automatically.
# Updates must be
enabled during upgrades as, apart from the static upgrade scripts,
# there are also
auto-generated update scripts that will need to be executed. After
# upgrading to a
new version, this can be disabled.
#
#db.schema.update=true
#
# MySQL connection
#
db.driver=org.gjt.mm.mysql.Driver
db.name=alfresco
db.url=jdbc:mysql://localhost/alfresco?useUnicode=yes&characterEncoding=UTF-8
#
# Oracle connection
#
#db.driver=oracle.jdbc.OracleDriver
#db.url=jdbc:oracle:thin:@localhost:1521:alfresco
#
# SQLServer
connection
# Requires jTDS
driver version 1.2.5 and SNAPSHOT isolation mode
# Enable TCP
protocol on fixed port 1433
# Prepare the
database with:
# ALTER DATABASE
alfresco SET ALLOW_SNAPSHOT_ISOLATION ON;
#
#db.driver=net.sourceforge.jtds.jdbc.Driver
#db.url=jdbc:jtds:sqlserver://localhost:1433/alfresco
#db.txn.isolation=4096
#
# PostgreSQL
connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
#
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/alfresco
#
# Index Recovery
Mode
#-------------
#index.recovery.mode=AUTO
#
# Outbound Email
Configuration
#-------------
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=yourname@example.com
mail.password=yourpassword
mail.smtp.timeout=30000
# New Properties
mail.smtps.starttls.enable=true
mail.smtps.auth=true
#
# Alfresco Email
Service and Email Server
#-------------
# Enable/Disable
the inbound email service. The service
could be used by processes other than
# the Email Server
(e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
#email.inbound.enabled=true
# Email Server
properties
#-------------
#email.server.enabled=true
#email.server.port=25
#email.server.domain=alfresco.com
#email.inbound.unknownUser=anonymous
# A comma separated
list of email REGEX patterns of allowed senders.
# If there are any
values in the list then all sender email addresses
# must match. For
example:
# .*\@alfresco\.com, .*\@alfresco\.org
# Allow anyone:
#-------------
#email.server.allowed.senders=.*
#
# The default
authentication chain
# To configure
external authentication subsystems see:
#
http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems
#-------------
#authentication.chain=alfrescoNtlm1:alfrescoNtlm
#
# URL Generation
Parameters (The ${localname} token is replaced by the local server name)
#-------------
#alfresco.context=alfresco
#alfresco.host=${localname}
#alfresco.port=8080
#alfresco.protocol=http
#
#share.context=share
#share.host=${localname}
#share.port=8080
#share.protocol=http
#imap.server.enabled=true
#imap.server.port=143
#imap.server.host=localhost
# Default value of
alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'.
# This allows
connections to JMX both remotely and locally.
#
alfresco.rmi.services.host=0.0.0.0
#
# RMI service ports
for the individual services.
# These seven
services are available remotely.
#
# Assign individual
ports for each service for best performance
# or run several
services on the same port. You can even run everything on 50500 if needed.
#
# Select 0 to use a
random unused port.
#
#avm.rmi.service.port=50501
#avmsync.rmi.service.port=50502
#attribute.rmi.service.port=50503
#authentication.rmi.service.port=50504
#repo.rmi.service.port=50505
#action.rmi.service.port=50506
#wcm-deployment-receiver.rmi.service.port=50507
#monitor.rmi.service.port=50508
|
Reboot the server
> sudo reboot now
|
It may take a while for alfresco to come up and set
up the database the first time. What I
do is log back into the system them tail the tomcat log to see if alfresco is starting
correctly, and for when it is done (in
my case it took 2 ½ minutes)
> sudo tail -f /opt/tomcat/logs/catalina.out
|
See the server startup message.
Logged in as admin and added new users
Open up
The default login is
User
= admin
Password
= admin
I
always first change the admin password from the default just to make sure. To
do this…
Click on User Profile
Click on Change password
Enter new password and click Finish
Click on Manage System Users
Click Create New User
In my case I created a user called patman
Click next
enter a password
Click Finish
Now add the user to the admin group.
Click on Administration Console
Click on manage User Groups
Click on Show all then click add user in the Alfresco_Adminstrators
Search for user, select user then click add.
Finally click on OK
Now this user is an admin.
Log out and log back in as the user you just made and gave
admin rights to.
Make sure this user can log into the Share site as
well.
Open up
While you are in Alfresco share Create a folder to email into.
First create a site
Click on Sites -> Create Site
Call it Email_test
and click OK
Making a folder in Alfresco e-mailable
Now that you have Alfresco 4.0e running, how do you get a
folder
e-mailable?
Set up an inbox user
Once Alfresco is set up to receive emails directly if an
email is received from an address that is associated with a current Alfresco
user, it will be treated as if that user uploaded it.
As an example, if an email comes in from bob@example.com and we have a
“bob” user in alfresco that has an email set as bob@example.com
. Then when an email comes into our alfresco server from bob@example.com it will be
treated as if “bob” uploaded it. (of
course this is assuming bob is set up as an email user and emailing into
alfresco is turned on)
With that in mind, for this test, I will make a user to
handle emails sent from non-alfresco users.
( I will also make that user an admin user, which is not a good idea for
a live system, because it could overwrite any file or folder)
OK so let’s make a new user.
Log into alfresco as an admin user
Click on Manage System Users
Click Create New User
I gave it a user name of First name of email and last name of Anon.
I also gave it an email on email@example.com
then clicked next
I set its user name to emailAnon gave it a password and set its Home space to emailAnon and clicked next.
Click Finish
Now add the user to the email contributors and admin group.
Click on Administration Console
Click on manage User Groups
Click on Show all then click add user in the EMAIL_CONTRIBUTORS
By default user cannot email into the system. In order for a user to be allowed to email
into the system it must be part of the EMAIL_CONTRIBUTORS group.
Type in email and click search. This will display the emailAnon user. select on this user and click add, it will
then show up in the bottom part. Finally
click OK in the upper right.
Repeat the same
thing for this user but for the ALFRESCO_ADMINISTRATORS group. I did this so that they could upload to any
folder.
Edit the properties file
Edit the alfresco-global.properties file again.
> cd /opt/tomcat/shared/classes
> sudo
vi alfresco-global.properties
|
#
# Alfresco Email Service and
Email Server
#-------------
# Enable/Disable the inbound
email service. The service could be
used by processes other than
# the Email Server (e.g.
direct RMI access) so this flag is independent of the Email Service.
#-------------
email.inbound.enabled=true
# Email Server properties
#-------------
email.server.enabled=true
email.server.port=25
email.server.domain=ec2-72-44-49-158.compute-1.amazonaws.com
email.inbound.unknownUser=emailAnon
email.server.connections.max=3
email.server.enableTLS=false
# A comma separated list of
email REGEX patterns of allowed senders.
# If there are any values in
the list then all sender email addresses
# must match. For example:
# .*\@alfresco\.com, .*\@alfresco\.org
# Allow anyone:
#-------------
email.server.allowed.senders=.*
|
Here is a line by line explanation (as best I can give)
email.inbound.enabled=true
Just enable
inbound email
email.server.enabled=true
email.server.port=25
email.server.domain=ec2-72-44-49-158.compute-1.amazonaws.com
Turn on the
alfresco email server bind it to port 25 and set the
server
domain name
email.inbound.unknownUser=anonymous
Any email
from an unkown user will be uploaded as if it was
uploaded by
this alfresco user.
A word of warning… Since the emailAnon
user is an
admin it means
anyone can email into the system and overwrite
or add anything (very dangerous so plan your system
out better
than this)
email.server.enableTLS=false
For now
shut this off it ist for TLS encryption when
sending/recieveing emails In a
real system you should
probably
turn this back on and configure it correctly
email.server.allowed.senders=.*
A regex
field that says what email addresses in are allowed.
In this
case any email would be allowed.
After this has been
set up restart alfresco…
(in this case I just restarted tomcat to reboot alfresco)
> sudo /etc/init.d/tomcat restart
|
Watch it boot up again by
tailing the log
> sudo tail -f /opt/tomcat/logs/catalina.out
|
Every file and folder has an email address in Alfresco. But this email address is usually a number,
which can be very hard to remember. To
solve this problem it’s possible to add an email alias to a folder or file.
Log into Alfresco as an admin user.
Click on “Company Home”
Then Sites. Here you will see the
emailtest which is the share site you just created.
Now you can see the documentLibary folder. Click on the View Details icon.
The 844 is the email ID. So to email into this folder you could email to 844@example.com and it would go into this folder.
But that is hard to remember so make an alias to make your
life easier.
Click on Run Action on the right hand side.
Set to “add Aspect” and click “Set Values and add.
Select “Email Alias” and click OK
Click Finish.
Now you will see this Email Alias added to your properties.
Click on Modify in the upper right.
Set the Email Alias to “inbox” and click OK
Now its Email Alias is set any email sent to inbox@ http://ec2-72-44-49-158.compute-1.amazonaws.com will go into this folder.
I opened up my yahoo email and sent this email
There is not attachment to this email.
Now go to share and login
Click on Sites -> Email_test
Click on the Document Library
Now you will see 2 files that were created from this one
e-mail.
This is a test and this is a test.html
Now if you had sent it with a document attached say an excel
file.
Now you will see the xlsx file as an uploaded document.
References
[1] SMB/CIFS Server
Configuration
Visited 2/2012
[2] Installing Alfresco Community Edition 3.2 on
Ubuntu Server 9.04
Visited 2/2012
So many thanks. I have been stuck trying to set up email for ages. The manual (what manual) doesn't decribe most of the features of email setup especially if you afe new to alfresco and only come into alfresco share. There are all the menus I needed to access and setup. The blow by blow example worked perfectly.
ReplyDeleteNow if you could only do the same with SharePoint access ... :)
An excellent article and a ilfesaver.
Kind of you to say, I actually did this at a request from someone who found an old PDF document I made covering this subject.
DeleteI am curious, were you able to get it all working on your system? Just want to make sure my document is repeatable.
All the steps were well laid out and totally reproducible n m installation. I was that confident in the screen dumps that I set up several different users and sites to receive email. And they all worked first time. I had set up part of the system following the info in the Alfresco manual, but so much was missing or assumed, so your article provided the info I needed. I had searched and asked on the Alfresco forums but to no avail.
DeleteI have just done all this again on my other Alfresco server.
DeleteA couple of extra points came to mind.
1. Set the firewall to open port 25. I had an embarissing 5 mins whilst I wondered why it didn't work when everything else was ok.
2. Set up the DNS records on the DNS server to deal with the email.
I did the same exact thing with port 25, it took me hours to figure that out. I updated this manual a little to draw more attention to the fact you need to open port 25.
DeleteHello Patrick, thank you for the detailed explanation. I understand that this is outside the scope of alfresco. But could you mention how you setup the DNS records to deal with the email? I have tried a few approaches but have not been successful. Thank you
DeleteMake sure you have port 25 open on your system. Most home internet connections do not allow port 25. For example at my home I run an alfresco server but my ISP blocks port 25 so there is no way I can get e-mail into my home system. If this is your issue there is not much you can do. If not you just need to make sure your MX records are set up correctly.
DeleteI am going to do a new write up on installing Alfresco 4.2.d in the near future (1-2 months), I will make sure to add some notes on setting up an MX record on those notes so everyone can see it clearly
Can 587 work instead of 25 ? My alfresco server is on the cloud but 25 is blocked (other option is to request the cloud provider to open 25). I can open a connection via telnet to 587 though.
DeleteAlso, do we need to change the inboundSMTP.properties file ?
Thank you
This comment has been removed by the author.
ReplyDeleteYes Alfresco does have its own email server. I have not used a non standard port for email on alfresco. But if you want to you first need to change the "email.server.port=25" in the alfresco-global.properties to "email.server.port=3025". But I am guessing that is not your problem..... I am not a big expert on email, but email is email and it all tries to get sent to port 25. The easiest answer would be to have your firewall/router port forward, taking an incoming email on port 25 sent to alfresco.YOURCOMPANY.com and forward to your server on port 3025. But it sounds that in your case this is not an option.... You would need to use a go between a server that can accept port 25 and forward it to you on port 3025. A service like http://domainmx.net/ but even then you would need to have access to your DNS records so you could set your MX records to route emails to the outside service which would then forward to you.... Not a fun solution but it may be the only one available to you it needs to be routed through another machine (If any email expert could chime in on this subject and tell me I am wrong and there is an easier way please do!)
DeleteThanks, i spoke to our exchange team and they set up an smtp route from their serves to the alfresco server and forced it go on port 3025. That resolved my issue. Thanks a lot for your help.
Delete