Monday, September 16, 2013

Amazon EC2 and WebSphere Application Server

It's my first day using Amazon EC2 and it's incredibly easy to set up a server.  But there are some things you need to understand about how it assigns IP Addresses and Machine Names before you go about installing WebSphere Application Server.

A well known, and to many of us, confusing aspect of EC2 is that every time you reboot your server the hostname and IP address will change.   That's bad.  Or at least it's bad for WebSphere.

WebSphere embeds its hostname in its cell configuration.  If the hostname changes, the WebSphere cannot start.  In other words, WebSphere needs a static hostname.  So, we must find some way to work around this EC2 Feature.  Here's the steps I took.

First, I signed up for domain name server external to EC2.  I chose godaddy.com, but I've used others in the past.  After paying $2.99 for the name ibmbpmatwork.info for a year.

Then I got an EC2 account and set up a 64 bit RHEL server with about 20 GB.  Apparently that can still be a free micro server.  Opened ports for WebSphere 9080/9060/9043 and 9443, and  FTP (20, 21) and SSH(22) by creating an EC2 Security Group and assigning it to my image.  Then I opened the same ports on RHEL using the following command for each port I wanted open: sudo lokkit -p 20:tcp

Then I set up an Elastic IP or EIP, which is a fixed externally facing IP address.  An EIP *should* provide you with a static internal and external IP address that never change.

Then I went back to GoDaddy and set the IP address against the host name I just configured there.


Optional - I can set the hostname to my own naming convention by doing the following steps, otherwise I have to use the internal hostname that Amazon assigns:
Back in the RHEL image I added one line to the /etc/rc.local file that looked something like this
  /bin/hostname -F /etc/hostname
And I created a /etc/hostname file with the fully qualified name in it.

updated 11/15/2013-->
Alternatively you can just edit /etc/sysconfig/network and set HOSTNAME=my.hostname.com and then restart.  I was working with a client today and we could not make the rc.local approach work for some reason.  But changing the /etc/sysconfig/network file worked perfectly.
<<-

I checked to make sure the image could resolve my fully qualified host name.

After that, I want to restart and make sure the hostname got set properly.



Then I installed FTP by doing a sudo yum install vsftpd
and started it by calling sudo /etc/init.d/vsftpd restart

Next, I uploaded the WAS zip files to a downloads directory and unzipped them.  I also got the 32 bit Installation Manger v1.7 from the IBM site, unzipped it

Now, because I'm using WAS Express, which is 32 bit, I need to install some 32bit libraries into linux as explained here: http://www-01.ibm.com/support/docview.wss?uid=swg21459143

Next, I did a silent install using the sudo installc -acceptLicense -log log.xml command.

Then install WAS from /opt/IBM/InstallationManager/eclipse/tools, run the imcl command as sudo, pointing to the repository where I unzipped the WAS binaries.  Something like this:
sudo ./imcl install com.ibm.websphere.EXPRESS.v85_8.5.0.20120501_1108 -repositories /home/ec2-user/WAS/ -acceptLicense

Then just create a default profile from the bin directory:
[ec2-user@ec2demo2 bin]$ sudo ./manageprofiles.sh -create -profileName First -adminUserName admin -adminPassword admin -tempatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default -isDefault

And then start server1 from the bin directory of the profiles/First folder and wait for that to finish.

That should do it.





No comments:

Post a Comment