Skip to content

Instantly share code, notes, and snippets.

@luzfcb
Created April 15, 2026 12:25
Show Gist options
  • Select an option

  • Save luzfcb/4770500adaf392825ff57c904d3444e1 to your computer and use it in GitHub Desktop.

Select an option

Save luzfcb/4770500adaf392825ff57c904d3444e1 to your computer and use it in GitHub Desktop.

Revisions

  1. luzfcb created this gist Apr 15, 2026.
    36 changes: 36 additions & 0 deletions oracle_instant_client_install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    #!/bin/bash
    set -euo pipefail

    # Configurations
    # latest version of instant client basic lite
    export ORACLE_INSTANT_CLIENT_URL="https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip"
    TMP_DIR="/tmp/oracle"
    INSTALL_DIR="/opt/oracle"

    echo "Starting the Oracle Instant Client installation..."

    # 1. Prepare directories
    mkdir -p "$TMP_DIR"
    sudo mkdir -p "$INSTALL_DIR"

    # 2. Download
    echo "Downloading the package..."
    wget --progress=dot:giga --tries 3 --wait 2 --output-document "$TMP_DIR/instantclient.zip" "$ORACLE_INSTANT_CLIENT_URL"

    # 3. Extraction
    echo "Extracting files..."
    sudo unzip -o "$TMP_DIR/instantclient.zip" -d "$INSTALL_DIR"

    # 4. Cleaning up unnecessary files
    sudo rm -rf "$INSTALL_DIR/META-INF"
    rm -rf "$TMP_DIR"

    # 5. Linker Configuration
    echo "Configurando bibliotecas do sistema..."
    # The command below finds the newly created directory (e.g., instantclient_21_1) and saves it to the conf file.
    find "$INSTALL_DIR" -maxdepth 1 -type d -name "instantclient*" | sudo tee /etc/ld.so.conf.d/oracle-instantclient.conf > /dev/null

    # 6. Update library cache
    sudo ldconfig

    echo "Installation completed successfully!"