一、检查硬件需求
1、检查内存空间大小
[root@tech_002 ~]# grep MemTotal /proc/meminfo
MemTotal: 3041772 kB
MemTotal: 3041772 kB
2、查看交换分区swap
[root@tech_002 home]# grep SwapTotal
/proc/meminfo SwapTotal: 2031608 kB
/proc/meminfo SwapTotal: 2031608 kB
3、假如交换分区空间不够,可以增加
创建/home/swap这么一个分区文件。文件的大小是5120000个block,一般情况下1个block为1K,所以这里空间是5G。
dd if=/dev/zero of=/home/swap bs=1024 count=5120000
5120000+0 records in
5120000+0 records out
5242880000 bytes (5.2 GB) copied, 39.3974 seconds, 133 MB/s
5120000+0 records in
5120000+0 records out
5242880000 bytes (5.2 GB) copied, 39.3974 seconds, 133 MB/s
接着再把这个分区变成swap分区。
[root@tech_002 home]# /sbin/mkswap /home/swap
Setting up swapspace version 1, size = 5242875 kB
Setting up swapspace version 1, size = 5242875 kB
然后把它加到fstab里面
[root@tech_002 home]# echo "/home/swap swap swap defaults 0 0" >> /etc/fstab ; cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/home/swap swap swap defaults 0 0
4、oracle 11g 所必须的安装包
[root@tech_002 ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
binutils-2.17.50.0.6-6.el5
compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125-3.el5
glibc-2.5-24
glibc-2.5-24
glibc-common-2.5-24
glibc-devel-2.5-24
glibc-devel-2.5-24
gcc-4.1.2-42.el5
gcc-c++-4.1.2-42.el5
libaio-devel-0.3.106-3.2
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libaio-0.3.106-3.2
libgcc-4.1.2-42.el5
libgcc-4.1.2-42.el5
libstdc++-4.1.2-42.el5
libstdc++-4.1.2-42.el5
libstdc++-devel-4.1.2-42.el5
make-3.81-3.el5
sysstat-7.0.2-1.el5
unixODBC-2.2.11-7.1
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
binutils-2.17.50.0.6-6.el5
compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125-3.el5
glibc-2.5-24
glibc-2.5-24
glibc-common-2.5-24
glibc-devel-2.5-24
glibc-devel-2.5-24
gcc-4.1.2-42.el5
gcc-c++-4.1.2-42.el5
libaio-devel-0.3.106-3.2
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libaio-0.3.106-3.2
libgcc-4.1.2-42.el5
libgcc-4.1.2-42.el5
libstdc++-4.1.2-42.el5
libstdc++-4.1.2-42.el5
libstdc++-devel-4.1.2-42.el5
make-3.81-3.el5
sysstat-7.0.2-1.el5
unixODBC-2.2.11-7.1
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
5、配置内核参数
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max=4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max=4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF
然后执行
[root@tech_002 etc]# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
6、给系统添加oracle用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
7、添加参数
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat >> /etc/pam.d/login <<EOF
session required /lib/security/pam_limits.so
session required pam_limits.so
EOF
session required /lib/security/pam_limits.so
session required pam_limits.so
EOF
cat >> /etc/profile <<EOF
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
8、创建目录
mkdir -p /oracle_11/app/
chown -R oracle:oinstall /oracle_11/app/
chmod -R 755 /oracle_11/app/
sudo mkdir /oracle_11/tmp
sudo chmod a+wr /oracle_11/tmp
chown -R oracle:oinstall /oracle_11/app/
chmod -R 755 /oracle_11/app/
sudo mkdir /oracle_11/tmp
sudo chmod a+wr /oracle_11/tmp
9、修改用户的shell
more /home/oracle/.bash_profile
# .bash_profile
umask 022
TMP=/oracle_11/tmp
TMPDIR=/oracle_11/tmp
export TMP TMPDIR
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/oracle_11/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/crs
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:${PATH}:$HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export LIBPATH=$LIBPATH:$ORA_CRS_HOME/lib:$ORACLE_HOME/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/JRE
export NLS_LANG=AMERICAN_AMERICA.ZHS16G
# .bash_profile
umask 022
TMP=/oracle_11/tmp
TMPDIR=/oracle_11/tmp
export TMP TMPDIR
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/oracle_11/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/crs
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:${PATH}:$HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export LIBPATH=$LIBPATH:$ORA_CRS_HOME/lib:$ORACLE_HOME/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/JRE
export NLS_LANG=AMERICAN_AMERICA.ZHS16G
10、用Xstart连接centos的图形界面
![查看更多精彩图片](https://i-blog.csdnimg.cn/blog_migrate/02cf2788629dedf346dca2c6e3799a36.jpeg)
解压数据库文件,安装数据库
#unzip linux.x64_11gR1_database.zip
#su - oracle
$export DISPLAY=192.168.93.202:0.0
$./runInstaller
#su - oracle
$export DISPLAY=192.168.93.202:0.0
$./runInstaller