工具:xshell,VMware workstation12
os:Centos6.5 磁盘40G内存2G,swap分4G,剩余给/
关于如何安装Centos6.5:http://blog.csdn.net/ssrmygod/article/details/70037780
意外情况:centos安装完成后右键桌面没有open in terminal
于是xshell连接进去
[root@mygod ~]# mkdir -p /media/cdrom
[root@mygod ~]# mount /dev/cdrom/media/cdrom
mount: block device /dev/sr0 iswrite-protected, mounting read-only
[root@mygod ~]# cd /etc/yum.repos.d/
[root@mygod yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[root@mygodyum.repos.d]# rm -rf C*
[root@mygod yum.repos.d]# ls
[root@mygod yum.repos.d]# vi mygod.repo
[root@mygod yum.repos.d]# cat mygod.repo
[mygod]
name=mygod
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
[root@mygod yum.repos.d]#
[root@mygod yum.repos.d]# yum clean all
Loaded plugins: fastestmirror,refresh-packagekit, security
Cleaning repos: mygod
Cleaning up Everything
[root@mygod yum.repos.d]# yum repolist
Loaded plugins: fastestmirror,refresh-packagekit, security
Determining fastest mirrors
mygod | 4.0 kB 00:00 ...
mygod/primary_db | 4.4 MB 00:00 ...
repo id reponame status
mygod mygod 6,367
repolist: 6,367
[root@mygod yum.repos.d]# yum -y installnautilus-open-terminal
Loaded plugins: fastestmirror,refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Packagenautilus-open-terminal.x86_64 0:0.17-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Installing:
nautilus-open-terminal x86_64 0.17-4.el6 mygod 63 k
Transaction Summary
===================================================================================================
Install 1 Package(s)
Total download size: 63 k
Installed size: 202 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : nautilus-open-terminal-0.17-4.el6.x86_64 1/1
Verifying :nautilus-open-terminal-0.17-4.el6.x86_64 1/1
Installed:
nautilus-open-terminal.x86_64 0:0.17-4.el6
Complete!
[root@mygod yum.repos.d]#
然后图像化界面logout一下
然后正常了。
检查是否缺少rpm包
[root@mygod ~]# rpm -q binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel | grep "notinstalled"
package pdksh is not installed
[root@mygod ~]#
pdksh 这个包不重要,可以忽略
修改hosts
[root@mygod yum.repos.d]# cat/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mygod
GATEWAY=192.168.158.1
[root@mygod yum.repos.d]# vi /etc/hosts
[root@mygod yum.repos.d]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.158.10 mygod
[root@mygod yum.repos.d]# ifconfig
eth0 Link encap:Ethernet HWaddr00:0C:29:A9:DA:9A
inet addr:192.168.158.10 Bcast:192.168.158.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fea9:da9a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1255 errors:0 dropped:0 overruns:0 frame:0
TX packets:776 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:116943 (114.2 KiB) TXbytes:111461 (108.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:112 errors:0 dropped:0 overruns:0 frame:0
TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8372 (8.1 KiB) TXbytes:8372 (8.1 KiB)
[root@mygod yum.repos.d]#
若要修改网络配置,加亮的是重点
[root@mygod ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=bfb136a7-c026-4e49-a00a-d104d1cf7a3b
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
HWADDR=00:0C:29:A9:DA:9A
IPADDR=192.168.158.10
PREFIX=24
GATEWAY=192.168.158.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
[root@mygod ~]#
[root@mygod ~]# service network restart
关闭防火墙和selinux
[root@mygod ~]# service iptables stop
iptables: Setting chains to policy ACCEPT:filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@mygod ~]# chkconfig iptables off
[root@mygod ~]# vi /etc/selinux/config
[root@mygod ~]# cat /etc/selinux/config
# This file controls the state of SELinuxon the system.
# SELINUX= can take one of these threevalues:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these twovalues:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改/etc/sysctl.conf
[root@mygod ~]# cp /etc/sysctl.conf/etc/sys1
[root@mygod ~]# cat /etc/sys1 |grep -v^#|grep -v ^$ >/etc/sysctl.conf 这里是多余的直接在/etc/sysctl.conf改就行
[root@mygod ~]# vi /etc/sysctl.conf
[root@mygod ~]# cat /etc/sysctl.conf
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
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]# rm -f /etc/sys1
[root@mygod ~]#
[root@mygod ~]# 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
error:"net.bridge.bridge-nf-call-ip6tables" is an unknown key 不知名error,讲道理不应该出现,但是我还是删除了,目测不影响安装oracle
error:"net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables"is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
[root@mygod ~]# cat /etc/sysctl.conf
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
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
[root@mygod ~]# 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
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
创建相关用户和组,文件夹
[root@mygod ~]# groupadd dba
[root@mygod ~]# groupadd oinstall
[root@mygod ~]# useradd -g oinstall -G dbaoracle
[root@mygod~]# echo "redhat"|passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updatedsuccessfully.
[root@mygod ~]#
[root@mygod ~]# mkdir -p /u01/oracle
[root@mygod ~]# chown -R oracle:oinstall/u01
[root@mygod ~]# su - oracle
[oracle@mygod ~]$ cd /u01/
[oracle@mygod u01]$ ls -lrt
total 4
drwxr-xr-x 2 oracle oinstall 4096 Apr 1006:30 oracle
[oracle@mygod u01]$
添加环境变量
[oracle@mygod u01]$ cd
[oracle@mygod ~]$ vi .bash_profile
[oracle@mygod ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
.~/.bashrc
fi
# User specific environment and startupprograms
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/oracle
exportORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=ora11g
exportPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
[oracle@mygod ~]$
[oracle@mygod ~]$ source .bash_profile
修改/etc/security/limits.conf
[root@mygod ~]# tail -6/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
# End of file
[root@mygod ~]#
解压p13390677_112040_Linux-x86-64_1of7.zip和p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod ~]$ cd /u01/
[oracle@mygod u01]$ ls
oracle p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@mygod u01]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ ls
database oracle p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ chown -R oracle:oinstall database
[oracle@mygod u01]$
开始安装
先root下xhost +
su - oracle
cd /u01/database
./runInstaller
wish to receive security updates via MyOracle Support 前面的对勾,点击 Next
在弹出对话框中点击 yes
选择 Skip software update,点击 Next
选择 Install database software only,点击 Next
选择 Single instance database installation,点击 Next
语言选择,保持默认,点击 Next
选择 Enterprise Edition,点击 Next
产品安装目录选择,保持默认即可,点击 Next
产品目录及用户组设置,保持默认,点击 Next
数据库管理组选择,保持默认,点击 Next
安装前检查页面
检查完毕,发现缺失了一个 pdksh 的 rpm
点击右上角的 Ignore All,然后点击 Next。并在弹出框中点击 yes。
进入如下界面,点击 install
安装进度到 94%的时候,弹出如下对话框,需要在root下执行两个脚本。
在桌面上新开一个窗口,根据提示运行如下命令:
sh /u01/oraInventory/orainstRoot.sh
sh /u01/oracle/product/11.2.0/root.sh
注:这两条命令的执行顺序不能颠倒。命令执行过程中若有提示输入,直接回车即可
运行完成后,点击 OK,则进入如下界面,点击 close
su – oracle
netca
一路回车,完成监听,至此完成数据库软件的安装
接着使用dbca建立一个数据库
完成后
[oracle@mygod ~]$ ps -ef |grep pmon
oracle 51406 1 0 08:09 ? 00:00:00 ora_pmon_oracle11g
oracle 54640 54599 0 08:14 pts/3 00:00:00 grep pmon
[oracle@mygod ~]$
[oracle@mygod ~]$ echo $ORACLE_SID
ora11g
[oracle@mygod ~]$
[oracle@mygod ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Apr 10 08:14:39 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/product/11.2.0/dbs/initora11g.ora'
SQL> exit
.bash_profile里的sid和建库的sid不一致导致数据库无法启动!
只好重新建立数据库
[oracle@mygod ~]$ kill -9 51406
[oracle@mygod ~]$
dbca
然后建立数据库时候注意SID就行了
再次规范建库后,若成功的话数据库在open阶段