You are on page 1of 15

Oracle Cloud Infrastructure – Compute VM Instance - Configure and Connect

to a Linux GUI and Java IDE

Pre-Requisite : To successfully complete this lab you must have completed the Oracle
Cloud Infrastructure – Create a Compute VM Instance with Oracle Linux Server lab.

Section 1: Configure the Linux GUI

This task shall take approximately 20 minutes to complete.


1: Connect to your VM with Git Bash
a. Find Git in your programs
b. Click Git Bash to open a Terminal window
c. Execute the following command using your public IP address
ssh opc@ public IP address
NOTE : If you entered a Passphrase in Section2 you will be prompted to enter it

2. Execute the following command to ensure we have the latest packages installed :
sudo yum update If prompted to ok the download size – type y
NOTE: This may take a few minutes if updates are being installed

3. Once Step 2 is complete Execute the following command to setup a GUI interface
sudo yum groupinstall "Server with GUI"

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
4. Follow all on-screen instructions, if prompted to ok the download size – type y
NOTE: This may take a few minutes to install
5. Once Step 3 is completed Execute the following command to set the default boot target to GUI
sudo ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
6. Once step 5 is compete Execute the following command to reboot your Oracle Linux Instance and apply the updates
sudo reboot
NOTE: This may take a few minutes to complete
7. Re-Connect to your VM with Git Bash
a. Execute the following command using your public IP address
ssh opc@ public IP address
NOTE : If you entered a Passphrase in Section 2 you will be prompted to enter it

NOTE: If you receive a port 22: Connection refused message simply wait a minute and try again. In this case the server is still rebooting
from previous steps.

8. Execute the following command to install a VNC server which will allow us to connect to Gnome GUI
sudo yum install tiger*
When prompted enter y to download and install

9. Once step 8 is completed Execute the following statement to disable the lock screen on the GUI
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type boolean --set
/apps/gnome-screensaver/lock_enabled false
NOTE: Ensure you type this as a single statement

10. Once step 9 is completed Execute the following statement to start the vncserver which will enable connection to the GUI and set
the desktop resolution
vncserver -nolisten tcp -localhost -geometry 1680x1050

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
2
11. When prompted enter and verify a password that will be used to connect to the VNC Viewer Installed in Section 1 of the Oracle
Cloud Infrastructure – Create a Compute VM Instance with Oracle Linux Server lab (Provision_Oracle_Linux_Server).

Note: The password text will not be displayed at the prompt as you type.

Note : Take a note of this password as you will need it in Section 7

12. If prompted for “Would you like to enter a view-only password (y/n) enter n

Section 2: Connect the Linux GUI

1. If you do not have an active Git Bash terminal session connected then open a Git Bash Terminal window
2. Execute the following command to connect to your Compute VM Instance through ssh substituting public IP address with the public
IP address assigned to your Instance
ssh -L 5901:localhost:5901 opc@ public IP address –N
Note: if you get a permission denied error – close your Git Bash terminal session and reopen it.

Note : The Prompt $ will disappear as this is a running process. (If you wish to end the process press Ctrl C)

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
3
4. Now Start the VNC Viewer (find in your programs menu) you installed in previous lab, to make a new connection in RealVNC
5. Once open, click File > New Connection
6. For VNC Server enter localhost:5901
7. For name enter a descriptive name e.g oracle linux VM. All other options should be left as default

8. Click OK
9. Right Click on the newly created Connection and select Connect

10. You may get a warning displayed. If so simply click Continue

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
4
11. Enter the password you created in Section 1 Step 11

12. You should now be presented with the Oracle Linux desktop of your Compute VM Instance
Note : You may see this screen with a clock – if so hit Enter.

13. If this is your first connection you will be prompted to enter localization settings for language and keyboard. Follow the on screen
instructions

Section 3: Configure Lock Screen


1. Follow these commands to disable the timeout and lock screen on your desktop

Click Applications Menu > System Tools > Settings

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
5
2. Select Privacy > Screen Lock > Off

3. To improve the picture quality of your Oracle Linux VM, hover at the top of the screen to see the VNC Viewer drop down menu >
Properties > Options tab > change picture quality to medium. Click Ok. Please note that improving the picture quality may affect
performance and cause the service to slow down.

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
6
Section 4: Install Netbeans

1. From your VM Instance Desktop Click Applications > Favorites > Firefox
2. Enter the following URL http://apache.mirrors.ionfish.org/netbeans/netbeans/11.2/Apache-NetBeans-11.2-bin-linux-x64.sh
3. When prompted Click Save File

4. From your VM Instance Desktop Click Applications > Favorites > Terminal

5. Execute the following command in the terminal window : (Note : these commands are case sensitive)
cd Downloads
6. Execute the following command
sudo bash ./*.sh

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
7
7. Click Next to start the installation

8. Click to Accept the terms in the license agreement


9. Set the following options for Choose the installation folder and JDK :
a) Leave Install the Apache Netbeans IDE to as default
b) In the drop down for JDK for the Apache Netbeans IDE
i) Select the JDK you installed in Section 5 – e.g. jdk1.8.x86_64
c) Click Next >

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
8
10. Select Check for Updates and click Install

11. Once Install is completed click Finish

12. Close Terminal Window in the Oracle Linux VM desktop

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
9
Section 5: Configure Netbeans and create your first Java Project
1. Open Netbeans from your desktop : Applications > Programming > APACHE Netbeans IDE 11.2

Netbeans will launch to the Start Page

We will now configure Netbeans


2. From Netbeans click File > New Project

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
10
3. From the New Project window Select Java with Ant & Java Application

4. Click Next >


As this is your first project you may be required to configure some options
5. If prompted, Click Download and Activate

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
11
6. If Prompted, Click Next >

7. If Prompted, Click to accept the license agreements and click Install

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
12
8. Click Finish

You are Now Ready to Code your applications

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
13
Section 6: Returning to your Instance

Once you have completed the steps above it is simple to connect to your Instance.

1. Open a Git Bash Terminal window


2. Execute the following command to connect to your Compute VM Instance through ssh substituting public IP address with the public
IP address assigned to your Instance
ssh -L 5901:localhost:5901 opc@ public IP address –N

Note : The Prompt $ will disappear as this is a running process. If you wish to end the process press Ctrl C

3. Now Start the vncviewer you installed previously, to make a new connection in RealVNC
4. Right Click on the Connection you created for your instance and select Connect

5. You may get a warning displayed. If so simply click Continue

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
14
6. Enter the password you created in Section 1 Step 11

7. You should now be presented with the Oracle Linux desktop of your Compute VM Instance

Copyright © 2020, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
15

You might also like