EC2 Installation with Amazon's Linux AMI - Documentation topics on: amazon,centos,ec2,install,linux,.

EC2 Installation with Amazon's Linux AMI

This document provides instructions and scripts to install dotCMS from Source on Amazon's Linux AMI (based on CentOs) on EC2.


These instructions assume use of the following:

  • Server OS: Linux
  • AMI: Latest Linux AMI running on Amazon EC2
  • Java: Open JDK (not suggested for production)
  • Database: MySQL
  • dotCMS: Version 3.2.x or higher


1. Start up a new Amazon Linux AMI (Amazon Machine Image)

Example: Amazon Linux AMI 2015.09.1 (HVM)

2. Choose an Amazon Instance Type with appropriate memory and disk space

Memory Size:

  • Recommended Memory: 7.5GB or more.
  • Minimum Memory: 3.75GB
  • For more information on dotCMS memory usage, see the Memory Configuration documentation.

Disk Space:

  • Recommended Disk Space: 20GB or higher for a better testing/development experience.
    • Examples: Amazon m3 instance types with additional storage selected, or Amazon m4 or t2.
  • Minimum Disk Space: 8GB.
    • Note: If using the Amazon m3.medium instance type, additional disk space must be added to reach the 8GB minimum.

3. Place the box in a Security Zone that allows for access to port 22 and 80

4. Connect to the server using ssh.

ssh -i ~/keys/your-key.pem ec2-user@{}


5. Run the following commands (manually or via a script).


  • Several of the below commands require replacement of portions of the command with appropriate text (such as replacing 'some_password' when creating the MySQL database).
    • Make sure you read and understand each command before executing it.
  • These commands assume dotCMS version 3.2.4.
    • If you use a different dotCMS version, update the version numbers and file names (for dotCMS, Tomcat, and other parameters and folders) appropriately.  
sudo -i
yum update

### Install MySQL
yum install -y mysql55-server.x86_64

### Start MySQL and create the database, database user, and password
#      *** IMPORTANT ***
#      Replace "some_password" in the below command with your own
#      secure database password (but leave it enclosed in single quotes)
/etc/init.d/mysqld start

  CREATE USER 'dotcms2'@'localhost' IDENTIFIED BY 'some_password';
  CREATE USER 'dotcms2'@'' IDENTIFIED BY 'some_password';
  CREATE DATABASE dotcms2 default character set = utf8 default collate = utf8_general_ci;

### Create Parent Directory
mkdir -p /opt/dotcms/wwwroot/

cd /opt/dotcms/wwwroot/

mkdir dotcms-3.2.4
cd dotcms-3.2.4

### Get the dotCMS source zip for desired stable release version
cd ../

ln -s /opt/dotcms/wwwroot/dotcms-3.2.4 /opt/dotcms/wwwroot/current
cd current/dotserver/

### Change the /bin scripts permissions, add execution permission to *.sh in the bin directory
chmod 755 ./bin/*.sh
chmod 755 ./dotserver/tomcat-8.0.18/bin/*.sh

### Create ROOT Plugin Configuration Directories
#      *** IMPORTANT ***  Never directly edit dotCMS files as this will break on upgrade
mkdir -p plugins/com.dotcms.config/ROOT/dotserver/tomcat-8.0.18/webapps/ROOT/META-INF/
mkdir -p plugins/com.dotcms.config/ROOT/dotserver/tomcat-8.0.18/conf/
mkdir -p plugins/com.dotcms.config/ROOT/bin
cp /dotserver/tomcat-8.0.18/webapps/ROOT/META-INF/context.xml plugins/com.dotcms.config/ROOT/dotserver/tomcat-8.0.18/webapps/ROOT/META-INF/

### Copy to the dotCMS root plugin
cp bin/ plugins/com.dotcms.config/ROOT/bin

### OPTIONAL: Copy the server xml and configure ports for the dotCMS application
cp /dotserver/tomcat-8.0.18/conf/server.xml plugins/com.dotcms.config/ROOT/dotserver/tomcat-8.0.18/conf/

### Then edit the server.xml file in your plugins directory
#      * Change the port on this line:
#           <Connector maxThreads="75" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
vi plugins/com.dotcms.config/ROOT/dotserver/tomcat-8.0.18/conf/server.xml

### Configure the db connection and dotCMS db name and password
#      1. Comment out the H2 and postgresql db
#      2. UNCOMMENT the mysql db
#      3. Change username to dotcms
#      4. Change password (this must match what you entered for
#            'some_password' in the MySQL configuration, above)
vi plugins/com.dotcms.config/ROOT/dotserver/tomcatX.xx/webapps/ROOT/META-INF/context.xml

### Change -Xmx for better heap size (recommend min 2 Gb for testing)
#     Edit the line in the file to look like this:
#        JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xverify:none -Dfile.encoding=UTF8 -server -Xmx1G -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -javaagent:dotCMS/WEB-INF/lib/jamm-0.2.5.jar"
vi plugins/com.dotcms.config/ROOT/bin/

### Deploy configuration plugin changes

### Start up dotcms & Tail the dotcms.log file
touch  /dotserver/tomcat-8.0.18/logs/dotcms.log
./bin/ && tail -f /dotserver/tomcat-8.0.18/webapps/ROOT/dotsecure/logs/dotcms.log


The server will build the database automatically and show its progress in the log files (this may take five minutes or more).

You will know that the server started up correctly when you see messages similar to the following in the log file:

[21/09/12 20:08:54:325 UTC]  INFO http11.Http11AprProtocol: Starting Coyote HTTP/1.1 on http-80
[21/09/12 20:08:54:338 UTC]  INFO startup.Catalina: Server startup in 165375 ms
[21/09/12 20:08:58:996 UTC]  INFO reindex.ReindexThread: Reindex Thread started with a sleep of 500