OCI Compute

MOS My Oracle Support

Oracle Support works along with CSI Customer Support Identifier created on Account Creation, can be found under My Oracle Support(MOS), My Account.

Add new user support

New user create a profile in MOS, and request access from My Account, under support Identifiers -> Request Access.. <–supply CSI#

OCI Compartments Structure

Create Instance

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Block Volumes

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Shared File Systems

  • Create Storgae::File System and Mount Target
  • Enable network access (Networking::Subnet Security Groups)
Stateful ingress to TCP destination ports 111, 2048, 2049, and 2050, and UDP ports 111 and 2048.

Stateful egress for TCP source ports 111, 2048, 2049, and 2050, and UDP source port 111
    • Use mount commands from File System::Exports
# yum install nfs-utils
# mkdir -p /mnt/FS-ALPHA
# mount 10.0.0.71:/FS-ALPHA /mnt/FS-ALPHA
  • Enable the Repositories
# dnf install -y dnf-utils zip unzip 
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
  • Install Docker
# dnf remove -y runc 
# dnf install -y docker-ce --nobest
  • Configure Docker Disk
    MOUNT_POINT=/var/lib/docker
    DISK_DEVICE=/dev/sdb
    # New partition for the whole disk.
    echo -e "n\np\n1\n\n\nw" | fdisk ${DISK_DEVICE}
    # Add file system. 
    # mkfs.xfs -f ${DISK_DEVICE}1
    # Mount it using the UUID of the VirtualBox virtual disk.
    # rm -Rf /var/lib/docker
    # mkdir /var/lib/docker
    # UUID=`blkid -o export ${DISK_DEVICE}1 | grep UUID | grep -v PARTUUID`
    # mkdir ${MOUNT_POINT}
    # echo "${UUID} ${MOUNT_POINT} xfs defaults 1 2" >> /etc/fstab
    mount ${MOUNT_POINT}
  • Enable Docker Service
    # systemctl enable --now docker.service
    # systemctl [start|stop|restart|status] docker.service
    # docker info
    # docker version
  • Rootless Docker
    # dnf install -y fuse-overlayfs
    # systemctl disable --now docker.service docker.socket
    # rm /var/run/docker.sock
    # sh -eux <<EOF
    #Load ip_tables module
    modprobe ip_tables
    EOF
    $ /usr/bin/dockerd-rootless-setuptool.sh install
    $ systemctl --user [start|stop|restart|enable] docker
    $ sudo loginctl enable-linger $(whoami) <-- Enable Docker Service at login
    [INFO] Installed docker.service successfully.
    [INFO] To control docker.service, run: `systemctl --user (start|stop|restart) docker.service`
    [INFO] To run docker.service on system startup, run: `sudo loginctl enable-linger opc`
    [INFO] Creating CLI context "rootless"
    Successfully created context "rootless"
    [INFO] Using CLI context "rootless"
    >Current context is now "rootless"
    [INFO] Make sure the following environment variable(s) are set (or add them to ~/.bashrc):
    export PATH=/usr/bin:$PATH
    [INFO] Some applications may require the following environment variable too:export DOCKER_HOST=unix:///run/user/1000/docker.sock
  • firewalld superseded iptables,
  • Zone-Based
    $ firewall-cmd --get-zones
  • Open Ports
    #firewall-cmd [--permanent] --zone=public --add-port=80/tcp
  • GUI Configurations
    $sudo dnf install firewall-config
    $firewall-config
  • SELinux Attributes (option -Z ex. ls -aZ) user:role:type:security example system_u:object_r:passwd_file_t:s0
  • DAC (Discretionary Access Control) Permissions:
  • SELinux booleans([get/set]sebool, sesearch)
  • Commands:
    • getenforce
    • sestatus
    • seinfo
    • semanage fcontext
    • domain
    • [ch|restore]con: change context or restore context

Attach and Connect Block Volume

  • Find volume UUID #blkid
  • Use Device Path when attaching the volume (Attachment Type Section) ex

    /dev/oracleoci/oraclevdb

  • Check attachement
    #ll /dev/oracleoci/oraclevdb
  • Create a file system on the device
    [root@ol8-gi ~]# mkfs.xfs /dev/oracleoci/oraclevdb
    :
    Discarding blocks...Done.
    
  • Mount and list in /etc/fstab
    # mkdir /u01
    # mount /dev/oracleoci/oraclevdb /u01/
    # Add to /etc/fstab
    /dev/oracleoci/oraclevdb /u01 xfs defaults,_netdev,nofail 0 2
    

VNC Users

  1. create users on target server
    # useradd ... user1
  2. Add user1 to vnc user
    # vi /etc/tigervnc/vncserver.users <-- Add users n:=user1
  3. Change OS user password
    # passwd user1
  4. Change VNC password for user1
    # su - user1
    $vncpasswd <-- set password for vnc session to access user1 vnc session
    $exit
    
  5. Disable or enable port 590n on firewalld
    # systemctl stop firewalld
  6. Start VNC Service
    # systemctl start vncserver@:n

Now the VNC Service is listeneing on $(hostname).$(hostname -d):590n

Concurrent logins

Edit the file /etc/security/limits.conf

Add the lines

#<domain>      <type>   <item>          <value>
@student       -        maxlogins       4
opc            -        maxlogins       10

OCI CLI

Oracle CLI supported Python 3.6 to 3.11

On Windows

Python installer installs Python Launcher “py” which launches the latest release of installed Python by default, to run specific release use
PS>Py -3.11 

Installation Options

  1. MSI Installer

    Run the MSI file oci-cli-3.45.2-Windows-Server-Installer.msi
  2. Offline Installer

  3. PowerShell Installer

    After download the isntaller.ps1 (on Windows), the execution of the command Set-ExecutionPolicy RemoteSigned -scope <Scope> Select the higher scop of Get-ExecutionPolicy -List for example “CurrentUser” Run the following:
    PS>pip install scikit-learn --user
    PS>pip install tensorflow --upgrade --user
    PS>New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
  4. WSL2 Install

    $sudo apt install python3 python3-pip ipython3
    $bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"

Snapshot an Instance

  • Snapshots: consistent, point-in-time view of the file system, incremental [User Created | Policy-Based | Replicated]
  • Policy-Based Snapshots and Scheduling: Automate snapshots
  • Console: Storage->
  • mount the filesystem in the instance /mnt/mountpoint/
  • create a custom image for the boot disk only, take snapshots of other Block Volumes 

Remote desktop

# dnf -y update 
# dnf groupinstall -y "Server with GUI" 
# systemctl set-default graphical.target
# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
# reboot
  1. Install VNC Server
    # dnf install -y tigervnc-server
  2. Configure the users
    # vi /etc/tigervnc/vncserver.users <--- display number and user in this format :<display_number>=<user> ex: 
    :1=opc
    :2=user2
    :3=user3
  3. As the <user> create the VNC password and define the default desktop (repeat for each user added in previous step, ex. user1, user2 . . .  etc)
    $ vncpasswd
    $ echo session=gnome >> .vnc/config
  4. Start the corresponding service
    # systemctl start vncserver@:<display_number>
    ex:
    # systemctl [enable|start|stop|restart] vncserver@:1 --now
    • Direct VNC viewer connection

      # firewall-cmd --permanent --zone=public --add-port=5901/tcp
      #systemctl reload firewalld
    • Tunnel connection with SSH

Connect using ssh

  1. ssh command:
    $ ssh <user>@<server> -L 590<display_number>:localhost:590<display_number> ex: $ ssh opc@<server> -L 5901:localhost:5901
  2. Connect vncviewer
    $ vncviewer localhost:<display_number> ex: $ vncviewer localhost:1
    Note: To use the tunnel, connect to “localhost”, not the external IP address

Connect using putty

  1. Launch putty
    putty connect to server
  2. Go to Connection -> SSH -> Tunnels
    putty tunnel
  3. Click “Add” and then “Open”
    putty tunnel add
    Repeat this step for each session ex. 5902, 5903 . . etc
  4. Connect VNC Viewer to  localhost:<session-number> ex. “localhost:1”, localhost:2, localhost:3 . . .  etc.
    connect vncviewer

SSH JumpProxy

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Vault and Encryption Keys

Identity and Security -> Key Management & Secret Management

  • Vault: Secure location used to store key

Mounting File System

Mounting a file system on OCI

If you like what you see, please share it.

About the author

Leave A Reply

For the love of learning, We welcome inquiries and design courses for you!

Courses run on demand, custom designed, Please send us a note and one of our team members will reach out to you.