LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2482|回复: 1

虚拟机ubuntu server 9.10中安装oracle 11g R2手记

[复制链接]
发表于 2010-6-11 00:21:16 | 显示全部楼层 |阅读模式
一。环境说明
  机器:dell笔记本
  主机系统:ubuntu 10.04桌面版,虚拟机软件(virtualbox 3.1.6,不要升级到3.2,好像3.2问题多多)
  无线ip: 192.168.1.10
  网关ip:192.168.1.1
  虚拟机系统:ubuntu server 9.10,联网时网卡用"NAT",自动获取ip,和主机连时网卡用"Bridged Adapter",设定固定ip 192.168.1.21

二。安装日志
========================== virtualbox setup =========================
reference:
http://savvyadmin.com/virtualbox-wireless-bridging/
http://savvyadmin.com/virtualbox ... etworking-with-nat/
http://savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/

Gateway ip: 192.168.1.1
Host Wireless Network ip: 192.168.1.10
Client ip: 192.168.1.21

Install the User Mode Linux utilities, for the tunctl application.
$ sudo apt-get install uml-utilities

ensure your /dev/net/tun interface has the appropriate permissions for the vboxusers group.
$ sudo chown root.vboxusers /dev/net/tun
$ sudo chmod g+rw /dev/net/tun

Add the following line of code to /etc/udev/rules.d/20-names.rules
----------------------------------
KERNEL=="tun", NAME="net/%k", GROUP="vboxusers", MODE="0660"
----------------------------------

create tap-setup.sh
----------------------------------
#!/bin/bash
# tap-setup.sh
# Change username accordingly
USER="laomie"
tap_up(){
tunctl -u $USER
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.conf.wlan0.proxy_arp=1
sysctl net.ipv4.conf.tap0.proxy_arp=1
ip link set tap0 up
route add -host 192.168.1.21 dev tap0
}
tap_down(){
sysctl net.ipv4.ip_forward=0
sysctl net.ipv4.conf.wlan0.proxy_arp=0
sysctl net.ipv4.conf.tap0.proxy_arp=0
tunctl -d tap0
}
if [[ $EUID -ne 0 ]]; then
  echo "This script must be run as root" 1>&2
  exit 1
else
case "$1" in
start)
        tap_up
        ;;
stop)
        tap_down
        ;;
*)
        echo "Usage: $0 {start|stop}"
        ;;
esac
fi
exit 0
----------------------------------

Multiple Virtual Guest Machines
$ sudo route add -host 192.168.1.22 dev tap0

virtual client network setup
Attached to: Bridged Adapter
Name: tap0

========================== install utuntu server 9.10 =========================
http://mikesmithers.wordpress.co ... rver-and-ssh-setup/
http://mikesmithers.wordpress.co ... -sashay-with-samba/

install ubuntu server with default.

installtion samba and ssh
$ sudo apt-get samba openssh-server
$ sudo mkdir  -p /srv/samba/share
$ sudo chown  nobody.nogroup /srv/samba/share

Add the following section at the end of the file /etc/samba/smb.conf
--------------------------------------------
[share]
  comment = Samba Share
  path = /srv/samba/share
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 0755
--------------------------------------------

uncommented this line in the file /etc/samba/smb.conf
--------------------------------------------
SO_RCVBUF=8192 SO_SNDBUF=8192
--------------------------------------------

========================== Pre-Requisite installtion =========================
referenct:
http://mikesmithers.wordpress.co ... gr2-on-ubuntu-9-10/
http://en.kioskea.net/faq/4405-l ... racle-11g-on-ubuntu
http://www.pythian.com/news/1355 ... -810-intrepid-ibex/
http://mikesmithers.wordpress.co ... ssh-on-ubuntu-9-10/

Getting Required Packages
$ sudo su -
# apt-get install unzip build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

Final Server Preparations
# ln -sf /bin/bash /bin/sh

Add users and groups
# addgroup oinstall
# addgroup dba
# addgroup nobody
# usermod -g nobody nobody
# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
# passwd oracle
# mkdir /home/oracle
# chown -R oracle:dba /home/oracle

Create symbolic links
# ln -s /usr/bin/awk /bin/awk
# ln -s /usr/bin/rpm /bin/rpm
# ln -s /usr/bin/basename /bin/basename

# mkdir /etc/rc.d
# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d; done

Create the ORACLE_BASE directory
# mkdir -p /u01/app/oracle
# chown -R oracle:dba /u01

below should all be placed at the end of the file /etc/sysctl.conf
--------------------------------------------
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 1048576
net.core.wmem_max = 1048576
net.ipv4.ip_local_port_range = 9000 65535
fs.aio-max-nr = 1048576
--------------------------------------------

below should all be placed at the end of the file /etc/security/limits.conf
--------------------------------------------
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard nofile 65536
oracle soft nofile 1024
--------------------------------------------

below should all be placed at the end of the file /etc/pam.d/login
--------------------------------------------
session required /lib/security/pam_limits.so
--------------------------------------------

Tunneling X over SSH
# apt-get install xserver-xorg xserver-xorg-core openbox x11-apps x11-xserver-utils

uncomment the allow forwarding parameter in /etc/ssh/sshconfig and set it to yes
--------------------------------------------
ForwardX11 yes
--------------------------------------------

convert DHCP network configuration to static IP configuration
--------------------------------------------
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.21
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
--------------------------------------------

reboot ubuntu (virtual client) and test X windows session via ssh on host terminal
$ ssh -X username@192.168.1.21
$ xclock

========================== Installing Oracle 11gR2 ==========================
copy oracle zip files from host to client via samba and unzip the files
$ sudo mv /srv/samba/share/linux_11gR2*.zip /home/oracle
$ cd /home/oracle
$ sudo chown oracleinstall linux_11gR2*.zip
$ unzip linux_11gR2_database_1of2.zip -d .
$ unzip linux_11gR2_database_2of2.zip -d .
$ rm -fr linux_11gR2*.zip

open X windows session via ssh on host terminal
$ ssh -X oracle@192.168.1.21
$ cd /home/oracle/database
$ ./runInstaller -ignoreSysPrereqs

follow below steps to install oracle
1  of 11. unchecked "i wish to ..." then next
2  of 11. select "install database software only" then next
3  of 11. next
4  of 11. add "japanese" and "simplified chinese" then next
5  of 11. next
6  of 11. next
7  of 11. next
8  of 11. next
9  of 11. "Fix & Check Again" then checked "ignore All" then next
10 of 11. finish

add environment variables to /etc/profile
--------------------------------------------
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:/u01/app/oracle/product/11.2.0/dbhome_1/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export ORACLE_OWNR=oracle
--------------------------------------------

reboot client and open X windows session via ssh on host terminal
$ ssh -X oracle@192.168.1.21

Creating a database using Database Configuration Assistant
$ dbca

3 of 12. Global Database Namercl    SIDrcl
4 of 12. Uncheck the "Configure Enterprise Manager" box
8 of 12. check the "sample schemas" box
11 of 12. check the "generate database creation scripts" box

Edit /etc/oratab and change the line
sid:/u01/app/oracle/product/11.2.0/dbhome_1:N
to
sid:/u01/app/oracle/product/11.2.0/dbhome_1:Y

create a script /etc/init.d/oracledb to execute on startup to start the database and the listener
--------------------------------------------
#!/bin/bash
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
# Based on script listing at
# http://www.pythian.com/news/1355 ... -810-intrepid-ibex/
# Mike 7/3/10
#
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATHORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi
case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        touch /var/lock/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        rm -f /var/lock/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac
exit 0
--------------------------------------------

make the script executable and set it to run at boot time
$ sudo chmod a+x /etc/init.d/oracledb
$ sudo update-rc.d oracledb defaults 99

reboot client and testing server changes
$ ssh oracle@192.168.1.21
$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> quit

$ ssh laomie@192.168.1.21
$ sudo /etc/init.d/oracledb start
$ lsnrctl status

$ ssh oracle@192.168.1.21
$ lsnrctl status
$ sqlplus system/password
SQL> select status from v$instance;
发表于 2010-7-10 15:58:07 | 显示全部楼层
能不能给新手加个注示啊。。谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表