首页 > 数据库 > Oracle > 经本人实践过多次的UBUNTU安装11G
user@hardy:~$ xhost +127.0.0.1Step 4
127.0.0.1 being added to access control list
sudo su - 将用户转换为超级用户,并新起一个会话(空的会话),而不是像sudo -s那样将当前会话传递个新的超级用户,减少环境变量可能造成的影响和危害。 user@hardy:~$ sudo su -
[sudo] password for user:
root@hardy:~# apt-get update
...
root@hardy:~# apt-get dist-upgrade
...
root@hardy:~# reboot
user@hardy:~$ sudo su -
[sudo] password for user:
root@hardy:~# apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm
...
root@hardy:~#
如果你想知道为什么Ubuntu用dash作为默认的shell,看这个:a detailed explanation of why dash is the default system shell 。
Step 701 root@hardy:/bin# cd
02 root@hardy:~# pwd
/root
04 root@hardy:~# addgroup oinstall
Adding group `oinstall' (GID 1001) ...
Done.
07 root@hardy:~# addgroup dba
Adding group `dba' (GID 1002) ...
Done.
10 root@hardy:~# addgroup nobody
Adding group `nobody' (GID 1003) ...
Done.
13 root@hardy:~# usermod -g nobody nobody
14 root@hardy:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
//以下15步其实没有必要,因为到后面最好直接以oracle用户登录X11再打开终端来安装oracle软件,这步应改为
//15 root@hardy:~# passwd oracle然后输入你要给ubuntu系统帐号oracle设定的登录密码
15 root@hardy:~# passwd -l oracle
Password changed.
17 root@hardy:~# mkdir /home/oracle
18 root@hardy:~# chown -R oracle:dba /home/oracle
19 root@hardy:~# ln -s /usr/bin/awk /bin/awk
20 root@hardy:~# ln -s /usr/bin/rpm /bin/rpm
21 root@hardy:~# ln -s /usr/bin/basename /bin/basename
22 root@hardy:~# mkdir /etc/rc.d
23 root@hardy:~# 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
24 root@hardy:~# mkdir -p /u01/app/oracle
25 root@hardy:~# chown -R oracle:dba /u01
26 root@hardy:~#
/etc/sysctl.conf文件的末尾:fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
//这里,对每个参数值做个简要的解释和说明。
// (1)shmmax:该参数定义了共享内存段的最大尺寸(以字节为单位)。缺省为32M,对于oracle来说,该缺省值太低了,通常将其设置为2G。
// (2)shmmni:这个内核参数用于设置系统范围内共享内存段的最大数量。该参数的默认值是 4096 。通常不需要更改。
// (3)shmall:该参数表示系统一次可以使用的共享内存总量(以页为单位)。缺省值就是2097152,通常不需要修改。
// (4)sem:该参数表示设置的信号量。
// (5)file-max:该参数表示文件句柄的最大数量。文件句柄设置表示在linux系统中可以打开的文件数量。
// 修改好内核以后,执行下面的命令使新的配置生效。
//[root @linux1 /root]# /sbin/sysctl -p
/etc/security/limits.conf文件末尾:oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535
/etc/pam.d/login文件末尾:session required /lib/security/pam_limits.so
session required pam_limits.so
sysctl -p 让刚才增加的东西生效:root@hardy:~# sysctl -p
kernel.printk = 4 4 1 7
kernel.maps_protect = 1
fs.inotify.max_user_watches = 524288
vm.mmap_min_addr = 65536
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
root@hardy:~#
root@hardy:~# cd /home/oracle
root@hardy:/home/oracle# chown -R oracle:dba install
//下面这步就是我在上面谈到的15步没必要,下面这步可改为重启系统或重启x11,以oracle登录,打开终端接着运行以下步骤
root@hardy:/home/oracle# su - oracle //应改为重新启动操作系统,以oracle登录,启动终端
Your account has expired; please contact your system administrator
su: User account has expired
(Ignored)
oracle@hardy:~$ export DISPLAY=127.0.0.1:0.0
oracle@hardy:~$ pwd
/home/oracle
oracle@hardy:~$ ls -l
total 4
drwxr-xr-x 6 oracle dba 4096 2007-09-18 18:50 install
oracle@hardy:~$ cd install
oracle@hardy:~/install$ ls -l
total 28
drwxr-xr-x 11 oracle dba 4096 2007-08-06 16:02 doc
drwxr-xr-x 5 oracle dba 4096 2007-08-03 13:28 install
drwxr-xr-x 2 oracle dba 4096 2007-09-18 18:52 response
-rwxr-xr-x 1 oracle dba 2911 2007-08-03 13:28 runInstaller
drwxr-xr-x 14 oracle dba 4096 2007-08-03 13:27 stage
-rw-r--r-- 1 oracle dba 4835 2007-08-06 18:19 welcome.html
oracle@hardy:~/install$ ./runInstaller -ignoreSysPrereqs
root@hardy:~# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname of /u01/app/oraInventory to dba.
The execution of the script is complete
root@hardy:~# /u01/app/oracle/product/11.1.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.1.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
root@hardy:~#
/etc/profile文件中加入下面几句:export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export PATH=$PATH:/u01/app/oracle/product/11.1.0/db_1/bin
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_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
root@hardy:~# chmod a+x /u01/app/oracle/product/11.1.0/db_1/bin/oracledb
root@hardy:~# ln -s /u01/app/oracle/product/11.1.0/db_1/bin/oracledb /etc/init.d/oracledb
root@hardy:~# sudo sysv-rc-conf --level 2345 oracledb on如果没有sysv-rc-conf命令,就apt-get一个。
root@hardy:~# usermod -G dba -a user
oracle@hardy:~$ export ORACLE_SID=heron如果你看到了上面的结果,证明你的oracle安装成功了。
oracle@hardy:~$ sqlplus '/as sysdba'
SQL*Plus: Release 11.1.0.6.0 - Production on Mon May 5 02:39:27 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/65971/viewspace-1023095/ ,如需转载,请注明出处,否则将追究法律责任。