Installing Alfresco with MySQL

Posted on

Operating System : CentOS 7

Software : Alfresco Community Edition

As we already knew, Alfresco is a software which is made as a solution for Enterprise Content Management (ECM) and Business Process Management (BPM).

Alfresco come with a community edition which can be downloaded and installed in our own workstation. Below is the installation step which is explaining on how to install Alfresco with an advanced installation type. We will divide it into three general steps which is the pre-installation step, the installation step itself and the last step which is actually the most important step is the post-installation step.

Pre-Installation Step :

Install your own Java Runtime Environment (JRE). Luckily I have already installed and it can be checked by executing the following command on the bash prompt :

java -version

Here below is the output of executing the above command :

java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
[root@hostname]# 

The installed Java Runtime Environment (JRE) is needed to run Apache Tomcat Webserver. Alfresco’s execution process relies on it.

Installation Step :

1. Download Alfresco community version installer. It can be found and downloaded when this article is created at 2nd September 2016 in the following URL : https://www.alfresco.com/products/community/download

2. Run the Alfresco community version by typing the following command in the bash prompt :

./alfresco_community_edition_file_installer_name.bin
[root@username opt]# ./alfresco-community-installer-201605-linux-x64.bin
Some or all of the libraries needed to support LibreOffice were not found on your system: fontconfig libSM libICE libXrender libXextlibcups libGLU
You are strongly advised to stop this installation and install the libraries.
For more information, see the LibreOffice documentation at http://docs.alfresco.com

Do you want to continue with the installation? [y/N]: y

Choose and type ‘y’ if the installation want to be proceeded.

3. The next screen will be shown as follow which is the step of choosing language for installation :

Language Selection

Please select the installation language
[1] English - English
[2] French - Français
[3] Spanish - Español
[4] Italian - Italiano
[5] German - Deutsch
[6] Japanese - 日本語
[7] Dutch - Nederlands
[8] Russian - Русский
[9] Simplified Chinese - 简体中文
[10] Norwegian - Norsk bokmål
[11] Brazilian Portuguese - Português Brasileiro
Please choose an option [1] : 1

Please choose according your preference. In this step, I choose the first option to proceed installing Alfresco with English language.

4. The next step is to choose the installation type. Since this installation is going to be done by installing several prerequisite or requirements to be fulfilled manually such as Java Runtime Environment and MySQL database to be used as the database for Alfresco instead of PostgreSQL, choose Advanced type as shown below :

-----------------------------------------------------------------------
Welcome to the Alfresco Community Setup Wizard.
-----------------------------------------------------------------------
Installation Type

[1] Easy - Install using the default configuration.
[2] Advanced - Configure server ports and service properties.: Choose optional components to install.
Please choose an option [1] : 2

Choose and type ‘2’ to install Alfresco in Advanced Installation Type. In the next installation step there will be lots of question concerning Alfresco Installation.

-----------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

Java [Y/n] :n

Choose and type ‘n’ since we want to use the available Java Runtime Environment (JRE) installed previously in our server or workstation. Supposed if we do not want to use the default JRE bundled with Alfresco installation.

PostgreSQL [Y/n] :n

The next option is about PostgreSQL installation, choose and type ‘n’ since we want to use another database type in this article context, MySQL database. The other option shown followed will be inserted as follow without any further modification.

LibreOffice [Y/n] :Y

Alfresco Community : Y (Cannot be edited)

Solr1 [y/N] : N

Solr4 [Y/n] :Y

Alfresco Office Services [Y/n] :Y

Web Quick Start [y/N] : y

Google Docs Integration [Y/n] :Y
Is the selection above correct? [Y/n]: Y

5. Choose installation folder. In this installation context, it is installed in the following path : /opt/alfresco-community. It is shown as follows :

----------------------------------------------------------
Installation Folder

Choose a folder to install Alfresco Community.

Select a folder: [/opt/alfresco-community]:

----------------------------------------------------------

6. The next step is the Alfresco Database Configuration. Since we don’t use PostgreSQL just type ‘enter’ and don’t type anything.

Database Configuration

JDBC URL: [jdbc:postgresql://localhost/alfresco]:

JDBC Driver: [org.postgresql.Driver]:

Database name: [alfresco]:

Username: []:

Password: :
Verify: :

7. After configuring database the next step is for Tomcat Port Configuration. It is an important step since Alfresco is running with the help of Apache Tomcat Webserver. Make sure to not messed up in this step because if it is wrong or failed, Alfresco’s URL address cannot be accessed through web browser since Apache Tomcat Webserver is the one which processed the request  :

----------------------------------------------------------
Tomcat Port Configuration
Enter your Tomcat configuration parameters. 
Web Server Domain: [127.0.0.1]: 
Tomcat Server Port: [8080]: 
Tomcat Shutdown Port: [8005]: 
Tomcat SSL Port: [8443]: 
Tomcat AJP Port: [8009]:

Just type enter to choose the default value unless we want to modify it according to our current server, workstation or host environment where Alfresco is going to be installed.

8. Configure the LibreOffice Server Port. Just choose the default value of installation.

-----------------------------------------------------------------------
LibreOffice Server Port

Enter the port that the LibreOffice Server will listen to.

LibreOffice Server Port: [8100]:

-----------------------------------------------------------------------
Alfresco FTP Port

Choose a port number for the integrated Alfresco FTP server.

Port: [21]:

9. Set an admin password to enter Alfresco as shown below :

-----------------------------------------------------------------------
Admin Password

Specify a password for the Alfresco administrator account.

Admin Password: :
Repeat Password: :

10. Set Alfresco to be run as a service as shown in the following installation step :

-----------------------------------------------------------------------
Install as a service

If you register Alfresco Community as a service it will automatically start
Alfresco Community on machine startup.

Install Alfresco Community as a service? [Y/n]: Y

11. There will be a warning shown below after finishing the above step and several option to be followed then finally finishing the Alfresco installation :

-----------------------------------------------------------------------
Warning

This environment is not configured optimally for Alfresco - review this list
before continuing.

While these issues won’t prevent Alfresco from functioning, some product
features might not be available, or the system might not perform optimally.

SMTP TCP port in use
: 25

Press [Enter] to continue:

-----------------------------------------------------------------------
Please wait while Setup installs Alfresco Community on your computer.

Installing
0% ______________ 50% ______________ 100%
#########################################

-----------------------------------------------------------------------
Setup has finished installing Alfresco Community on your computer.

View Readme File [Y/n]: Y

Launch Alfresco Community [Y/n]: Y

Using CATALINA_BASE: /opt/alfresco-community/tomcat
Using CATALINA_HOME: /opt/alfresco-community/tomcat
Using CATALINA_TMPDIR: /opt/alfresco-community/tomcat/temp
Using JRE_HOME: /opt/jdk1.8.0_102
Using CLASSPATH: /opt/alfresco-community/tomcat/bin/bootstrap.jar:/opt/alfresco-community/tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /opt/alfresco-community/tomcat/temp/catalina.pid
Tomcat started.
/opt/alfresco-community/tomcat/scripts/ctl.sh : tomcat started
README
Alfresco Community (Build: 201605)
===============================

Contains:
- Alfresco Platform: 5.1.g
- Alfresco Share: 5.1.f

See the Alfresco Wiki (https://wiki.alfresco.com) for release notes and detailed
information on this release.

Press [Enter] to continue:
[root@compute opt]# 


Post-Installation Step :

If you think after successfully installing Alfresco in the Advanced Type Installation as shown above the process is already over and you can just directly use Alfresco normally, well it is a ‘wishful thinking’. To make your wish become real,  another Post-Installation step is needed to access Alfresco normally. After finishing the installation step, do the following step below :

1. As we can check within the log file generated by Apache Tomcat Webserver which is called catalina.out :

2016-07-27 15:23:02,346 WARN [hibernate.cfg.SettingsFactory] [localhost-startStop-1] Could not obtain connection metadata org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2079) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1304) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)

It can be concluded from the above log output specifically the following log display :

Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)

Apache Tomcat Webserver cannot connect to PostgreSQL database server indicated from the host and port specified :

Connection to localhost:5432 refused

Since, we didn’t configure the connection from Alfresco to PostgreSQL database server, Alfresco cannot connect to the specified PostgreSQL database to be used. Therefore, since it has been decided to use MySQL database to be connected from Alfresco, the step is informed as follows :

1. Download MySQL connector which is going to be used by Apache Tomcat Webserver to connect from Alfresco to MySQL database server. As this article created in 5th September 2016, it can still be downloaded from the following URL : https://dev.mysql.com/downloads/connector.

2. Extract the already downloaded zip file MySQL connector and try to find jar file of the MySQL connector. For an example in my context, I used unzip command from the bash prompt since I downloaded zip file format :

user@hostname:~$ unzip mysql-connector-java-5.1.39.zip
Archive: mysql-connector-java-5.1.39.zip
inflating: mysql-connector-java-5.1.39/CHANGES
inflating: mysql-connector-java-5.1.39/COPYING
inflating: mysql-connector-java-5.1.39/README
inflating: mysql-connector-java-5.1.39/README.txt
inflating: mysql-connector-java-5.1.39/build.xml
...
...
...
inflating: mysql-connector-java-5.1.39/src/testsuite/ssl-test-certs/mykey.pub
inflating: mysql-connector-java-5.1.39/src/testsuite/ssl-test-certs/server-cert.pem
inflating: mysql-connector-java-5.1.39/src/testsuite/ssl-test-certs/server-key.pem
inflating: mysql-connector-java-5.1.39/src/testsuite/ssl-test-certs/server-req.pem
inflating: mysql-connector-java-5.1.39/src/testsuite/ssl-test-certs/test-cert-store
user@hostname:~$

3. Find mysql-connector-java-5.1.39-bin.jar in my context since I downloaded that version so it can be different with the version you have. It is normally located in the root folder of the extracted files. Copy the file specified in the 3rd step to tomcat library folder of jar files. In my context, it is located in /opt/alfresco-community/tomcat/lib. It can be done by executing the following command :

user@hostname:~# cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /opt/alfresco-community/tomcat/lib/
user@hostname:~#

4. Edit the following Alfresco configuration file so that Alfresco can use MySQL database server for its daily operation. The file located in /opt/alfresco-community/tomcat/shared/classes. The file name is alfresco-global.properties. Edit it and add the following snippet code of configuration :

user@hostname:~# cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /opt/alfresco-community/tomcat/lib/
user@hostname:~#

[user@hostname:~]# cd /opt/alfresco-community/ 
[user@hostname:~]# pwd 
/opt/alfresco-community 
[user@hostname:~]# vim tomcat/shared/classes/alfresco-global.properties

Add the following lines and adjust it with the MySQL database server installed and the one which is going to be utilized by Alfresco :

### MySQL database connection properties ###
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost:3306/alfresco_community?useUnicode=yes&characterEncoding=UTF-8
db.username=alfresco
db.password=alfresco_password
db.host=localhost
db.port=3306
db.pool.max=275

5. Shutdown Alfresco process and start it again  by doing the command as follows :

./alfresco stop
./alfresco start

2 thoughts on “Installing Alfresco with MySQL

  1. Hi ,

    I am trying to install alfresco multiple instances with single MYSQl database server.I am getting context integration error

    Please guide me to install alfresco with same already existing schema.

    Thanks,
    Kumar.

    1. I haven’t try it once before. Assuming that you are trying to install several alfresco services within several different servers but only using ONE MySQL Database Server, in my opinion, you just edit the alfresco-global.properties located in the alfresco deployment folder inside Apache Tomcat Webserver. Point out the entry and change it to the location of the server which is serving as MySQL Database Server for alfresco, for instance : host=192.168.x.x

Leave a Reply