{"id":13542632,"url":"https://github.com/oracle-quickstart/oci-prerequisites","last_synced_at":"2025-09-19T22:50:30.252Z","repository":{"id":106380666,"uuid":"146036790","full_name":"oracle-quickstart/oci-prerequisites","owner":"oracle-quickstart","description":"Instructions to get your environment ready to deploy OCI Quick Start examples","archived":false,"fork":false,"pushed_at":"2021-02-01T00:40:40.000Z","size":1640,"stargazers_count":48,"open_issues_count":2,"forks_count":23,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-20T18:41:49.197Z","etag":null,"topics":["cloud","oci","oracle","oracle-led","terraform"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle-quickstart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-24T20:27:29.000Z","updated_at":"2025-03-23T23:27:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"b53daf23-1723-463b-a474-9f9b15a98db2","html_url":"https://github.com/oracle-quickstart/oci-prerequisites","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oracle-quickstart/oci-prerequisites","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-quickstart%2Foci-prerequisites","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-quickstart%2Foci-prerequisites/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-quickstart%2Foci-prerequisites/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-quickstart%2Foci-prerequisites/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle-quickstart","download_url":"https://codeload.github.com/oracle-quickstart/oci-prerequisites/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-quickstart%2Foci-prerequisites/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276012309,"owners_count":25569843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","oci","oracle","oracle-led","terraform"],"created_at":"2024-08-01T10:01:13.110Z","updated_at":"2025-09-19T22:50:30.216Z","avatar_url":"https://github.com/oracle-quickstart.png","language":"PowerShell","funding_links":[],"categories":["PowerShell","terraform"],"sub_categories":[],"readme":"# oci-quickstart-prerequisites\n\nThis README describes the steps to setup your environment so it can run Oracle Cloud Infrastructure (OCI) Quick Start examples.\n\n## Create an OCI Account\n\nIf you don't have an OCI account, you can sign up for a free trial [here](https://cloud.oracle.com/en_US/tryit).\nDepending on what Terraform modules you're going to deploy, you may need to [subscribe to other regions](https://docs.cloud.oracle.com/en-us/iaas/Content/Identity/Tasks/managingregions.htm) beyond your home region.  Similarly, the default quotas are pretty low, so you might need to submit a [service limit](https://docs.cloud.oracle.com/en-us/iaas/Content/General/Concepts/servicelimits.htm) increase.\n\n## Oracle Resource Manager\n\n[Oracle Resource Manager](https://docs.cloud.oracle.com/en-us/iaas/Content/ResourceManager/Concepts/resourcemanager.htm)\nis OCI's terraform service inside the OCI console. Any Quick Start that has a\n `Deploy to Oracle Cloud` button like the one below can deploy directly to ORM without any\n setup of your local environment.\n\n![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)\n\nYou will need an ssh key for almost all Quick Starts. If you don't have one already\nplease follow [these instructions](https://docs.cloud.oracle.com/iaas/Content/GSG/Tasks/creatingkeys.htm) or run the `ssh-keygen` commands in the [Setup Keys](#setup-keys) section below.\n\nTo launch a Quick Start from a local copy you've cloned, you need to complete the\nsteps below.\n\n## Install Terraform\n\nNow, we need to install Terraform.  Instructions on that are [here](https://www.terraform.io/intro/getting-started/install.html).  Depending on which OS you run the installation is slightly different:\n\n\u003cdetails\u003e\u003csummary\u003emacOS\u003c/summary\u003e\n\nThe easiest way is to install [brew](https://brew.sh/) and then used it to install Terraform with the commands:\n\n```\n/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\nsudo chown -R $(whoami) /usr/local/bin /usr/local/lib\nbrew install terraform\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eLinux\u003c/summary\u003e\n\nFor installing on Linux, just run:\n\n```\nVERSION='0.11.10' # latest, stable version\nwget \"https://releases.hashicorp.com/terraform/\"$VERSION\"/terraform_\"$VERSION\"_linux_amd64.zip\"\nunzip terraform_0.11.10_linux_amd64.zip\nsudo mv terraform /usr/local/bin/\nsudo chown root:root /usr/local/bin/terraform\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eWindows\u003c/summary\u003e\n\nThe easiest way to install Terraform and run other setup is to install [Chocolatey](https://chocolatey.org/), which is a package manager for windows.\nYou can then use Chocolatey to install Terraform and Git for Windows (which includes other needed tools).\n\nStart powershell **as Administrator** and run the commands below. `choco` will prompt to install, press `Y` and enter.\n\n```\nSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n\nchoco install terraform\nchoco install git.install --params \"/GitAndUnixToolsOnPath /NoAutoCrlf\"\n```\n\nAfter this completes close this powershell. These commands have installed Terraform, git, and other utilities we'll use later.\n\n\u003c/details\u003e\n\n\nRegardless of the OS, you can test that the install was successful by running the command:\n\n    terraform\n\nYou should see something like:\n\n![](./images/1%20-%20terraform.png)\n\nIn the past you needed to manually install the OCI Terraform Provider.  However, OCI is now integrated into the Terraform executable, so that's no longer necessary!\n\n\n## Setup Keys\nWe need to create an SSH keypair for connecting to VM instances by following [these instructions](https://docs.cloud.oracle.com/iaas/Content/GSG/Tasks/creatingkeys.htm).  Then create a key for OCI API access by following the instructions [here](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm).\n\nYou really just need to run the commands below in a terminal or regular powershell (**not** as Administrator):\n\n\u003cdetails\u003e\u003csummary\u003emacOS or Linux\u003c/summary\u003e\n\n```\nssh-keygen -t rsa -N \"\" -b 2048 -f ~/.ssh/oci\nmkdir ~/.oci\nopenssl genrsa -out ~/.oci/oci_api_key.pem 2048\nopenssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eWindows\u003c/summary\u003e\n\n```\ncd ~\\\nmd .ssh\nssh-keygen --% -t rsa -N \"\" -b 2048 -f .\\.ssh\\oci\nmd .oci\nopenssl genrsa -out .\\.oci\\oci_api_key.pem 2048\nopenssl rsa -pubout -in .\\.oci\\oci_api_key.pem -out .\\.oci\\oci_api_key_public.pem\n```\n\n\u003c/details\u003e\n\nThe output of `openssl` can be slightly different between OS's when generating the fingerprint of the public key. Run one of the following to make a correctly formatted fingerprint and to copy the public key to paste into the OCI console.\n\n\u003cdetails\u003e\u003csummary\u003emacOS\u003c/summary\u003e\n\n```\nopenssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c \u003e ~/.oci/oci_api_key.fingerprint\ncat ~/.oci/oci_api_key_public.pem | pbcopy\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eLinux\u003c/summary\u003e\n\n```\nopenssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c | awk '{print $2}' \u003e ~/.oci/oci_api_key.fingerprint\ncat ~/.oci/oci_api_key_public.pem | xclip -selection clipboard\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eWindows\u003c/summary\u003e\n\n```\ncd ~\\\nopenssl rsa -pubout -outform DER -in .oci\\oci_api_key.pem -out key.tmp\nopenssl md5 -c key.tmp | awk '{print $2}' | Out-File -Encoding ASCII -NoNewline .\\.oci\\oci_api_key.fingerprint\ndel key.tmp\nGet-Content (Resolve-Path \".\\.oci\\oci_api_key_public.pem\") -Raw -Encoding ASCII | clip.exe\n```\n\u003c/details\u003e\n\nOpen a web browser to the console [here](https://console.us-phoenix-1.oraclecloud.com/a/identity/users).  Then select your user, click \"Add Public Key\" and paste it into the dialog.\n\n![](./images/3%20-%20console.png)\n\n## Setup Environment Variables\nNow, let's take a look at the [env-vars.sh](env-vars.sh) file for macOS and [env-vars.ps1](env-vars.ps1) for Windows. You don't have to clone this repo to get the file, you can just run either:\n```\ncurl -o ~/env-vars.sh https://raw.githubusercontent.com/oracle-quickstart/oci-prerequisites/master/env-vars.sh\n# or\ncurl -o ~/env-vars.ps1 https://raw.githubusercontent.com/oracle-quickstart/oci-prerequisites/master/env-vars.ps1\n\n```\n\n![](./images/4%20-%20env-vars.png)\n\nThe script pulls values from the keys you created in the earlier steps.  You'll need to update three fields with values you can find in the [console](https://console.us-phoenix-1.oraclecloud.com/):\n\n* TF_VAR_compartment_ocid\n* TF_VAR_tenancy_ocid\n* TF_VAR_user_ocid\n\nWhen you've set all the variables, on macOs/Linux you can source the file with the command `source ~/env-vars.sh` or you could stick the contents of the file in `~/.bash_profile`:\n```\nsource ~/env-vars.sh\n```\n\nUse the command `env | grep TF` to see the variables set by the environment file. It should look something like the following:\n```\nenv | grep TF\nTF_VAR_tenancy_ocid=ocid1.tenancy....zhi3q\nTF_VAR_compartment_ocid=ocid1.compartment....e7e5q\nTF_VAR_region=us-ashburn-1\nTF_VAR_ssh_private_key=-----BEGIN OPENSSH PRIVATE KEY-----\nTF_VAR_fingerprint=50:d0:7d:f7:0e:05:cd:87:3b:2a:cb:50:b1:17:90:e9\nTF_VAR_private_key_path=~/.oci/oci_api_key.pem\nTF_VAR_ssh_public_key=ssh-rsa AAAAB....kQzpF user@hostname\nTF_VAR_user_ocid=ocid1.user....ewc5a\n```\n\n\nOn Windows run `Set-ExecutionPolicy Bypass -Scope Process -Force; ~\\env-vars.ps1`. Note, for every new powershell terminal you open these environment variables need to be created by running the above for Terraform commands to work.\n\nWith that, you're all ready to start running Terraform commands!\n\n## Create SSH Config\nWith the current setup you can SSH to a machine with the command:\n\n    ssh -i ~/.ssh/oci \u003cusername\u003e@\u003cip_address\u003e\n\nIf desired, adding some settings to our ssh_config file we can simplify that a bit.  Run the command below to append to your config:\n\n    echo -e \"\\n#OCI setup\n    Host *\n     IdentityFile ~/.ssh/oci\n     User opc\" \u003e\u003e ~/.ssh/config\n\nNow you can SSH to your OEL machines on OCI with the command:\n\n    ssh \u003cip_address\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-quickstart%2Foci-prerequisites","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle-quickstart%2Foci-prerequisites","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-quickstart%2Foci-prerequisites/lists"}