This tutorial describes how you can run a simple HelloWorld web application on an SAP Cloud Platform virtual machine using Apache.

Prerequisites

The hello_world_apache.sh file, that we are going to use in this tutorial, contains the following code. Create a blank .txt file, transfer the code there, and save it as an .sh file with the exact same file name.

After your virtual machine is created, look for the virtual machine key usually located in your SDK folder. Follow the instructions in step 2 to convert that autogenerated key from .key to .ppk format.

2. Connect to the virtual machine.

We will use both PuTTY and WinSCP for this tutorial, but you may also try it out using other SSH clients. In both cases, you need to have:

– PuTTYgen installed

– An open SSH tunnel to the virtual machine

For PuTTY, follow these steps:

Convert the key using PuTTYgen.

Load the autogenerated key (select Load or Conversations→Import key).

Save the private key.

In PuTTY, open the Connection → SSH → Auth tab and add the converted private key.

Open the Session tab.

Enter host name: root@localhost.

Enter port: the tunnel port.

Open the connection.

For WinSCP, follow these steps:

Convert the key using PuTTYgen.

Load the autogenerated key (select Load or Conversations→Import key).

Save the private key.

Open WinSCP.

Enter host name: localhost.

Enter port: the tunnel port.

Enter username: root.

Open Advanced settings and then open SSH→Authentication.

Add the converted private key and click OK.

Log in.

The idea behind using the WinSCP client in this tutorial, is to allow you to transfer the hello_world_apache.sh script file from your local file system to the virtual machine.

After you have started a WinSCP session, find and open the local folder containing the .sh file. Then, drag and drop it, for example, in the root folder of the virtual machine.

5. Execute commands in PuTTY.

Note: First, make sure that you are in the right folder. Let’s assume that the .sh file is transferred to the root folder of the virtual machine as mentioned in step 4. In this case, run the cd /root command in PuTTY to go to that folder. And if you want to double-check that the .sh file is there, run the ls command to list all available files in that folder.

Once you are in the correct folder, you are ready to execute the following two commands:

Note: The hana.ondemand.com region host is valid for the Europe (Rot/Germany) region. If your virtual machine is hosted on another SAP Cloud Platform region host, choose one of the other available options at Regions and Hosts.

6. Register an access point for the virtual machine.

You can do that in two ways:

– Go to the overview page of the virtual machine in the cockpit and select Expose to Web.