{"id":17527,"date":"2015-08-26T11:57:47","date_gmt":"2015-08-26T16:57:47","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=17527"},"modified":"2022-12-15T09:52:54","modified_gmt":"2022-12-15T15:52:54","slug":"install-glassfish-4-on-a-debian-8-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-glassfish-4-on-a-debian-8-vps\/","title":{"rendered":"Install Glassfish 4 on a Debian 8 VPS"},"content":{"rendered":"
In this article we will cover the steps needed for installing a fully functional Glassfish server on a Linux VPS<\/a>, specifically a Debian 8 VPS<\/a>. This guide should work on other Debian <\/span>systems as well but was tested and written for a Debian 8 (Jessie) OS.<\/p>\n <\/p>\n Let’s reassure that we have the proper version of Debian installed on our server :<\/p>\n REQUIREMENTS<\/strong><\/p>\n We will be using our SSD 1 Linux VPS<\/a> Hosting plan for this tutorial.<\/p>\n UPDATE THE SYSTEM<\/strong><\/p>\n Make sure your server is fully up to date. Also, install wget and unzip:<\/p>\n INSTALL ORACLE JAVA 8<\/strong><\/p>\n Your first step is to add the webupd8team Java PPA repository in your Debian system. Then you will be able to install Oracle Java 8. Issue the following commands:<\/p>\n Update the package index and install Java 8:<\/p>\n Check if Java has been properly installed:<\/p>\n You should receive the following output:<\/p>\n INSTALL GLASSFISH<\/strong><\/p>\n We will now download and install Glassfish into the \/opt<\/strong> <\/em>directory.\u00a0When this tutorial was written the latest Glassfish\u00a0version was 4.1. Then we will create a user that will start the service because running Glassfish under root is not recommended.<\/p>\n The below commands will complete the above mentioned procedure:<\/p>\n You would want to ease the starting\/stopping\/restarting of your Glassfish server. Therefore, let’s create an init script. We will create a ‘glassfish’ file in the ‘\/etc\/init.d’ directory:<\/p>\n Paste the following lines:<\/p>\n Make the script executable:<\/p>\n Make the Glassfish server to start on boot up:<\/p>\n You can now start Glassfish:<\/p>\n The default GlassFish port numbers are:<\/p>\n So, open your favorite web browser and navigate to http:\/\/your_server_ip:4848<\/strong><\/p>\n You will be welcomed by the Glassfish administration window, but there is an ‘Secure Admin must be enabled to access the DAS remotely’<\/strong><\/em> error. You can solve this by following the next steps:<\/p>\n Enter the bin directory:<\/p>\n Make the asadmin script executable:<\/p>\n Enter the following command:<\/p>\n You will receive the below error:<\/p>\n So, to solve this change the admin password:<\/p>\n Now run this command again:<\/p>\n You will get the following output:<\/p>\n As the message says, you should restart Glassfish:<\/p>\n Refresh your browser or open http:\/\/your_server_ip:4848<\/strong> with a new one and log in using the admin user and password you’ve just configured.<\/p>\n Congratulations, you have successfully installed Glassfish 4.1 on your Debian 8 VPS<\/a>.<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install Glassfish for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS.<\/span> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this article we will cover the steps needed for installing a fully functional Glassfish server on a Linux VPS, … <\/p>\n
\nGlassFish is a free open source application server for the Java EE platform. With this application the developers can develop and deploy portable and scalable enterprise Java applications.<\/p>\nLogin to your server via SSH<\/h4>\n
ssh root@server_ip<\/pre>\n
# lsb_release -a<\/pre>\n
Distributor ID: Debian\r\nDescription: Debian GNU\/Linux 8.1 (jessie)\r\nRelease: 8.1\r\nCodename: jessie<\/pre>\n
# apt-get update && apt-get upgrade\r\n\r\n# apt-get install unzip wget<\/pre>\n
# echo \"deb http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main\" | tee \/etc\/apt\/sources.list.d\/webupd8team-java.list\r\n\r\n# echo \"deb-src http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main\" | tee -a \/etc\/apt\/sources.list.d\/webupd8team-java.list\r\n\r\n# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886<\/pre>\n
# apt-get update\r\n\r\n# apt-get install oracle-java8-installer<\/pre>\n
# java -version<\/pre>\n
java version \"1.8.0_51\"\r\nJava(TM) SE Runtime Environment (build 1.8.0_51-b16)\r\nJava HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)<\/pre>\n
# cd \/opt\r\n\r\n# wget http:\/\/download.java.net\/glassfish\/4.1\/release\/glassfish-4.1-web.zip\r\n\r\n# unzip glassfish-4.1-web.zip\r\n\r\n# useradd glassfish\r\n\r\n# chown -R glassfish:glassfish \/opt\/glassfish4<\/pre>\n
# vim \/etc\/init.d\/glassfish<\/pre>\n
#!\/bin\/bash\r\n#\r\n# description: Startup script for Glassfish Application Server\r\n# processname: glassfish\r\n\r\nGLASSFISH_HOME=\/opt\/glassfish4\/\r\nexport GLASSFISH_HOME\r\nGLASSFISH_USER=glassfish\r\nexport GLASSFISH_USER\r\n\r\nstart() {\r\necho -n \"Starting Glassfish: \"\r\nsu $GLASSFISH_USER -c \"$GLASSFISH_HOME\/bin\/asadmin start-domain domain1\"\r\nsleep 2\r\necho \"done\"\r\n}\r\n\r\nstop() {\r\necho -n \"Stopping Glassfish: \"\r\nsu $GLASSFISH_USER -c \"$GLASSFISH_HOME\/bin\/asadmin stop-domain domain1\"\r\necho \"done\"\r\n}\r\n\r\ncase \"$1\" in\r\nstart)\r\nstart\r\n;;\r\nstop)\r\nstop\r\n;;\r\nrestart)\r\nstop\r\nstart\r\n;;\r\n*)\r\necho $\"Usage: glassfish {start|stop|restart}\"\r\nexit\r\nesac<\/pre>\n
# chmod a+x \/etc\/init.d\/glassfish<\/pre>\n
# update-rc.d glassfish defaults<\/pre>\n
# \/etc\/init.d\/glassfish start<\/pre>\n
Administration: http:\/\/your_server_ip:4848\r\nHTTP listener: http:\/\/your_server_ip:8080\r\nHTTPS listener: http:\/\/your_server_ip:8181<\/pre>\n
# cd \/opt\/glassfish4\/bin<\/pre>\n
# chmod +x asadmin<\/pre>\n
# .\/asadmin --host your_server_IP --port 4848 enable-secure-admin<\/pre>\n
remote failure: At least one admin user has an empty password, which secure admin does not permit. Use the change-admin-password command or the admin console to create non-empty passwords for admin accounts.\r\nCommand enable-secure-admin failed.<\/pre>\n
# .\/asadmin --port 15123 change-admin-password\r\n\r\nEnter admin user name [default: admin]> Press enter\r\n\r\nEnter the admin password> Press enter\r\n\r\nEnter the new admin password> Enter your new password\r\n\r\nEnter the new admin password again> Enter the new password again<\/pre>\n
# .\/asadmin --host your_server_IP --port 4848 enable-secure-admin<\/pre>\n
You must restart all running servers for the change in secure admin to take effect.\r\nCommand enable-secure-admin executed successfully.<\/pre>\n
# \/etc\/init.d\/glassfish restart<\/pre>\n