Linux上安装Oracle数据库
第一步:系统磁盘分区:
1:检查磁盘信息
[root@iZuf6gxpvk73jkbx2r5h1bZ ~]# fdisk -l
2:进入分区的磁盘
[root@iZ28ubyqhl0Z ~]# fdisk /dev/vdb
Command (m for help): n #新建分区
Command actioncd
e extended
p primary partition (1-4)
p #添加主分区
Partition number (1-4): 1 #分区开始
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270): #分区结束默认值是回车
Using default value 65270
Command (m for help): t #更改磁盘类型
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w # w保存分区退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3:创建逻辑卷
[root@iZ28ubyqhl0Z ~]# pvcreate /dev/vdb1 #创建物理卷
Physical volume "/dev/xvdb1" successfully created
[root@iZ28ubyqhl0Z ~]# vgcreate -s 128M vgdata /dev/vdb1 #创建逻辑卷组
Volume group "vgdata" successfully created
[root@iZ28ubyqhl0Z ~]# lvcreate -L 499G -n lvdata vgdata #创建逻辑卷
Logical volume "lvdata" created
[root@iZ28ubyqhl0Z ~]# mkfs.ext4 /dev/vgdata/lvdata #格式化磁盘
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32702464 inodes, 130809856 blocks
6540492 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3992 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4:挂载逻辑卷
[root@iZ28ubyqhl0Z ~]# mkdir /app #建议在根目录下的文件夹app
[root@iZ28ubyqhl0Z ~]# mount /dev/vgdata/lvdata /app #手动用mount 挂载逻辑
[root@iZ28ubyqhl0Z ~]# df –h
5:设置开机启动/固话挂载
[root@iZuf6gxpvk73jkbx2r5h1bZ ~]# vi /etc/fstab #修改命令
/dev/vgdata/lvdata /app ext4 defaults 0 0 在底部添加
6:系统swqp分区挂载
[root@iZ28ubyqhl0Z ~]# dd if=/dev/zero of=/app/swap bs=1024 count=16000000 #添加交换分区16GB
16000000+0 records in
16000000+0 records out
16384000000 bytes (16 GB) copied, 341.336 s, 48.0 MB/s
[root@iZ28ubyqhl0Z ~]# mkswap /app/swap
[root@iZ28ubyqhl0Z ~]# swapon /app/swap #创建交换分区文件
[root@iZ28ubyqhl0Z ~]# swapon -a#激活交换分区
[root@iZ28ubyqhl0Z ~]# free -m #查看分区中的swap
total used free shared buffers cached
Mem: 64427 1588 62838 255 20 843
-/+ buffers/cache: 724 63703
Swap: 15624 0 15624
[root@iZuf6gxpvk73jkbx2r5h1bZ ~]# vi /etc/fstab #修改命令
/app/swap swap swap defaults 0 0
第二步:创建oracle用户
[root@iZ28ubyqhl0Z ~]# groupadd oinstall
[root@iZ28ubyqhl0Z ~]# groupadd dba
[root@iZ28ubyqhl0Z home]# useradd -g oinstall -G dba oracle
[root@iZ28ubyqhl0Z home]# passwd oracle
第三步:修改系统的内核参数
[root@iZ28ubyqhl0Z home]# vi /etc/sysctl.conf
kernel.shmall = 2097152 修改
kernel.shmmax = 2147483648
kernel.shmmni = 4096 添加
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr= 1048576
[root@bogon ~]# sysctl -p #重启生效内核参数
[root@iZ28ubyqhl0Z home]# vi /etc/security/limits.conf
oracle soft nofile 65536 添加
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
[root@iZ28ubyqhl0Z home]# vi /etc/pam.d/login
session required pam_limits.so 添加
第四步:建立安装目录和配置环境变量
[root@bogon ~]# mkdir /app/oracle
[root@iZ28ubyqhl0Z home]# chown -R oracle:oinstall /app
[root@iZ28ubyqhl0Z home]# chmod -R 755 /app
修改oracle用户的环境变量
[root@iZ28ubyqhl0Z home]#su - oracle
[oracle@iZ28ubyqhl0Z home] $ vi .bash_profile
umask 022 添加在最后一句之前
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_SID=oracle11
LD_LIBRARY_PATH=$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LC_ALL=en_US.UTF-8
[oracle@iZ28ubyqhl0Z ~] $ source .bash_profile 执行环境变量
第五步:安装VNC图形界面
- 下载vncserver
[oracle@iZ28ubyqhl0Z ~] $ su - root
[root@iZ28ubyqhl0Z ~]# yum -y groupinstall "Desktop"
[root@iZ28ubyqhl0Z ~]# yum -y groupinstall "X Window System"
[root@iZ28ubyqhl0Z ~]# yum install tigervnc tigervnc-server
Is this ok [y/N]: y
- 配置vncserver
[root@iZ28ubyqhl0Z ~]# cd /etc/sysconfig
[root@iZ28ubyqhl0Z ~]# vi vncservers
VNCSERVERS="1:oracle"
VNCSERVERARGS[1]="-geometry 1024x768"
第六步:在oracle用户下启动VNC服务
[oracle@iZ28ubyqhl0Z ~]$ vncserver
远程登录服务器
用远程工具中登录,输入IP地址加后面的号码 ,例如:
110.50.34.33:1
输入密码进入