Running Glassfish as a service on CentOS

Here is how you run glassfish as a service on CentOS:

  1. Create a user glassfish (you can call it anything you want) under which Glassfish will run.
    #useradd glassfish
  2. Install glassfish in /home/glassfish.
  3. Create the startup script /etc/init.d/glassfish for glassfish.
    Could not embed GitHub Gist 1124441: API rate limit exceeded for 103.115.8.6. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
  4. Install the service
    #chmod +x /etc/init.d/glassfish
    #chkconfig --add glassfish
    #chkconfig --level 3 glassfish on
  5. Start glassfish.
    #/etc/init.d/glassfish start