The two primary components of AEM are the author and publisher instances. Both can be downloaded from Adobe as either war or jar.
This guide is to setup a dual server non-production instance for testing or developing.
AEM comes in two flavours: self hosted or cloud SDK. Both of these have a quickstart jar file and both can be used in this guide. The differences are:
- self hosted requires a license file. Cloud SDK does not.
- self hosted comes with a default WKND website and replication by default. Self hosted requires setting this up if required.
Step 1: install java on your local machine.
Skip this step if you already have the license.properties file, or you are using the cloud SDK, or you already have java installed.
In theory you should have oracle java jre version 11 to create the license file. However, it will work with oracle java 8 also. It may or may not work with non oracle java.
To test your local installation, open a terminal window or command prompt and type “java -version”.
Step 2: get hold of jars and generate license file.
This is the hardest step, unless you happen to be a premium Adobe partner. You will need to write to Adobe with a business case for being allowed to setup a dev environment in order to learn AEM basics. They will send you a link to the jar file, along with a key.
Once you have the quickstart jar (e.g. AEM_6.5_Quickstart.jar), you need to run it locally as is on your local windows, mac or linux machine. Do this by double clicking on it. It will take some minutes to startup, then will prompt you for your key. It will then generate a license.properties file in the same dir as the jar.
Note, running the jar will create a directory called crx-quickstart, which will be around 2GB. Delete this when you are finished.
Step 3: provision 2 VMs in Azure.
One will be for author and one for publish, but you can also put them on the same box and give it more ram.
- login to your subscription (or create a free one) at https://portal.azure.com/
- Create “new” resource
- Search the marketplace for ubuntu
- select “Ubutu Server 20.0.4 LTS” from canonical or your preferred distro and version.
- create a new resource group or use an existing one (just for reporting)
- give it a name like “author1” and “publish1”
- Chose a cheap region close to you. Some regions are twice the price of others. See https://azureprice.net/Region for price comparison.
- leave availability zone default
- For spot instance I go with no if you want it available any time.
- for size the cheapest viable server is B2s with 2 vCPU and 4GB ram at £25/m. B instances are for servers which are idle most of the time, i.e. when no devs are using the served pages.
- For administration type I would always select SSH public key over password.
- chose your username (same one for both boxes). Dont use a generic name such as “admin” or a first name such as “bob” or “david”, these are too easily guessed.
- if you dont have an SSH key handy, you can let it generate the pair for the first box, the re-used the generated one for the second.
- Inbound port rules: Unless you have a fixed IP VPN, or a VLAN, you will probably want to open SSH (22) to the world so you can administer the box. We can change the ports later. Note: this is using Azure firewall, not Ubuntu’s firewall.
- select standard SSD with default encryption.
- Hit “create and attach a new disk”
- default name
- source type = None
- select Standard SSD (again), 32GB or more, hit ok.
- choose same or new virtual network.
- default subnet
- new public ip for each
- NIC security group: basic
- inbound ports: SSH (22)
- accelerated networking / load balancing not applicable.
- Management (leave all default)
- Advanced. you can choose Gen 2 (EFI), but Gen 1 is arguably more common.
- Tags. Add tags you like, e.g. who created it, what its for, when it should be killed etc.
- Hit Create!
Step 4: setup DNS (optional)
You will now have 2 IPs allocated by Azure for your two VMS. These are shown in Azure in the info page for the VM.
If you own a domain, you can now create two A records such as author.yourdomain.com and publish.yourdomain.com with those ips.
Step 5: import the key.
If you are on windows, and you allowed Azure to generate they keys, you need load the key you downloaded into puttygen and convert it into a ppk private key, then load this key into pageant.
Create a new putty profile with host name of firstname.lastname@example.org or yourname@yourserversIP and one for author following the same pattern.
Linux / Mac
If you have linux or mac, you need to copy the private key file int tour ~/.ssh/id_rsa file and make sure it has the right permissions. There are many guilds on this process.
Step 6: download java
Go to https://www.oracle.com/java/technologies/javase-jdk11-downloads.html and download the deb package for linux x64 (the tar.gz would also work). You have to accept license etc. Don’t install openJDK, which is easy but is not supported by Adobe, If you try it and it works let me know.
Step 7: upload everything to both servers.
You will need to upload the java deb package (or tar.gz), the quickstart Jar and license.properties (if using the non cloud sdk)
The easiest way to do this using filezilla. create a new filezilla profile with the following settings:
Host: your server DNS name or ip
login type: Key File
user: your user name you entered in Azure host config
Key file: select the ppk (windows) or private key rsa/pem file (linux/macos)
open the new site and you should see the home directory of your user. Upload the 3 files to both your servers.
Step 8: Setup java on your new instance(s)
ssh into each of your new servers, and do the following:
- $ sudo apt-get update
- $ sudo apt-get dist-upgrade -y
- reboot if necessary.
- sudo dpkg -i jdk-11.0.9_linux-x64_bin.deb
- either edit /etc/profile (to setup java for all users) or specific users ~/.profile and add the following at the end (change the path to match your java version:
- export JAVA_HOME=”/usr/lib/jvm/jdk-11.0.9/”
- open a new shell and test java with “java -version” and you should see something like this:
java version “11.0.9” 2020-10-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)
Step 9: setup and run AEM
- create a new user (you can also create it the regular way with just “sudo adduser aem”)
- $ adduser –disabled-password –gecos “” –shell /bin/bash
- switch to new user:
- sudo su – aem
- If you didnt add java paths to the global /etc/profile then you need to add it to this users /home/aem/.profile
- copy jar and license to aem:
- $ mkdir author (publish on second server)
- $ cd author (publish on second server)
- $ cp /home/youruser/AEM*.jar .
- $ cp /home/youruser/*.properties .
- rename the jar. Note: some guides say it should start with “aem”, some say it should start “cqx” where x is a number.
- mv AEM_6.5_Quickstart.jar aem-author-p4502.jar (on author server)
- mv AEM_6.5_Quickstart.jar aem-publish-p4503.jar (on publish server)
- In theory, you should now be able to run the jar with this:
- $ java -XX:MaxPermSize=256m -Xmx2048M -jar aem-author-p4502.jar
- $ java -XX:MaxPermSize=256m -Xmx2048M -jar aem-publish-p4503.jar
- you can also change the port and start in background:
- $ nohup java -XX:MaxPermSize=256m -Xmx2048M -jar aem-author-p8080.jar &
- $ nohup java -XX:MaxPermSize=256m -Xmx2048M -jar aem-publish-p8080.jar &
- check what is happening:
- $ tail -f /home/aem/publish/crx-quickstart/logs/error.log
- $ tail -f /home/aem/publish/crx-quickstart/logs/stdout.log
Alternative method to run the jar.
There are several scenarios where running the jar fails, but unpacking and running the start script works.
- $ java -jar *.jar -unpack
- $ /home/aem/publish/crx-quickstart/bin/start
Step 10: view the console/site
You have three options:
- open up ports 4502/4503 to the world on the author and publisher Azure firewall respectively (insecure)
- open the above ports but only to your fixed IP (secure)
- use a ssh tunnel (secure)
By default, both author and publisher do not have SSL, and only run http, not https. So any passwords are visible. A later article will look at how to enable SSL and port 443.
Below are example settings for opening port 4502 (author) and 4503 (publisher) to world:
If you want to open the ports only to your local machine, you can use a ssh tunnel. In putty it will look like this:
Here I am mapping the remote port 4502 to 4512 on my local machine.
Do the same for the other server on 4503
However, replication will not work unless you setup a rule to allow this between servers via Azure firewall, or use the vlan ip if you put both servers on the same vlan.
- configure SSL in both instances, and run them on port 443.
- turn the start/stop script into services which start on boot.
- setup and test replication between author and publisher.
- setup monitoring to alert you if either goes down.