Friday 21 December 2012

Upgrading Alfresco 4.0 to 4.2

Very much like the Advice given to would be  couples wishing to married in the 1890's edition of Punch - don't.

Upgrading Alfresco is one of those things that doesn't get upgraded, instead its a new install. And its a bit of a pain. I have done three upgrades this week and now I think I have just about got it cracked. There is a lack of proper documentation and only advice from users that have done this. I needed to upgrade my OS at the same time, some I backed everything up, did a reinstall of the OS ( in my case SUSE 12.2) and then installed Alfresco from scratch, I put in he old database and then configured all the addins and a day later the machines was up and ready.
I am upgrading from the default installation of 4.0.e to 4.2.c version

Stop Alfresco server:  sh /opt/alfresco-4.0.e/alfresco.sh stop

Make a complete backup of alfresco installation:

root@alftest:~# cp /opt/alfresco-4.0.e /opt/alfresco-4.0.e.backup -R 

and then copy this to another machine

In /opt/alfresco-4.0.e/tomcat/shared/classes/alfresco-global.properties  switch off the solr indexing. This seems to be a vital part in getting the backup of the database to work

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
- Start and stop alfresco server
 sh /opt/alfresco-4.0.e/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.0.e/alfresco.sh stop
Start Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh start postgresql
- Dump (backup) the entire alfresco postgresql database.

su postgres
$ pg_dump -h localhost alfresco > /home/philip/Downloads/alfrescodbdump

$ exit
- Stop Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh stop postgresql
I
Install the new OS and add in the extra files and systems that might be needed
I added Chrome, teamviewer, filezilla, postgresql ( to get the extra commands needed)
I set up Samba, the Firewall and opened the ports, 25, 7070 and 8080
I made sure postfix was not running.
I then copied all the archived files back to /home/philip.Downloads

I then did a clean install of Alfresco, with all the defaults and checked that it was working ok. Having got over this hurdle everything was now much easier.


In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties  switch off the solr indexing. 

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
- Start and stop alfresco server
 sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.0.e/alfresco.sh stop
Start Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh start postgresql
- Drop new installation’s database, create the new one and restore the above backed up:
su postgres
$ dropdb alfresco -h localhost -i
Database "alfresco" will be permanently removed.
Are you sure? (y/n) y
Password:
$ createdb -T template0 alfresco -h localhost
Password:
$ psql alfresco -h localhost < /home/philip/Downloads/alfrescodbdump
Password:

Watch as the Database is loaded
$ exit
Stop new Alfresco postgresql:
sh /opt/alfresco-4.2.c/alfresco.sh stop postgresql

Copy over contentstre and contentstore.deleted. I used Dolphin in SU Mode

sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.2.c/alfresco.sh stop

Revert the indexing back to on (Solr):
In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties turn
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
Now make any modification (in configuration files, etc) to match your installation scheme. These have to be typed in since there are changes in the config file.
Start the server nd try it out
sh /opt/alfresco-4.2.c/alfresco.sh start

Wednesday 21 November 2012

Windows 7 network brother printer shows offline when it is online and working

I have a brother duplex network printer. From my main machine which is always  on I can see the printer - it says it is ready and I can print to it. All is well. But I also have a windows 7 laptop.

Now when the printer was re-installed it could see it for a couple a days. The overnight the laptop could see the printer as offline.
Now many of the fixes on the Net tell be about firewalls - no change here, changed IP addresses - not changed switching the printer to offline mode - ok now this works up to a point but if the printer is turned off.

So for the Solution
Re-install the printer. I had to on mine because it would not let me do this until I had.
Start -> Devices and Printers -> Double click on the new printer -> Customise Printer -> Ports -> Configure Port
SNMP Status Enabled Uncheck  then OK

The laptop occasionally sends a message to the printer asking it if it is there, via SNMP. If the laptop does not get a reply it assumes the printer is offline. Some how when the windows 7 machine goes off it loses the SNMP connection with the printer and can't find it again.

Wednesday 24 October 2012

Setting up DNS using Webmin




















Creating a Master Zone.
1) Click on "Create master zone"
2) Enter the domain into the "Domain name / network" box.
3) For the master server, type in the domain name as well.
4) You can check the "Create NS record" box if you'd like.
5) You can enter your email address in the appropriate box.
6) Type in the IP address of the server (The external IP address provided by your ISP).
7) Click "Create"




















Creating Address Records
1) Click on "Address"
2) type in the name of the machine and type in the IP address.
3) Click Save.



Creating an MX Record (Mail Exchange Record).
1) Click Mail Server (If you want a mail server)
[B](Make sure you put the period at the end; mail.domain.com.[/B]
2) For the name, type in the domain
3) For the mail server, type in mail.domain.com
4) Set the priority to what you like.. 10 is usually default. This is more of a concern if you are hosting a lot of domains.
5) Click "Return to Record Types"

Saturday 20 October 2012

Alfresco 4 Community Set up Email


Set Global Properties - Ubuntu

Copied from Patrick Bailey 

Alfresco requires some additional installs to work.  Alfresco out of the box uses a few other tools like OpenOffice and ImageMagick.


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.

Adding New Users as Admin



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.

Click on emailtest.  



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.