Friday, 14 February 2014

Download and install MobaXterm to connect to Amazon Linux EC2 instances via SSH

This is another in a series of videos that I am producing for my YouTube channel HowDoYouDoStuff.


In this video, I am going to show you how to download and install MobaXterm to connect to Amazon Linux EC2 instances via SSH


You can read the transcript below.


HTML 5 Player



Transcript

Hi guys. I'm Phil Stirpe.

In this video, I am going to show you how easy it is to download and install MobaXterm to connect to Amazon Linux EC2 instances via SSH.

Until recently whenever I've wanted to connect to EC2 instances running LINUX I have usually used putty.

But then a colleague told me about MobaXterm which seems a much better tool.

Here I have to EC2 instances running LINUX in Amazon Web services and I want to connect to them using MobaXterm.

So I'll jump into Google and search for MobaXterm.

As you can see there are a number of links but I will just go for Download.

There are a number of options I can choose, all versions 6.6. I'll select the installer which is going to give me an MSI.

Now that actually took about 3 minutes to download but I cut a lot of that out to keep the video short.

So here is the downloaded MSI and if I run that to install and just accept the defaults. i.e. Accept the license agreement and choose the default folder.

That's it. Quick as you like. Installed.

Let me just add that to my Taskbar.

Okay, let's run the tool.

There is MobaXterm and there is a lot of things it can do for us.

Notice it remembered a number of previous sessions. The reason they are appearing is because prior to recording this video I did actually have the tool installed and I had used it to connect to several of my instances. I just hadn't deleted the history.

So let me try connecting to one of my instances and as you can see I have 2.

Now this is one of the advantages of using this tool rather than putty. That is, it allows me to have more than one instance open simultaneously.

I'll bring back the window and start a new session.

As you can see there are a lot of things that we can do here. For example we can use RDP session to connect to a Windows server. But I'll click SSH so that I can connect to a Linux server.

So I'll enter the IP address of my 1st instance and the user name is going to be ec2-user because that is the default route account for an Amazon Linux server.

And then the private key is this key file that I associated with the server when I launched it.

Now I can connect.

And we are in.

Let me try another.

It is warning me that I can't save any more sessions. That's fine I had a lot saved from before.

I'll just click on the SSH button again. Let me pick the other IP address and pop that in there.

Once again the username is ec2-user and I'll go and find the key that I used to launch the instance.

I'll click Open then OK and now it's connected to that server.

Really useful. Really simple.

The 1st time I used this tool incidentally was an exercise where I tried to link two servers, each in a different Amazon region and create a VPN connection. Perhaps I'll do that in a later video.

There you go.

In this video, I have shown you how easy it is to download and install MobaXterm to connect to Amazon Linux EC2 instances via SSH.

Thanks for watching and please feel free to comment on my blog (www.philipstirpe.com) and Facebook page (www.facebook.com/philip.stirpe.tutorials). Perhaps you could suggest more video topics? Most of all, don't forget to subscribe to keep up with my videos as I release them.

Bye for now.



Flash Player








See you soon

Phil Stirpé
"I don't do average!"






Wednesday, 5 February 2014

Download and install Apache Tomcat

This is another in a series of videos that I am producing for my YouTube channel HowDoYouDoStuff.


In this video, I am going to show you how to download and install Apache Tomcat


You can read the transcript below.


HTML 5 Player



Transcript

Hi guys. I'm Phil Stirpe.

In this video, I am going to show you how easy it is to download and install Apache Tomcat.

In an earlier video, I showed you how to write a simple program in Eclipse.

Well if we are going to develop Java web applications, then we really should consider installing a container such as Apache Tomcat to host our application.

I'll start by jumping into my browser and searching for "apache tomcat download".

That results in plenty of hits, and the one I'll take is this one for tomcat.apache.org.

New versions of Tomcat are released from time to time.

I actually recorded the screen for this demo quite some time ago which is why the latest version is showing up as 7. In fact, the latest version available today is version 8(beta).

So I'll click on the link for version 7 and then scroll down the page to locate the various downloadable pages.

I'll be using it on a 64bit Windows machine so I'll choose the Windows Installer option. Alternatively, I could have selected a zip file instead.

When prompted, I'll place the installer in my Java Demo folder. It just takes a couple of seconds.

If, I switch into the Java Demo folder, you will see the installer file.

Before I run the installer, I am just going to create a folder in the root of C: named ApacheGroup.

This isn't necessary but over time I am likely to install a number of tools produced by Apache such as Maven and possibly even other versions of Tomcat. By creating a folder like this, it will be easier for me to manage them.

OK. Now that I have created my ApacheGroup folder, I can head back over to the Java Demo folder to run the installer. Before I do, I will just copy the file name from the installer as that will do nicely for an installation folder name.

As soon as I run the installer, I am asked to accept the licence terms.

On the Components page, I'll select all of the bits and then click the Next button.

The Configuration screen allows me to update the various port numbers. If I wanted to, I could change the port for HTTP from 8080 which is the norm. I'll leave that as it is.

I could also specify a user name and password to secure Tomcat which is a good idea but for now, I will leave these fields empty.

When you install Tomcat, it is presumed that you have already installed the Java runtime and so the next screen prompts you confirm its location. As I installed Java to its default location, this path is correct.

Now it's time to specify where to install Tomcat.

If you recall, I created a folder named ApacheGroup earlier and that is where I would like to install to.

So I'll browse to the ApacheGroup folder and then create a new folder within it.

I can paste in the name that I copied from the installer earlier as my target folder name and then go ahead with the installation.

Before long, I receive a warning that the Tomcat service is unable to start. I'll ignore that warning for now as I'll be able to start it manually later.

Once the installation is complete, I have the option for it to launch when I click the Finish button. I am going to decline. I am also going to uncheck the Readme box before clicking Finish.

If I open up the installation folder, you can see the various files and folders that comprise Tomcat.

Let me look in the bin folder.

There are several files in here but the two that interest me are a pair of batch files named startup.bat and shutdown.bat.

These batch files enable me to start and stop the Tomcat service when required.

I'd like to run these batch files from the Command Prompt so I will just make a note of the current path, launch the Command Prompt, type "cd" and then finally paste the folder path.

If I type "startup" from the Command Prompt, a separate window opens and we can see various status messages indicating that Tomcat is launching.

By the way, the eagle eyed amongst you might spot mention of applications such as webAppCH02.war being deployed. This is because, I actually copied some of my exported java projects into Tomcat's wepapps folder following the install but have edited that segment from the video. It has nothing to do with the current demo.

Well the server appears to be running but we need some form of test to make sure.

So I'll jump into a browser and try navigating to http://localhost:8080.

And there you will see Tomcat's landing page.

This proves that Tomcat is indeed running on the local machine and listening on port 8080.

Now let's see what happens if I switch back to the Command Prompt and run the shutdown batch file.

When I return to the browser and refresh the page, I receive a warning telling me that it was unable to connect.

Clearly, it is not enough to have Tomcat installed. I will need to install some web applications on this server for it to be of use.

That will be the subject of future videos.

There you have it.

In this video, I have shown you how easy it is to download and install Apache Tomcat.

Thanks for watching and please feel free to comment on my blog (www.philipstirpe.com) and Facebook page (www.facebook.com/philip.stirpe/tutorials). Perhaps you could suggest more video topics? Most of all, don't forget to subscribe to keep up with my videos as I release them.

Bye for now.








Flash Player








See you soon

Phil Stirpé
"I don't do average!"






Tuesday, 4 February 2014

Write a simple JAVA program in eclipse

This is another in a series of videos that I am producing for my YouTube channel HowDoYouDoStuff.


In this video, I am going to show you how to write a simple JAVA program in eclipse


You can read the transcript below.


HTML 5 Player



Transcript

Hi guys. I'm Phil Stirpe.

In this video, I am going to show you how easy it is to write a simple JAVA program in eclipse.

In an earlier video, I showed you how to write a simple program in notepad and then compile it using javac. I then recorded a video showing how to install eclipse.

Well now it's time to pull those things together.

Using an integrated development environment - IDE such as Eclipse is far preferable to trying to develop using notepad and the javac compiler.

So here is Eclipse. Before I get started, I'll just rearrange the windows to suit.

To start with, I'll drag the outline window down to sit below the Project Explorer.

And then the Task list window to sit at the bottom with the other windows.

There is no 'right way' to lay out your windows. It's a matter of preference.

I find that this layout gives me more space to work with.

I have already selected a workspace. In other words, I chose a working directory when I launched eclipse.

Let me show it to you. It's here on the Desktop in a folder named Java Demo.

So any project that I create will be created in this folder.

I'll switch back into Eclipse so that I can create a project.

If I click on File / New menu, you will see that I can create a variety of project types.

Alternatively, I can right-click in the project explorer to receive the same options.

I'll choose a straight forward Project option.

In the New Project wizard, I'll select Java Project and then click Next.

I'll give the project the name of TestProject and then confirm that the target execution environment is of JavaSE-1.7.

I don't need to worry about these other options for this demo so I'll click Next.

New projects contain a src folder where source (code) files will be stored.

You can add more if you wish but I am happy to go with the defaults. So I'll click Finish.

As I am creating a Java project, Eclipse now offers to use an appropriate perspective. A perspective is essentially a set of predefined views, layouts and menu structures appropriate to a particular use case.

By agreeing to use the predefined Java perspective, you are telling Eclipse to present you with only those features that are useful to a Java developer. If you were working on a Maven project, then you might choose a different perspective.

As you can see, the Java perspective placed the Outline window and Task List on the right of the screen, so I'll just put them back where I prefer them.

OK, I am ready to start. And I can start by expanding the project node in the Project Explorer.

As you can see, in addition to the src folder, there is also a folder containing the JavaSE-1.7 library as that is the environment that I selected earlier.

Actually, these are quick links. In other words, the project is referencing the libraries that I require rather than copying them into my project.

Right then. It is time to create my class. So I can right-click on the src folder and select New / Class from the menu.

When creating classes in Java, you are advised to group them together into Packages. Packages are simply a mechanic to help you identify and locate related classes.

I'll define a package named demo.classes and then name my class HiGuys.

The New Java Class dialog has a number of useful features.

For example, it can add a main method to your class if you wish.

Not all classes need a main method. For example, servlets in a web application don't need them as they are instantiated in response to inbound requests.

However, as I want to execute my code from the command line, my class will require a main method.

It is worth mentioning at this point that of course classes can inherit from others and by default, Eclipse has your new classes inherit from the object class which can be found in the java.lang package.

If you want your class to inherit from another class, you need simply enter its name in here.

Right then. I'll click the Finish button which results in Eclipse creating my class file.

As you can see, it has written a class named HiGuys and placed a method named main within it.

All I want to do in this program is output a simple line of text to the console.

For that I will need to call the System.out.println method.

So i'll go ahead and type that in.

Now then. Before I proceed, them me show you a useful feature called Code Templates.

These are predefined snippets of code that have an associated shortcut.

So let me remove that line and then type in sysout followed by the Ctrl and Space keys.

Eclipse replaces my shortcut with the associated code.

Very nice.

There are many of these Code Templates defined and in fact, you can even create your own.

Now there's a great subject for a video. I'll put that on the list.

If you watched my earlier video, you will know that I have never written a Hello World app. Despite it being a tradition. Instead, I am going to output the message "Hi Guys!".

Once you have written your code, you are bound to want to test it.

Well, I'll do that now.

I'll save my code file first and then right-click anywhere in the code window.

In the context menu, I can click Run As and then select Java Application.

This causes Eclipse to compile the code and then run it with any output being displayed in the Console window.

That is to say, the Console window in Eclipse and not the Command Prompt where you might typically run a Console application.

As you can see, my output of Hi Guys! has been echoed to the Console.

Now a question to consider here is, did Eclipse actually compile my code and generate a class file which it in turn executed or did it interpret my code in some way?

Well if I switch into File Explorer and take a look at my project folder, I can find the source file ok.

And if I navigate to /bin/classes/demo I will also find my class file. That proves that my class was indeed compiled prior to execution.

There you have it.

In this video, I have shown you how easy it is to write a simple JAVA program in eclipse.

Thanks for watching and please feel free to comment on my blog (www.philipstirpe.com) and Facebook page (www.facebook.com/philip.stirpe.tutorials). Perhaps you could suggest more video topics? Most of all, don't forget to subscribe to keep up with my videos as I release them.

Bye for now.



Flash Player








See you soon

Phil Stirpé
"I don't do average!"