--- title: EC2にGlassFishをインストール tags: [] categories: ["Middleware", "AppServer", "GlassFish", "3"] date: 2013-02-09T10:42:18Z updated: 2013-02-09T10:42:18Z --- ### Install Java7 $ sudo yum install java-1.7.0-openjdk-devel $ sudo update-alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java 2 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java Enter to keep the current selection[+], or type selection number: 2 $ java -version java version "1.7.0_09-icedtea" ### Mount EBS $ sudo chown -R ec2-user /mnt $ mkdir /mnt/data $ sudo mkfs.ext4 /dev/xvdb $ sudo mount /dev/xvdb /mnt/data $ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 7.9G 1.1G 6.8G 14% / tmpfs 298M 0 298M 0% /dev/shm /dev/xvdb 30G 172M 28G 1% /mnt/data $ ln -s /mnt/data /opt/data ### Install GlassFish $ wget http://download.java.net/glassfish/3.1.2/release/glassfish-3.1.2.zip $ unzip glassfish-3.1.2.zip $ mv glassfish3 /opt/data/ $ cd /opt/data/glassfish3/bin/ $ ./asadmin Use "exit" to exit and "help" for online help. asadmin> start-domain Waiting for domain1 to start ........... Successfully started the domain : domain1 domain Location: /mnt/data/glassfish3/glassfish/domains/domain1 Log File: /mnt/data/glassfish3/glassfish/domains/domain1/logs/server.log Admin Port: 4848 Command start-domain executed successfully. asadmin> change-admin-password Enter admin user name [default: admin]> Enter admin password> Enter new admin password> Enter new admin password again> Authentication failed for user: admin (Usually, this means invalid user name and/or password) Command change-admin-password failed. asadmin> asadmin> change-admin-password Enter admin user name [default: admin]> Enter admin password> Enter new admin password> Enter new admin password again> Command change-admin-password executed successfully. asadmin> restart-domain Successfully restarted the domain Command restart-domain executed successfully. asadmin> exit Command multimode executed successfully. $ jps 32662 ASMain 32712 Jps ## Access Admin Console at client terminal $ ssh -L 4848:localhost:4848 -i xxx.pem ec2-user@xxx.xxx.xxx.xxx access [http://localhot:4848][1] [1]: http://localhot:4848