Linux上Oracle 11g安装步骤图解 - gaojun - 博客园
另,可参考:
Redhat Linux安装Oracle 11g R2数据库
1、检查硬件
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah
2、下载软件
Oracle Database 10g Release 2 (10.2.0.1) Software下载位置:
http://otn.oracle.com/software/products/database/oracle10g/index.html
3、修改host文件
查看/etc/hosts文件中必须包含a fully qualified name for the server
4、安装软件包检查
1、检查下列包是否安装,若未安装则要先安装:
binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
gcc-4.1.1-52
gcc-c++-4.1.1-52
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
unixODBC-2.2.11
unixODBC-devel-2.2.11
# rpm -qa | grep make gcc glibc compat openmotif21 setarch 等等
5、libstdc包的链接
(老版本需求,新版本oracle11不要设置):
ln -s /usr/lib/libstdc++.so.6.0.3 /usr/lib/libstdc++.so.5
#检测存在如果不做此链接,在安装过程中建好数据库,将会出现不能链接不上数据库问题。
三.参数设置
1、设置核心参数
在/etc/sysctl.conf文件中加入下列行:
#kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 2147483648 -- (以字节为单位,物理内存数量*1024*1024*2,为内存的2倍)
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=8388608
net.core.rmem_max=8388608
net.core.wmem_default=262144
net.core.wmem_max=262144
esc :wq!
# sysctl -p #运行下列命令改变核心参数
2、设置Shell Limits(系统资源限制),提高软件的运行效率
a.在/etc/security/limits.conf文件中加入下列红色行:
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
b.在/etc/pam.d/login文件中加入下列行,如果里面没有的话:
session required /lib/security/pam_limits.so
session required pam_limits.so
c.在/etc/profile后加入以下语句:
vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
3.创建用户和组及相关目录
--创建dba/oper/oinstall组
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/groupadd oinstall
--创建oracle用户并设置用户所属组
/usr/sbin/usermod -g oinstall -G dba oracle
/usr/sbin/useradd -g oinstall -G dba oracle
passwd oracle
# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
--创建相关安装目录
mkdir -p /opt/oracle/product
mkdir -p /opt/oracle/product/OraHome
mkdir -p /opt/oraInventory #(the default inventory folder)
mkdir -p /opt/oracle/oradata #(change the right file owner)
mkdir -p /var/opt/oracle
--设置目录所有者和权限
chown -R oracle.oinstall /opt/oracle
chown -R oracle.oinstall /opt/oracle/oradata
chown -R oracle.oinstall /opt/oracle/product/OraHome
chown -R oracle.dba /opt/oraInventory
chown oracle.dba /var/opt/oracle
chmod -R 775 /opt/oracle
chmod -R 755 /var/opt/oracle
4.设置安装环境变量
# su - oracle --su到oracle用户下,
更改用户的一些配置
$vi .bash_profile
添加以下参数,主要是配置oracle软件运环境参数
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/OraHome
export ORACLE_SID=orcl
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
注:
11g:ORA_NLS33=$ORACLE_HOME/nls/admin/data
10g:ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
9i:ORA_NLS33=/oracle/app/ora92/ocommon/nls/admin/data
保存退出
--执行以下命令让配置马上生效或以oracle用户登录使设置生效
$ source $HOME/.bash_profile
Silent Oracle 11g R2 install using only the command line | Beyond Oracle
1. Add Oracle public yum repository.
[root@localhost ~]$ cd /etc/yum.repos.d [root@localhost ~]$ wget http://public-yum.oracle.com/public-yum-el5.repo
# edit the file public-yum-el5.repo and enable both the [el5_u5_base] and the [ol5_u5_base] repositories in the yum configuration file by changing enable=0 to enable=1 in those sections
2. Install Oracle validated packages
[root@localhost ~]$ yum install oracle-validated
3. Download and Install Oracle software on command line
[root@localhost ~]$ su - oracle [oracle@localhost ~]$ cd /software/11gr2/database [oracle@localhost database]$ ./runInstaller -silent -force \ FROM_LOCATION=/software/11gr2/database/stage/products.xml \ oracle.install.option=INSTALL_DB_SWONLY \ UNIX_GROUP_NAME=oinstall \ INVENTORY_LOCATION=/home/oracle/oraInventory \ ORACLE_HOME=/u01/app/oracle/product/11.2/db_1 \ ORACLE_HOME_NAME="OraDb11g_Home1" \ ORACLE_BASE=/u01/app/oracle \ oracle.install.db.InstallEdition=SE \ oracle.install.db.isCustomInstall=false \ oracle.install.db.DBA_GROUP=dba \ oracle.install.db.OPER_GROUP=dba \ DECLINE_SECURITY_UPDATES=true [oracle@localhost database]$ exit # As a root user, execute the following script(s): [root@localhost ~]$ /home/oracle/oraInventory/orainstRoot.sh [root@localhost ~]$ /u01/app/oracle/product/11.2/db_1/root.sh
linux下IPTABLES配置详解 - 草原和大树 - 博客园
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
可以看出我在安装linux时,选择了有防火墙,并且开放了22,80,25端口.
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
[root@tp ~]# iptables -X 清除预设表filter中使用者自定链中的规则
Chain INPUT (policy ACCEPT)
target prot opt source destination
target prot opt source destination
target prot opt source destination
上面的意思是,当超出了IPTABLES里filter表里的两个链规则(INPUT,FORWARD)时,不在这两个规则里的数据包怎么处理呢,那就是DROP(放弃).应该说这样配置是很安全的.我们要控制流入数据包
如果做了邮件服务器,开启25,110端口.
[root@tp ~]# iptables -A INPUT -p tcp --dport 25 -j ACCEPT
如果做了FTP服务器,开启21端口
IPTABLES -A OUTPUT -o lo -p all -j ACCEPT(如果是OUTPUT DROP)
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
target prot opt source destination
SNAT all -- 192.168.0.0/24 anywhere to:211.101.46.235
target prot opt source destination
[root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 172.16.0.0/12 -j DROP
[root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.0/16 -j DROP
如果我们想,比如阻止MSN,QQ,BT等的话,需要找到它们所用的端口或者IP,(个人认为没有太大必要)
[root@tp ~]# iptables -A INPUT -m state --state INVALID -j DROP
[root@tp ~]# iptables -A OUTPUT -m state --state INVALID -j DROP
[root@tp ~]# iptables-A FORWARD -m state --state INVALID -j DROP
允许所有已经建立的和相关的连接
[root@tp ~]# iptables-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@tp ~]# iptables-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@tp ~]# /etc/rc.d/init.d/iptables save
这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.
[root@tp ~]# service iptables restart