Professional Documents
Culture Documents
Volume)
Table of Contents
Overview
Pre-Requisites
Creat ssh keys, compute instance and Block Volume. Attach block volume to compute instance
Detach the block volume and launch second compute instance using boot volume and attach Block Volume
Overview
In this lab we will create a compute instance, install httpd server on it, attach block volume to it and install an app on
the Block Volume We will then create a second compute instance using the boot volume of the first compute instance
and move the Block Volume to the second compute instance (with the app installed). The goal of the lab is to
demonstrate launching VCN, Compute Instance, using Boot volume of compute instance and how easy it is to move
additional storage with applicatons/tools installed between compute instances
We recommend using Chrome or Edge as the broswer. Also set your browser zoom to 80%
All screen shots are examples ONLY. Screen shots can be enlarged by Clicking on them
Login credentials are provided later in the guide (scroll down). Every User MUST keep these credentials handy.
Do NOT use compartment name and other data from screen shots.Only use data(including compartment name)
provided in the content section of the lab
Mac OS Users should use ctrl+C / ctrl+V to copy and paste inside the OCI Console
Login credentials are provided later in the guide (scroll down). Every User MUST keep these credentials handy.
Cloud Tenant Name User Name Password Compartment Name (Provided Later)
Note: OCI UI is being updated thus some screenshots in the instructions might be different than actual UI
Pre-Requisites
Oracle Cloud Infrastructure account credentials (User, Password, Tenant, and Compartment)
1.
OCI Training : https://cloud.oracle.com/en_US/iaas/training
2.
Familiarity with OCI console: https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/console.htm
3.
Overview of Networking: https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm
4.
Familiarity with Compartment: https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm
5.
Connecting to a compute instance:
https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/accessinginstance.htm
6.
Password: Effortless69#
Compartment:TL-OCISPL54-33
Sign in using your tenant name, user name and password. Use the login option under Oracle Cloud Infrastructure
From the OCI Services menu,click Virtual Cloud Network under Networking and click Create Virtual Cloud Network
1.
Select the compartment assigned to you from drop down menu on left part of the screen
2.
1.
Create in Compartment: Has the correct compartment
2.
Name: Enter easy to re¬member name
3.
Create Virtual Cloud Network Plus Related Resources: Select this option.
4.
Click Create Virtual Cloud Network
5.
Click Close
6.
1. We will open port 80 on this VCN to provide http access to app on the compute instance(to be installed later on.
Click Security List2. and then Default Security list for
1. In Security list details page, Click Edit All Rules2. and Click +Another Ingress Rule3. under Allow Rules for
Ingress and add below rule:
Make sure STATELESS Flag in un-checked
SOURCE TYPE:4. CIDR
SOURCE CIDR:5. 0.0.0.0/0
IP PROTOCOL:6. TCP
SOURCE PORT RANGE:7. ALL
DESTINATION PORT RANGE:8. 80
1. Click Save Security List Rules2. at the bottom
1. Enter command
ssh-keygen
HINT:2. You can swap between OCI window, git-bash sessions and any other application (Notepad, etc.) by clicking
the Switch Window icon
1. Press Enter When asked for 'Enter File in which to save the key', 'Created Directory, 'Enter passphrase', and 'Enter
Passphrase again.
NOTE: id_rsa.pub will be used to create Compute instance and id_rsa to connect via SSH into compute instance.
HINT: Enter command
and then
ls
1. Click the apps icon, launch notepad and paste the key in Notepad (as backup)
Switch to the OCI console. From OCI servies menu, Click Instances under Compute
1.
Click Create Instance. Fill out the dialog box:
2.
Name: Enter a name
3.
Availability Domain: Select availability domain
4.
Image Operating System: For the image, we recommend using the Latest Oracle Linux available.
5.
Choose Instance Type: Select Virtual Machine
6.
Choose Instance Shape: Select VM shape
7.
Configure Boot Volume: Leave the default
8.
Add SSH Keys: Choose 'Paste SSH Keys' and paste the Public Key saved earlier.
9.
Virtual Cloud Network Compartment: Choose your compartment
10.
Virtual Cloud Network: Select the VCN you created in the previous section.
11.
Subnet Compartment: Choose your compartment.
12.
Subnet: Choose the first Subnet
13.
Click Create
14.
NOTE: If 'Service limit' error is displayed choose a different shape such as VM.Standard.E2.2 OR VM.Standard2.2 OR
choose a different AD
2.
Enter command
3.
ssh -i id_rsa_user opc@<PUBLIC_IP_OF_COMPUTE>
HINT: If 'Permission denied error' is seen, ensure you are using '-i' in the ssh command. You MUST type the command,
do NOT copy and paste ssh command
1.
From OCI services menu Click Block Volumes under Block Storage, then Click Create Block Volume.
2.
Fill out the dialog box:
3.
Create in Compartment: Has the correct compartment selected.
4.
Name: Enter a name for the block volume (e.g. "block_vm).
5.
Availability Domain: Select the first available domain (must be same as Compute).
6.
SIZE: Set to 50
7.
BACKUP POLICY:þÿ Set to None (If this field shows Error Retrieving Value then leave it as is)
8.
Click Create Block Volume. Wait for volume to become available. Wait for Block Volume state to change from
'Provisioning' to 'Available'
9.
Attach Block volume to your compute instance. From OCI services menu Click Instance under Compute
1.
For the compute instance created earlier click Action item. Click Attach Block Volume.
2.
NOTE: We can also use ISCSI mode, in which case we will not have to use ISCSI commands as detailed later on. For
more information please refer to ;
https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm#attachtype OR refer Appendix section
at the end of the lab.
Click Attach.
Click Close.
We now have a block volume created and attached to the Compute instance.
1. Verify the Block Volume is attached by clicking the Compute Instance name.
NOTE: Despite the line wrapping, the --add-port flag has no spaces.
1.
sudo systemctl start httpd
Enter commad lsblk to verify the Block volume storage is initialized. This could be sda, sdb or somethig else strting
with 'sd'. In below example this volume is called sdb. Below screen shot shows a 1 TB volume though in this lab we
have created a 50GB volume thus the size in your compute instance will be 50GB.
2.
HINT: The Name sdb is the block volume storage. This name could change for your specific attachment (i.e sdc)
1.
sudo fdisk /dev/<VOLUME_NAME> -l
2.
Create a file system on the block volume, Enter Command:
3.
sudo mkfs.ext4 -L datapartition /dev/<VOLUME_NAME>
This will create the file system on the entire disk. Enter y when prompted with 'Proceed anyway'
2.
sudo mount /dev/<VOLUME_NAME> /mnt/www/html
3.
lsblk
4.
1.
cd /home/opc
Enter Command:
2.
wget https://github.com/snafuz/oci-quickstart-lab/archive/master.zip
Enter Command:
3.
unzip master.zip
Enter Command:
4.
sudo cp -R oci-quickstart-lab-master/static/* /mnt/www/html/
5.
sudo vi /etc/httpd/conf/httpd.conf (for vi)
OR
6.
sudo nano /etc/httpd/conf/httpd.conf (for nano)
NOTE: in vi you can save the file after modification by using Esc :wq
1. Search for string /var/www and replace it with /mnt/www/html . This will be done in 3 locations
Save and Exit (in vi user Esc :wq)
1.
Enter command:
2.
sudo chcon -R --type=httpd_sys_rw_content_t /mnt
3.
sudo systemctl restart httpd
4.
http://<COMPUTE_INSTANCE_PUBLIC_IP>
5.
We have initialized httpd.conf file. Next we will create a second compute instance using the boot volume of
the first compute instance and attach Block Volume to it
1. In ssh session to the compute instance unmount the directory from block volume, Enter command:
sudo umount /dev/<VOLUME_NAME>
2. In OCI console window, click your compute instance name and in Attached Block Volume3. section click the action
icon and click Detach
1. Stop your compute instance by Clicking Stop2. in compute instance details page and then OK3. in Confirm window
1. Once the instance is in Stopped state, click Boot Volume2. , Click action icon and click Detach3. . Click OK4. in
Confirm window.
Once the Boot volume is detached, Click Terminate to Terminate the instance.
1.
Click the action icon, click View Boot Volume Details.
2.
NOTE: If 'Service limit' error is displayed choose a different shape such as VM.Standard.E2.2 OR VM.Standard2.2 OR
Choose a different AD
Once the instance is in Running state, attach the block volume to this new instance using OCI Console.Ensure to use
Paravirtualized mode.
1.
Mount the block volume as before, Enter Command:
2.
sudo mount /dev/<VOLUME_NAME> /mnt/www/html
3.
sudo systemctl restart httpd
Launch a web browser and Enter compute Instance's public IP, http://
4.
Screen like below should appear, Enter the required information
5.
We have now successfully launched a compute instance using another instance's boot volume and
re-attached a block volume that was attached to another instance. The block volume preserved all the data on
it during this process. Moreover the compute instance launched using the boot volume had httpd server and
fire wall configuration already present
1.
If your Compute instance is not displayed, From OCI services menu Click Instances under Compute
2.
Locate first compute instance, Click Action icon and then Terminat
3.
1. Make sure Permanently delete the attached Boot Volume is checked, Click Terminate Instance. Wait for instance to
fully Terminate
From OCI services menu Click Block Volumes under Block Storage
1.
Find the storage block volume you created.
2.
HINT: If multiple storage block volumes are listed, scroll down to find the one you created.
1.
Click OK in the confirmation window.
2.
From OCI services menu Click Virtual Cloud Networks under Networking, list of all VCNs will appear.
1.
Locate your VCN , Click Action icon and then Terminate. Click Delete All in the Confirmation window. Click Close
once VCN is deleted
2.
1. From OCI services menu Click Networking2. , then Public IPs3. ,locate the Reserved Public IP you created. Click
Action icon and then Terminate
1.
In OCI Console Window, click the Apps icon and click Notepad.
2.
HINT: You can swap between the OCI window and any other application (Notepad etc.) by clicking the Switch Window
icon
1. Paste the ISCSI commands in Notepad using your mouse/touch pad or Ctrl v.
To attach ssh to the compute instance and paste the ISCSI commands copied earlier
1.
Click Copy in DETACH COMMANDS section.
2.
Paste the detach command in the ssh session to the compute instance
1.
In OCI console window, click your compute instance name and in Attached Block Volumes section click the action
icon and click Detach
2.