File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ install-OracleDatabase/
118118├── compose.yml # Docker Compose configuration
119119├── Dockerfile.ol7 # Oracle Linux 7 base image
120120├── Dockerfile.ol8 # Oracle Linux 8 base image
121+ ├── setup-swap.sh # Host swap space setup script for Oracle requirements
121122├── test-database.sh # Database status testing script (validates DB installation)
122123├── CLAUDE.md # AI assistant instructions for Claude Code
123124├── README.md # Main project documentation
@@ -127,8 +128,13 @@ install-OracleDatabase/
127128
128129#### Available Make Commands
129130
130- ** Container Management ** :
131+ ** General ** :
131132- ` make help ` - Show all available commands
133+
134+ ** Host Environment Setup** :
135+ - ` make setup-swap ` - Setup swap space for Oracle installation (default: 2048MB)
136+
137+ ** Container Management** :
132138- ` make build ` - Build Docker images
133139- ` make build-ol7 ` - Build Oracle Linux 7 image
134140- ` make build-ol8 ` - Build Oracle Linux 8 image
Original file line number Diff line number Diff line change 3636 @echo "Available targets:"
3737 @awk 'BEGIN {FS = ":.*?# # "} /^[0-9A-Za-z_.-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
3838
39+ setup-swap : # # Setup swap space for Oracle installation (default: 2048MB)
40+ @sudo ./setup-swap.sh 2048
41+
3942build : build-ol7 build-ol8 # # Build Docker images
4043
4144build-ol7 : # # Build Oracle Linux 7 image
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ if [[ " $EUID " -ne 0 ]]; then
5+ echo " Please run as root or with sudo"
6+ exit 1
7+ fi
8+
9+ target_swap_mb=" ${1:- 2048} "
10+
11+ current_swap_mb=$( free -m | awk ' /Swap/ {print $2}' )
12+ echo " Current swap: ${current_swap_mb} MB"
13+ echo " Target swap: ${target_swap_mb} MB"
14+
15+ if [[ " $current_swap_mb " -ge " $target_swap_mb " ]]; then
16+ echo " Swap is sufficient (${current_swap_mb} MB >= ${target_swap_mb} MB)"
17+ exit 0
18+ fi
19+
20+ additional_swap_mb=$(( target_swap_mb - current_swap_mb))
21+ echo " Adding ${additional_swap_mb} MB of swap..."
22+
23+ swapfile=" /swapfile"
24+ counter=1
25+ while [[ -f " $swapfile " ]]; do
26+ counter=$(( counter + 1 ))
27+ swapfile=" /swapfile${counter} "
28+ done
29+
30+ echo " Creating ${swapfile} with ${additional_swap_mb} MB..."
31+
32+ dd if=/dev/zero of=" $swapfile " bs=1M count=" $additional_swap_mb " status=progress
33+ chmod 600 " $swapfile "
34+ mkswap " $swapfile "
35+ swapon " $swapfile "
36+
37+ grep -q " $swapfile " /etc/fstab || echo " $swapfile none swap sw 0 0" >> /etc/fstab
38+
39+ echo " Swap setup complete:"
40+ free -h | grep Swap
You can’t perform that action at this time.
0 commit comments