GlassFishのインストール
以下の手順でインストールします。
①/optに移動。
②wgetでGlassfishをダウンロード。
③ダウンロードしたzipを解凍。
## ① /optに移動。
[root@localhost ~]# cd /opt
## ② wgetでGlassfishをダウンロード。
[root@localhost opt]# wget http://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip
--2020-09-05 22:12:42-- http://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip
download.oracle.com (download.oracle.com) をDNSに問いあわせています... 23.217.124.4
download.oracle.com (download.oracle.com)|23.217.124.4|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 301 Moved Permanently
場所: https://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip [ 続く]
--2020-09-05 22:12:42-- https://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip
download.oracle.com (download.oracle.com)|23.217.124.4|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 117592534 (112M) [application/zip]
`glassfish-5.0.1.zip' に保存中
100%[======================================>] 117,592,534 7.04MB/s 時間 19s
2020-09-05 22:13:01 (5.85 MB/s) - `glassfish-5.0.1.zip' へ保存完了 [117592534/117592534]
## ③ ダウンロードしたzipを解凍。
[root@localhost opt]# unzip glassfish-5.0.1.zip
Archive: glassfish-5.0.1.zip
creating: glassfish5/
:
:
[root@localhost opt]# ll
合計 114840
-rw-r--r--. 1 root root 117592534 1月 16 2019 glassfish-5.0.1.zip
drwxr-xr-x. 6 root root 76 1月 15 2019 glassfish5
drwxr-xr-x. 2 root root 6 10月 31 2018 rh
Glassfishを配置できたら、次に以下の手順で設定を行います。
①Glassfishサーバーの起動
②管理者パスワード設定
③ログインストアにパスワードを登録
## ① Glassfishの起動
[root@localhost bin]# pwd
/opt/glassfish5/bin
[root@localhost bin]# ll
合計 8
-rwxr-x---. 1 root root 2233 1月 15 2019 asadmin
-rwxr-x---. 1 root root 2496 1月 15 2019 asadmin.bat
[root@localhost bin]# ./asadmin start-domain
Waiting for domain1 to start .........
Successfully started the domain : domain1
domain Location: /opt/glassfish5/glassfish/domains/domain1
Log File: /opt/glassfish5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
## ② 管理者パスワードの設定
[root@localhost bin]# ./asadmin change-admin-password
Enter admin user name [default: admin]> ←空白でEnter
Enter the admin password> ←空白でEnter
Enter the new admin password> ←新パスワードを設定
Enter the new admin password again> ←新パスワードを設定
Command change-admin-password executed successfully.
## ③ ログインストアにパスワードを登録
[root@localhost bin]# ./asadmin login
Enter admin user name [Enter to accept default]> admin
Enter admin password>
Login information relevant to admin user name [admin] for host [localhost] and admin port [4848] stored at [/root/.gfclient/pass] successfully.
Make sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain.
Command login executed successfully.
ようやくGlassfishが起動しました。
CentOS内でFirefoxを起動して、http://localhost:4848にアクセスすると以下の、管理者用の画面を表示することができます。
先ほど設定した、「admin」のパスワードを使ってログインします。

初回は少し待機する画面が表示されますね。
起動ユーザーの作成をしておきましょう。
## Glassfishの停止
[root@localhost bin]# ./asadmin stop-domain
Waiting for the domain to stop .
Command stop-domain executed successfully.
## glassfishユーザーの作成
[root@localhost bin]# adduser glassfish
## Glassfishディレクトリ以下の所有者をglassfishに変更
[root@localhost bin]# chown -R glassfish:glassfish /opt/glassfish5
## ユーザーをglassfishに変更。
[root@localhost bin]# su glassfish
## glassfishでGlassfishを起動。
[glassfish@localhost bin]$ ./asadmin start-domain
Waiting for domain1 to start .......
Successfully started the domain : domain1
domain Location: /opt/glassfish5/glassfish/domains/domain1
Log File: /opt/glassfish5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Glassfish構築にかかわる部分はこれで終わりです。
CentOS7とJavaの性能検証用環境の構築
ABOUT ME