Skip to content

Commit b990e20

Browse files
authored
Add OracleDatabase/26ai-Free project (#555)
Adds an OracleDatabase/26ai-Free project, based on the OracleDatabase/23ai-Free project. No major changes from the 23ai-Free project. - Database version number updated as needed - RPM file names and configuration file name updated as needed - New db_versions.csv file listing 23.26.0 only - Product name changed from "Oracle Database" to "Oracle AI Database" where appropriate Tested with both VirtualBox and libvirt providers. Closes #554. Signed-off-by: Paul Neumann <[email protected]>
1 parent 5dea568 commit b990e20

File tree

11 files changed

+581
-0
lines changed

11 files changed

+581
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.csv text eol=lf
2+
*.sh text eol=lf
3+
*.tmpl text eol=lf
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.rpm
2+
config.local*.yaml

OracleDatabase/26ai-Free/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# oracle26ai-free-vagrant
2+
3+
This Vagrant project provisions Oracle AI Database 26ai Free automatically, using Vagrant, an Oracle Linux 9 box and a shell script. By default, it installs the latest available version of the database software, but it can be configured to install any available version (see [Configuration](#configuration)).
4+
5+
## Prerequisites
6+
7+
Read the [prerequisites in the top level README](../../README.md#prerequisites) to set up Vagrant with either VirtualBox or KVM.
8+
9+
## Getting started
10+
11+
1. Clone this repository `git clone https://github.com/oracle/vagrant-projects`
12+
2. Change into the `vagrant-projects/OracleDatabase/26ai-Free` directory
13+
3. Run `vagrant up`
14+
1. The first time you run this it will provision everything and may take a while. Ensure you have a good internet connection as the scripts will update the VM to the latest via `dnf`.
15+
2. The installation can be customized, if desired (see [Configuration](#configuration)).
16+
4. Connect to the database (see [Connecting to Oracle](#connecting-to-oracle))
17+
5. You can shut down the VM via the usual `vagrant halt` and then start it up again via `vagrant up`
18+
19+
## Connecting to Oracle
20+
21+
The default database connection parameters are:
22+
23+
* Hostname: `localhost`
24+
* Port: `1521`
25+
* SID: `FREE`
26+
* PDB: `FREEPDB1`
27+
* Database passwords are auto-generated and printed on install
28+
29+
Some of these parameters can be customized, if desired (see [Configuration](#configuration)).
30+
31+
## Resetting password
32+
33+
You can reset the password of the Oracle database accounts (SYS, SYSTEM and PDBADMIN only) by switching to the oracle user (`sudo su - oracle`), then executing `/home/oracle/setPassword.sh <Your new password>`.
34+
35+
## Running scripts after setup
36+
37+
You can have the installer run scripts after setup by putting them in the `userscripts` directory below the directory where you have this file checked out. Any shell (`.sh`) or SQL (`.sql`) scripts you put in the `userscripts` directory will be executed by the installer after the database is set up and started. Only shell and SQL scripts will be executed; all other files will be ignored. These scripts are completely optional.
38+
39+
Shell scripts will be executed as root. SQL scripts will be executed as SYS. SQL scripts will run against the CDB, not the PDB, unless you include an `ALTER SESSION SET CONTAINER = FREEPDB1` statement in the script.
40+
41+
To run scripts in a specific order, prefix the file names with a number, e.g., `01_shellscript.sh`, `02_tablespaces.sql`, `03_shellscript2.sh`, etc.
42+
43+
## Configuration
44+
45+
The `Vagrantfile` can be used _as-is_, without any additional configuration. However, there are several parameters you can set to tailor the installation to your needs.
46+
47+
### How to configure
48+
49+
There are three ways to set parameters:
50+
51+
1. Update the `Vagrantfile`. This is straightforward; the downside is that you will lose changes when you update this repository.
52+
2. Use environment variables. It might be difficult to remember the parameters used when the VM was instantiated.
53+
3. Use the `config.yaml`/`config.local.yaml` files. You can configure your installation by editing the `config.yaml` file, but `config.yaml` will be overwritten on updates, so it's better to make a copy of `config.yaml` called `config.local.yaml`, then make changes in `config.local.yaml`. The `config.local.yaml` file won't be overwritten when you update this repository and it won't mark your Git tree as changed (you won't accidentally commit your local configuration!).
54+
55+
Parameters are considered in the following order (first one wins):
56+
57+
1. Environment variables
58+
2. `config.local.yaml` (if it exists)
59+
3. `config.yaml`
60+
4. `Vagrantfile` definitions
61+
62+
### VM parameters
63+
64+
* `VM_NAME` (default: `oracle26ai-free-vagrant`): VM name.
65+
* `VM_MEMORY` (default: `2300`): Memory for the VM (in MB, 2300 MB is ~2.25 GB).
66+
* `VM_SYSTEM_TIMEZONE` (default: host time zone (if possible)): VM time zone.
67+
* The system time zone is used by the database for SYSDATE/SYSTIMESTAMP.
68+
* The guest time zone will be set to the host time zone when the host time zone is a full hour offset from GMT.
69+
* When the host time zone isn't a full hour offset from GMT (e.g., in India and parts of Australia), the guest time zone will be set to UTC.
70+
* You can specify a different time zone using a time zone name (e.g., "America/Los_Angeles") or an offset from GMT (e.g., "Etc/GMT-2"). For more information on specifying time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
71+
72+
### Oracle database parameters
73+
74+
* `VM_DB_VERSION` (default: `latest`): Database version to install. Must be one of the versions listed in the `db_versions.csv` file.
75+
* `VM_KEEP_DB_INSTALLER` (default: `false`): Save the database installer RPM file for reuse when VM is rebuilt.
76+
* `VM_ORACLE_CHARACTERSET` (default: `AL32UTF8`): Database character set.
77+
* `VM_LISTENER_PORT` (default: `1521`): Listener port.
78+
* `VM_ORACLE_PWD` (default: automatically generated): Oracle database password for the SYS, SYSTEM and PDBADMIN accounts. **Important: Database creation will fail if the password contains spaces or special characters.**
79+
80+
## Optional plugin
81+
82+
When installed, this Vagrant project will make use of the following third party Vagrant plugin:
83+
84+
* [vagrant-proxyconf](https://github.com/tmatilai/vagrant-proxyconf): set
85+
proxies in the guest VM if you need to access the Internet through a proxy. See
86+
the plugin documentation for configuration.
87+
88+
To install Vagrant plugins run:
89+
90+
```shell
91+
vagrant plugin install <name>...
92+
```
93+
94+
## Other info
95+
96+
* If you need to, you can connect to the virtual machine via `vagrant ssh`.
97+
* You can `sudo su - oracle` to switch to the oracle user.
98+
* On the guest OS, the directory `/vagrant` is a shared folder and maps to wherever you have this file checked out.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#
2+
# Copyright (c) 2025 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at
4+
# https://oss.oracle.com/licenses/upl.
5+
#
6+
# Since: July, 2018
7+
8+
# Description: Creates an Oracle AI Database Vagrant virtual machine.
9+
# Optional plugin:
10+
# vagrant-proxyconf (if you don't have direct access to the Internet)
11+
# see https://github.com/tmatilai/vagrant-proxyconf for configuration
12+
#
13+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14+
#
15+
16+
# -*- mode: ruby -*-
17+
# vi: set ft=ruby :
18+
require 'yaml'
19+
20+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
21+
VAGRANTFILE_API_VERSION = "2"
22+
23+
# Box metadata location and box name
24+
BOX_URL = "https://oracle.github.io/vagrant-projects/boxes"
25+
BOX_NAME = "oraclelinux/9"
26+
27+
# UI object for printing information
28+
ui = Vagrant::UI::Prefixed.new(Vagrant::UI::Colored.new, "vagrant")
29+
30+
# Define constants
31+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
32+
# Load configuration parameters into environment
33+
['config.local.yaml', 'config.yaml'].each do |f|
34+
cfg = File.file?(f) ? YAML.safe_load_file(f, freeze: true) : {}
35+
cfg && cfg.each do |key, value|
36+
key = key.upcase
37+
(!ENV[key] || ENV[key].empty?) && ENV[key] = value.to_s
38+
end
39+
end
40+
41+
# VM name
42+
VM_NAME = default_s('VM_NAME', 'oracle26ai-free-vagrant')
43+
44+
# Memory for the VM (in MB, 2300 MB is ~2.25 GB)
45+
VM_MEMORY = default_i('VM_MEMORY', 2300)
46+
47+
# VM time zone
48+
# If not specified, will be set to match host time zone (if possible)
49+
VM_SYSTEM_TIMEZONE = default_s('VM_SYSTEM_TIMEZONE', host_tz)
50+
51+
# Database version to install; default is the latest available
52+
# Must be one of the versions listed in the db_versions.csv file
53+
VM_DB_VERSION = default_s('VM_DB_VERSION', 'latest')
54+
55+
# Save database installer RPM file for reuse when VM is rebuilt
56+
VM_KEEP_DB_INSTALLER = default_b('VM_KEEP_DB_INSTALLER', false)
57+
58+
# Database character set
59+
VM_ORACLE_CHARACTERSET = default_s('VM_ORACLE_CHARACTERSET', 'AL32UTF8')
60+
61+
# Listener port
62+
VM_LISTENER_PORT = default_i('VM_LISTENER_PORT', 1521)
63+
64+
# Oracle database password for the SYS, SYSTEM and PDBADMIN accounts
65+
# If left blank, the password will be generated automatically
66+
# Database creation will fail if the password contains spaces or special characters
67+
VM_ORACLE_PWD = default_s('VM_ORACLE_PWD', '')
68+
end
69+
70+
# Convenience methods
71+
def default_s(key, default)
72+
ENV[key] && ! ENV[key].empty? ? ENV[key] : default
73+
end
74+
75+
def default_i(key, default)
76+
default_s(key, default).to_i
77+
end
78+
79+
def default_b(key, default)
80+
default_s(key, default).to_s.downcase == "true"
81+
end
82+
83+
def host_tz
84+
# get host time zone for setting VM time zone
85+
# if host time zone isn't an integer hour offset from GMT, fall back to UTC
86+
offset_sec = Time.now.gmt_offset
87+
if (offset_sec % (60 * 60)) == 0
88+
offset_hr = ((offset_sec / 60) / 60)
89+
timezone_suffix = offset_hr >= 0 ? "-#{offset_hr.to_s}" : "+#{(-offset_hr).to_s}"
90+
'Etc/GMT' + timezone_suffix
91+
else
92+
'UTC'
93+
end
94+
end
95+
96+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
97+
config.vm.box = BOX_NAME
98+
config.vm.box_url = "#{BOX_URL}/#{BOX_NAME}.json"
99+
config.vm.define VM_NAME
100+
101+
# Provider-specific configuration
102+
config.vm.provider "virtualbox" do |v|
103+
v.memory = VM_MEMORY
104+
v.name = VM_NAME
105+
end
106+
config.vm.provider :libvirt do |v|
107+
v.memory = VM_MEMORY
108+
end
109+
110+
# add proxy configuration from host env - optional
111+
if Vagrant.has_plugin?("vagrant-proxyconf")
112+
ui.info "Getting Proxy Configuration from Host..."
113+
has_proxy = false
114+
["http_proxy", "HTTP_PROXY"].each do |proxy_var|
115+
if proxy = ENV[proxy_var]
116+
ui.info "HTTP proxy: " + proxy
117+
config.proxy.http = proxy
118+
has_proxy = true
119+
break
120+
end
121+
end
122+
123+
["https_proxy", "HTTPS_PROXY"].each do |proxy_var|
124+
if proxy = ENV[proxy_var]
125+
ui.info "HTTPS proxy: " + proxy
126+
config.proxy.https = proxy
127+
has_proxy = true
128+
break
129+
end
130+
end
131+
132+
if has_proxy
133+
# Only consider no_proxy if we have proxies defined.
134+
no_proxy = ""
135+
["no_proxy", "NO_PROXY"].each do |proxy_var|
136+
if ENV[proxy_var]
137+
no_proxy = ENV[proxy_var]
138+
ui.info "No proxy: " + no_proxy
139+
no_proxy += ","
140+
break
141+
end
142+
end
143+
config.proxy.no_proxy = no_proxy + "localhost,127.0.0.1"
144+
end
145+
else
146+
["http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY"].each do |proxy_var|
147+
if ENV[proxy_var]
148+
ui.warn 'To enable proxies in your VM, install the vagrant-proxyconf plugin'
149+
break
150+
end
151+
end
152+
end
153+
154+
# VM hostname
155+
# must be "localhost", or listener configuration will fail
156+
config.vm.hostname = "localhost"
157+
158+
# Oracle port forwarding
159+
config.vm.network "forwarded_port", guest: VM_LISTENER_PORT, host: VM_LISTENER_PORT
160+
161+
# Provision everything on the first run
162+
config.vm.provision "shell", path: "scripts/install.sh", env:
163+
{
164+
"SYSTEM_TIMEZONE" => VM_SYSTEM_TIMEZONE,
165+
"DB_VERSION" => VM_DB_VERSION,
166+
"KEEP_DB_INSTALLER" => VM_KEEP_DB_INSTALLER,
167+
"ORACLE_CHARACTERSET" => VM_ORACLE_CHARACTERSET,
168+
"LISTENER_PORT" => VM_LISTENER_PORT,
169+
"ORACLE_PWD" => VM_ORACLE_PWD
170+
}
171+
172+
end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# Oracle AI Database 26ai Free configuration file
3+
#
4+
# This file will be overwritten on updates, so it is recommended to make a copy
5+
# of this file called config.local.yaml, then make changes in config.local.yaml.
6+
#
7+
# To change a parameter, uncomment it and set it to the desired value.
8+
# All commented parameters will retain their default values.
9+
10+
# VM name
11+
#VM_NAME: 'oracle26ai-free-vagrant'
12+
13+
# Memory for the VM (in MB, 2300 MB is ~2.25 GB)
14+
#VM_MEMORY: 2300
15+
16+
# VM time zone
17+
# If not specified, will be set to match host time zone (if possible)
18+
# Can use time zone name (e.g., 'America/Los_Angeles')
19+
# or an offset from GMT (e.g., 'Etc/GMT-2')
20+
#VM_SYSTEM_TIMEZONE: ''
21+
22+
# Database version to install; default is the latest available
23+
# Must be one of the versions listed in the db_versions.csv file
24+
#VM_DB_VERSION: 'latest'
25+
26+
# Save database installer RPM file for reuse when VM is rebuilt
27+
#VM_KEEP_DB_INSTALLER: false
28+
29+
# Database character set
30+
#VM_ORACLE_CHARACTERSET: 'AL32UTF8'
31+
32+
# Listener port
33+
#VM_LISTENER_PORT: 1521
34+
35+
# Oracle database password for the SYS, SYSTEM and PDBADMIN accounts
36+
# If left blank, the password will be generated automatically
37+
# Database creation will fail if the password contains spaces or special characters
38+
#VM_ORACLE_PWD: ''
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
latest,https://download.oracle.com/otn-pub/otn_software/db-free/,oracle-ai-database-free-26ai-23.26.0-1.el9.x86_64.rpm,346d08a1bc836e97ca74f3c4f1bb3a8d80726480be28991b36b72ee648a06666
2+
23.26.0,https://download.oracle.com/otn-pub/otn_software/db-free/,oracle-ai-database-free-26ai-23.26.0-1.el9.x86_64.rpm,346d08a1bc836e97ca74f3c4f1bb3a8d80726480be28991b36b72ee648a06666
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#This is a configuration file to setup the Oracle AI Database.
2+
#It is used when running '/etc/init.d/oracle-free-26ai configure'.
3+
4+
# LISTENER PORT used Database listener, Leave empty for automatic port assignment
5+
LISTENER_PORT=###LISTENER_PORT###
6+
7+
# Character set of the database
8+
CHARSET=###ORACLE_CHARACTERSET###
9+
10+
# Database file directory
11+
# If not specified, database files are stored under Oracle base/oradata
12+
DBFILE_DEST=
13+
14+
# DB Domain name
15+
DB_DOMAIN=
16+
17+
# Configure TDE
18+
CONFIGURE_TDE=false
19+
20+
# Encrypt Tablespaces list, Leave empty for user tablespace alone or provide ALL for encrypting all tablespaces
21+
# For specific tablespaces use SYSTEM:true,SYSAUX:false
22+
ENCRYPT_TABLESPACES=
23+
24+
# SKIP Validations, memory, space
25+
SKIP_VALIDATIONS=false

0 commit comments

Comments
 (0)