How to deploy Java application to production server

After playing around with server side development (see my posts about it: post1, post2 and post3) I feel like I could develop back-end if I really needed to. Of course it would take a lot of time and I’d be googling a lot, but at least back-end development is not a mystery for me anymore. But there is one piece of knowledge regarding back-end development that I lack: I don’t know how to deploy my application to the production server.

So, I decided to address this issue, and rented a VDS (virtual dedicated server). I’m going to use it for my experiments and eventually for hosting back-ends of my future apps.

My goals are:

  1. Install Tomcat
  2. Install MySQL
  3. Deploy some Java application to the server.
  4. Learn how to use the server for sending Apple Push Notifications.

Here is what I have done already. I started reading about how to install Tomcat and found out that I should install Java first. And even before that I needed to create a sudo user.

Lets go step by step and see what I did.

Creating sudo user

After the purchase of VDS my hosting provider sent me the IP address of my server and the password of root user.  I logged in to the server via SSH.

local$ ssh root@server_ip_address

It is a good practice to not connect to the server as a root user. So I created another user.

# adduser karen

And set his password

# passwd karen

Then I added this new user to the wheel group to make him a sudo user.

# usermod -aG wheel karen

Then I switched to the new user account

# su – karen

Then I verified that I could use sudo

karen$ sudo ls -la /root

This command just lists the contents of /root folder which is normally only accessible by the root user.

I used this article as a reference.

Installing Java

Installing Java was easy. I did it with this one command:

sudo yum install java-1.8.0-openjdk

I verified that Java installed correctly with this command:

java -version

This article helped me.

To be continued.

In the next post I will tell you how I installed Tomcat on my production server.


Leave a Reply

Your email address will not be published. Required fields are marked *