How to Install and Set Up Oracle Database on Linux (Step-by-Step Guide)
Oracle Database is one of the most powerful and widely used relational database management systems (RDBMS) in the world. Whether you're a developer, database administrator, or IT professional, setting up Oracle Database on Linux is a crucial skill. In this guide, we’ll walk you through the process of installing and configuring Oracle Database on a Linux system.
Prerequisites
Before you begin, ensure you have the following:
- Linux Operating System: Oracle supports various Linux distributions like Oracle Linux, Red Hat, CentOS, and Ubuntu.
- Hardware Requirements:
- At least 2 GB RAM (4 GB or more recommended).
- 10 GB of free disk space (20 GB or more recommended).
- Oracle Database Software: Download the Oracle Database installation files from the Oracle Technology Network (OTN).
- Root or Sudo Access: You need administrative privileges to install and configure the database.
Step 1: Update Your System
Before installing Oracle Database, update your Linux system to ensure all packages are up to date.
sudo yum update -y # For CentOS/RHEL/Oracle Linux
sudo apt update && sudo apt upgrade -y # For Ubuntu/Debian
Step 2: Install Required Packages
Oracle Database requires specific packages and libraries to function properly. Install them using the following commands:
For CentOS/RHEL/Oracle Linux:
sudo yum install -y binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-develksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
For Ubuntu/Debian:
sudo apt install -y build-essential libaio1 libaio-dev unixodbc unixodbc-dev sysstat ksh libstdc++6 libxtst6 libxi6
Step 3: Create Oracle User and Groups
Oracle Database should not be installed as the root user. Create a dedicated user and groups for Oracle.
sudo groupadd oinstall
sudo groupadd dba
sudo useradd -g oinstall -G dba oracle
sudo passwd oracle
Step 4: Configure Kernel Parameters
Oracle Database requires specific kernel parameters to be set. Edit the /etc/sysctl.conf file:
sudo vi /etc/sysctl.conf
Add the following lines:
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
Apply the changes:
sudo sysctl -p
Step 5: Set User Limits
Edit the /etc/security/limits.conf file to set resource limits for the Oracle user.
sudo vi /etc/security/limits.conf
Add the following lines:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
Step 6: Create Oracle Directories
Create directories for Oracle installation and set the appropriate permissions.
sudo mkdir -p /u01/app/oracle
sudo chown -R oracle:oinstall /u01/app
sudo chmod -R 775 /u01/app
Step 7: Set Environment Variables
Switch to the oracle user and set the environment variables in the .bash_profile file.
su - oracle
vi ~/.bash_profile
Add the following lines:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
Reload the profile:
source ~/.bash_profile
Step 8: Install Oracle Database
- Download Oracle Database: Download the installation files from the Oracle Technology Network (OTN).
- Unzip the Files:
unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME - Run the Installer:
cd $ORACLE_HOME ./runInstaller - Follow the Installation Wizard:
- Choose "Set Up Software Only" or "Create and Configure a Database."
- Provide the Oracle Base and Home paths.
- Complete the installation.
Step 9: Run Configuration Scripts
After installation, run the configuration scripts as the root user.
sudo /u01/app/oraInventory/orainstRoot.sh
sudo /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Step 10: Create a Database
If you chose "Set Up Software Only," you can create a database using the Database Configuration Assistant (DBCA).
dbca
Follow the wizard to create a new database.
Step 11: Start and Stop Oracle Database
- Start the Database:
sqlplus / as sysdba SQL> startup; - Stop the Database:
sqlplus / as sysdba SQL> shutdown immediate;
Step 12: Verify the Installation
Verify the installation by connecting to the database:
sqlplus / as sysdba
SQL> SELECT * FROM v$version;
Conclusion
Congratulations! You’ve successfully installed and set up Oracle Database on Linux. This setup is ideal for development, testing, or production environments.
Feel free to leave a comment below if you have any questions or need further clarification. Happy database management!
Thank you sir for this valuable information
ReplyDeleteYou're very welcome! I'm glad I could help. Let me know if you need anything else. ๐๐
ReplyDelete