Ubuntu18.04安装Oracle19c(尝试记录)
按照⽹上教程主要分为四个⼤步骤:
  Java的安装
  Oracle安装前的准备
  Oracle的安装环境配置
  安装Oracle
1、Java安装
设置Java环境
sudo gedit /etc/profile
在⽂件末尾添加如下内容
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_161
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
然后执⾏如下命令
source /etc/profile
echo $JAVA_HOME
验证Java是否安装成功:
java -version
2、Oracle安装前的准备
(1)运⾏以下命令来安装依赖项
sudo apt-get update
sudo apt-get dist-upgrade
重启系统
sudo init 6
再次检查更新
sudo apt-get dist-upgrade
(2)安装Oracle所需要的依赖包
sudo apt-get -y install automake
sudo apt-get -y install autotools-dev
sudo apt-get -y install binutils
sudo apt-get -y install bzip2
sudo apt-get -y install elfutils
sudo apt-get -y install expat
sudo apt-get -y install gawk
sudo apt-get -y install gcc
sudo apt-get -y install gcc-multilib
sudo apt-get -y install g++-multilib
sudo apt-get -y install ia32-libs
sudo apt-get -y install ksh
sudo apt-get -y install less
sudo apt-get -y install lesstif2
sudo apt-get -y install lesstif2-dev
sudo apt-get -y install lib32z1
sudo apt-get -y install libaio1
sudo apt-get -y install libaio-dev
sudo apt-get -y install libc6-dev
sudo apt-get -y install libc6-dev-i386
sudo apt-get -y install libc6-i386
sudo apt-get -y install libelf-dev
sudo apt-get -y install libltdl-dev
sudo apt-get -y install libmotif4
sudo apt-get -y install libodbcinstq4-1 libodbcinstq4-1:i386 sudo apt-get -y install libpth-dev
sudo apt-get -y install libpthread-stubs0
sudo apt-get -y install libpthread-stubs0-dev
sudo apt-get -y install libstdc++5
sudo apt-get -y install lsb-cxx
sudo apt-get -y install make
sudo apt-get -y install openssh-server
sudo apt-get -y install pdksh
sudo apt-get -y install rlwrap
sudo apt-get -y install rpm
sudo apt-get -y install sysstat
sudo apt-get -y install unixodbc
sudo apt-get -y install unixodbc-dev
sudo apt-get -y install unzip
sudo apt-get -y install x11-utils
sudo apt-get -y install zlibc
(3) 检查系统变量
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep aio-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/
sbin/sysctl -a | grep wmem_max
根据每⼀条显⽰的信息更新下列参数的值。并将下列参数写⼊ /f 中sudo vim /f
fs.aio-max-nr = 65536
fs.file-max = 13158378
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
kernel.shmmni = 4096
kernel.sem = 32000 1024000000 500 32000
net.ipv4.ip_local_port_range = 32768 60999
运⾏⼀下命令更新内核参数:
sudo sysctl –p
(其他)这部第⼆种⽅式(未实验,配合已创建Oracle⽤户的)
Create user and groups(这部我跳过了,注意这个不是Ubuntu的对应路径) sudo addgroup oinstall
sudo addgroup dba
sudo addgroup nobody
sudo usermod -g nobody nobody
sudo useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle sudo mkdir /home/oracle
sudo chown -R oracle:dba /home/oracle
sudo mkdir -p /u01/app/oracle
sudo mkdir -p /u01/binaries
sudo chown -R oracle:dba /u01
为oracle⽤户创建密码:输⼊两次
sudo passwd oracle
运⾏以下为oracle⽤户改变⼀些系统参数
sudo cp /etc/f /etc/f.original
ubuntu安装教程echo "#Oracle 12C shell limits:" | sudo tee -a /etc/f
echo "oracle soft nproc 2048" | sudo tee -a /etc/f
echo "oracle hard nproc 16384"| sudo tee -a /etc/f
echo "oracle soft nofile 1024" | sudo tee -a /etc/f
echo "oracle hard nofile 65536" | sudo tee -a /etc/f
echo "oracle soft stack 10240" | sudo tee -a /etc/f
echo "oracle hard stack 32768" | sudo tee -a /etc/f
运⾏以下命令改变内核参数
echo "#" | sudo tee -a /f
echo "# Oracle 12C entries" | sudo tee -a /f
echo "fs.aio-max-nr=1048576" | sudo tee -a /f
echo "fs.file-max=6815744" | sudo tee -a /f
echo "kernel.shmall=2097152" | sudo tee -a /f
echo "kernel.shmmni=4096" | sudo tee -a /f
echo "kernel.sem=250 32000 100 128" | sudo tee -a /f
echo "net.ipv4.ip_local_port_range=9000 65500" | sudo tee -a /f
echo "_default=262144" | sudo tee -a /f
echo "_max=4194304" | sudo tee -a /f
echo "wmem_default=262144" | sudo tee -a /f
echo "wmem_max=1048586" | sudo tee -a /f
echo "kernel.shmmax=1073741824" | sudo tee -a /f
为使改变数据⽣效,执⾏:
sudo sysctl -p
创建启动脚本
mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S
do sudo ln -s /etc/rc$i.d /etc/rc.d/rc$i.d
done
重启后⽤oracle⽤户登录。(⾄此全部我没有实验)
(4)添加对⽤户的内核限制
添加对heima3⽤户的内核限制在f⽂件中增加以下数据
注:其中heima3是我ubuntu系统的普通⽤户。个⼈感激没必要再创建⼀个⽤户专门⽤于Oracle,使⽤常⽤⽤户即可。(下⾯语句只改⽤户名就⾏)
vim /etc/f
heima3              soft    nproc  2047
heima3              hard    nproc  16384
heima3              soft    nofile  1024
heima3              hard    nofile  65536
heima3              soft    stack  10240
(5)查看⼀些别的配置
1)查看/etc/pam.d/login,增加以下⾏(有了就不⽤增加了):
session required pam_limits.so
2)检查/etc/pam.d/su,没有以下⾏就⾃⼰加上:
session required pam_limits.so
(6)创建需要的⽂件夹,⽤来放Oracle的安装⽂件
sudo makdir /home/heima3/Oracle_install
(7)为Oracle配置环境变量
在 .profile ⽂件中添加变量。
sudo vim /etc/profile
在⽂件中添加环境变量
#oracle安装⽬录,第5步创建的⽂件夹
export ORACLE_BASE=/home/heima3/Oracle_install
#⽹上说可以随便写
export ORACLE_HOME=/home/heima3/app/product/19.3.0/dbhome_1 #版本号#数据库的sid
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
#默认字符集
export NLS_LANG=.AL32UTF8
#环境变量
export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64;
变量设置完成后,别忘记让 profile 变量⽣效
source  /etc/profile
再确定⼀遍
echo $ORACLE_HOME
(8)oracle默认不⽀持ubuntu需要欺骗⼀下oracle安装程序
sudo mkdir /usr/lib64
sudo ln -s /etc /etc/rc.d
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a