Prepare the Oracle Java Cloud Service Host

First, generate a key pair using PuTTy, and add the public key of the pair to your Oracle Java Cloud Service instance. Next, connect to the Oracle Java Cloud Service host using PuTTY. Create a user on the host, and then install the Oracle Java SE 8 Runtime Environment as this user.

Before you Begin Preparing the Oracle Java Cloud Service Host

Before you begin preparing the Oracle Java Cloud Service host, ensure that you have completed all prerequisites.

  • Learn how you can connect to and extend Oracle’s SaaS applications with Learn about architectural patterns for integrating Oracle SaaS applications.

  • If you don’t already have an Oracle Java Cloud Service instance on Oracle Cloud Infrastructure, then complete the prerequisites and create an instance.

  • On your Windows system, download PuTTY and WinSCP to connect to and to transfer files to the Oracle Java Cloud Service host.

Generate a Key Pair Using PuTTY

You can generate a secure shell (SSH) key pair on a Windows platform by using the PuTTY Key Generator utility.

  1. Start PuTTYgen on your Windows computer.
    The PuTTY Key Generator window is displayed.
  2. For Type of key to generate, select SSH-2 RSA.
  3. For Number of bits in a generated key, enter 2048.
  4. Click Generate.
  5. When prompted, move the mouse around the specified section of the window.
  6. Optional: Enter a passphrase for the private key in Key passphrase and Confirm passphrase.
  7. Click Save private key.
    The .ppk file extension indicates that the private key is in PuTTY's proprietary format. You must use a key of this format when using PuTTY as your SSH client. It cannot be used with other SSH client tools.
  8. Select the entire contents of Public key for pasting into OpenSSH authorized_keys file.
    This window may have a scroll bar. Be sure to select all of the characters.
  9. Right-click the selected text, and then select Copy.
  10. Open a text editor.
  11. Paste the copied text into the editor. Do not insert any line breaks.
  12. Save the public key file to the same location as the private key file.
  13. Create a copy of the private key in the OpenSSH format.
    1. From the PuTTY Key Generator window, click Conversions, and then select Export OpenSSH key.
    2. Save the converted private key file to the same location as the .ppk file. Use a different file extension such as .openssh.

Add an SSH Public Key

You can add Secure Shell (SSH) public keys to Oracle Cloud instances.

  1. Access your service console.
  2. Click the SSH Access tab.
  3. Click Add New Key for the service instance to which you want to add a new SSH public key.
    The dialog box displays the value of the most recently added public key.
  4. Specify the new public key, by completing one of the following:
    • Select Upload a new SSH Public Key value from file and then use your browser to upload a public key file from your local computer.
    • Select Key Value. Delete the previous public key value from the input field and then enter or paste the new value. Be sure not to include other characters that aren’t part of the key, such as spaces.
  5. Click Add New Key.

Connect to a Node Using PuTTY

You can access a node from a Windows platform by using PuTTY, an open source networking client.

  1. Access your service console.
  2. Click the name of the service instance that contains the node that you want to access.
  3. On the Overview page, identify the Public IP address of the node that you want to access.
    For example, 111.111.111.111.
  4. Start PuTTY on your Windows computer.
    The PuTTY Configuration window is displayed, showing the Session panel.
  5. In the Host Name (or IP address) field, enter the public IP address of the node.
  6. In the Category navigation tree, expand Connection, and then click Data.
  7. In the Auto-login username field, enter opc.
  8. In the When username is not specified field, select Prompt.
  9. In the Category tree, expand Connection, expand SSH, and then click Auth.
  10. Under Private key file for authentication, click Browse.
  11. Navigate to the location of your private key file, and select it. Click Open.
  12. Optional: To save this session configuration, click Session in the Category tree, and then click Save.
    To load a saved configuration, select the configuration name, and then click Load.
  13. Click Open.
  14. If prompted, enter the passphrase for the private key.

Add a User on an Oracle Linux Instance

You can access your instance from a remote host as the opc user. After signing in, you can add users on your instance.

  1. Use PuTTY to sign in to your instance as the opc user.
  2. Become the root user.
    sudo su
  3. Create the user:
    useradd tcc
  4. Create a password for the user:
    passwd tcc
  5. Create a .ssh directory in the new user’s home directory.
    mkdir /home/tcc/.ssh
  6. Copy the SSH public key (that you generated and saved earlier) to the /home/tcc/.ssh/authorized_keys file.
    echo "key" > /home/tcc/.ssh/authorized_keys
    key is the SSH public key value from the key pair that you generated earlier, enclosed in quotation marks.
  7. Add the new user to the list of allowed users in the /etc/ssh/sshd_config file on your instance, by editing the AllowUsers parameter.
    AllowUsers opc tcc
    In this example, the AllowUsers parameter already had the opc user permissions assigned. The tcc user permissions were added.
  8. Allow the new user to sign in with a password instead of the key by adding the following lines to the end of the /etc/ssh/sshd_config file:
    Match User tcc
    PasswordAuthentication Yes
  9. Change the owner of the /home/username/.ssh directory to the new user:
    chown -R tcc /home/tcc/.ssh
  10. Restart the SSH daemon on your instance.
    /sbin/service sshd restart
  11. Enable sudo privileges for the new user by editing the /etc/sudoers file by running the visudo command.
    In /etc/sudoers, look for the following line:

    opc ALL=(ALL) NOPASSWD: ALL

    Add the following line right after the preceding line:

    tcc ALL=(ALL) NOPASSWD: ALL

You can now sign in as the new user:

Install the Java SE 8 Runtime Environment on the Oracle Java Cloud Service Host

Install the Java Runtime Environment (JRE) to the home directory for the user you just created.

Before you get started, download the JRE installer for 64-bit Linux systems to your local system from the Oracle Technology Network.

  1. Use WinSCP to copy the installer from your local system to the home directory of your new user on the Oracle Java Cloud Service host (/home/tcc/).
    Use the tcc user, the private key you generated with PuTTY, and the public IP address of your Oracle Java Cloud Service to connect.
  2. Use PuTTY to sign in to the Oracle Java Cloud Service host as the tcc user.
  3. Unpack the tarball and install the JRE:
    tar -xf jre-8uversion-linux-x64.tar.gz
    The JRE files are installed in a directory called jre1.8.0_version in the user’s home directory.
  4. Use vi, or another text editor, to edit the tcc user’s bash profile:
    vi ~/.bash_profile
    1. Define the JAVA_HOME variable:
      export JAVA_HOME=/home/tcc/jre1.8.0_version
    2. Add the following directory to the the PATH variable:
      /home/tcc/jre1.8.0_version/bin