阿里云Centos重装系统

阿里云Centos重装系统,第1张

1、登陆阿里云官网后台系统

2、【停止实例】选择云服务器ECS  >>在菜单下选择“实例” >>选择套餐内容后边的更多 >>选择实例状态 >>选择停止(需要验证码)

3、【更换系统盘】停止后选择磁盘和镜像,选择更换系统盘

4、【选择系统】选择要更换的系统,注意设置自定义密码,用以以后连接系统

5、【确定后等待重启】

ok~

1. 操作系统环境、安装包准备

宿主机:Max OSX 10.10.5

虚拟机:Parallel Desktop 10.1.1

虚拟机操作系统:CentOS-7-x86_64-DVD-1511.iso

Oracle:linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip

JDK:jdk1.8.0_77.zip

2. 安装CentOS7虚拟机

2.1 新建虚拟机

CPU:2核

内存:4G

硬盘:60G,扩展磁盘

2.2 安装配置

安装语言:中文

软件选择: 带GUI的服务器

网络和主机名:打开虚拟机网络连接

安装位置:使用虚拟机自动分区方案

设置root密码:如root

添加用户账户和密码:如centos/centos

2.3 账户配置

使用centos账户登录后,打开终端,切换到root账户

su root

root

预先为centos、oracle账户添加免密码sudo权限

echo "centos ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers

echo "oracle ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers

允许账户使用弱密码

sed 's/^passwordrequisite.*/passwordrequisite pam_cracklib.so try_first_pass retry=3 type=/g' -i /etc/pam.d/system-auth

3. 安装Oracle11g

3.1 设置内核版本

echo redhat-7 >/etc/redhat-release

3.2 安装依赖包

yum install -y binutils compat-gcc* compat-glibc* compat-libcap1 compat-libstd* compat-libstdc++-33 compat-libstdc++-33.i686 compat-libstdc++-33*.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-devel.i686 glibc-devel*.i686 glibc-headers glibc.i686 glibc*.i686 ksh libaio libaio-devel libaio-devel.i686 libaio-devel*.i686 libaio.i686 libaio*.i686 libgcc libgcc.i686 libgcc*.i686 libstdc++ libstdc++-devel libstdc++-devel*.i686 libstdc++.i686 libstdc++*.i686 libXp make numactl sysstat unixODBC unixODBC-devel unixODBC-devel*.i686 unixODBC*.i686

3.3 创建oracle用户及用户组

groupadd oinstall

groupadd dba

useradd -g oinstall -G dba oracle

passwd oracle

oracle

3.4 设置内核参数

echo >>/etc/sysctl.conf <<EOM

fs.aio-max-nr = 1048576

fs.file-ax = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

kernel.shmmni = 4096

kernel.sem = 250 32000 100128

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

EOM

sysctl -p # 立即生效内核参数

3.5 设置oracle账户环境变量

echo >>/home/oracle/.bashrc <<EOM

JAVA_HOME=/usr/local/jdk1.8.0_77/ # JDK home目录

ORACLE_BASE=/opt/oracle # oracle安装目录

ORACLE_HOME=$ORACLE_BASE/11g # oracle home目录

ORACLE_SID=orcl # oracle实例名

LD_LIBRARY_PATH=$ORACLE_HOME/lib

PATH=$JAVA_HOME/bin:$PATH:$ORACLE_HOME/bin:$HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH

EOM

3.6 设置PAM资源限制

echo >>/etc/security/limits.conf <<EOM

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

EOM

3.7 关闭SELinux

sed 's/SELINUX=.*/SELINUX=disabled/g' -i /etc/selinux/config

setenforce 0 # 立即生效

3.8 创建安装目录

mkdir -p /opt/oracle

chown oracle:oinstall /opt/oracle

chmod 755 /opt/oracle

mkdir -p /opt/oraInventory

chown oracle:oinstall /opt/oraInventory

chmod 755 /opt/oraInventory

3.9 准备安装包

通过移动设备将linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip和jdk1.8.0_77.zip拷贝到桌面,解压

mkdir -p /usr/local/jdk1.8.0_77/

tar xf jdk1.8.0_77.zip -C /usr/local/jdk1.8.0_77/ # 解压安装安装JDK

tar xf linux.x64_11gR2_database_1of2.zip -C /home/oracle

tar xf linux.x64_11gR2_database_2of2.zip -C /home/oracle

chmod -R 700 /home/oracle/database # 只允许oracle账户访问

chown -R oracle:oinstall /home/oracle/database

3.10 使用oracle账户启动安装

su oracle -c 'export LANG=C /home/oracle/database/runInstaller'

3.11 安装错误解决

(1)启动安装时报错java.lang.NoClassDefFoundError

Exception in thread "main" java.lang.NoClassDefFoundError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:164)

at java.awt.Toolkit$2.run(Toolkit.java:821)

at java.security.AccessController.doPrivileged(Native Method)

at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)

at com.jgoodies.looks.LookUtils.isLowResolution(Unknown Source)

at com.jgoodies.looks.LookUtils.<clinit>(Unknown Source)

at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:122)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:242)

at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1783)

at javax.swing.UIManager.setLookAndFeel(UIManager.java:480)

at oracle.install.commons.util.Application.startup(Application.java:758)

at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)

at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)

at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)

at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:114)

at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:132)

解决办法

标准化图形安装配置

sudo yum install -y xorg-x11-utils xorg-x11-apps

sudo xhosts + # 对所有账户开放XServer

检查设置是否生效

xclock

[Ctrl+C]

(2)链接错误/usr/bin/ld: crt1.o: No such file: No such file or directory

Error in invoking target ‘install’ of makefile ‘/opt/oracle/11g/ctx/lib/ins_ctx.mk’. See ‘/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log’ for details.

查看安装日志/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log

INFO: /usr/bin/ld: crt1.o: No such file: No such file or directory

INFO: collect2: ld ?? 1

INFO: make: *** [ctxhx] ?? 1

INFO: End output from spawned process.

解决办法:

安装glibc-devel的32位包

yumdownloader glibc-devel

rpm -ivh glibc-devel-2.17-106.el7_2.8.i686.rpm

rm -f glibc-devel-2.17-*.rpm

重试

(3)链接错误/lib64/libstdc++.so.5: undefined reference to memcpy@GLIBC_2.14

Error in invoking target ‘install’ of makefile ‘/opt/oracle/11g/ctx/lib/ins_ctx.mk’. See ‘/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log’ for details.

查看安装日志/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log

INFO: /lib64/libstdc++.so.5: undefined reference to `memcpy@GLIBC_2.14'

collect2: error: ld returned 1 exit status

INFO: make: *** [ctxhx] Error 1

INFO: End output from spawned process.

解决办法:

if [[ ! -f /usr/lib64/libc.a ]]then yum -y install glibc-staticfi

sed 's/.*\$(LINK_CTXHX) \$(CTXHXOBJ) \$(INSO_LINK)$/-static \/usr\/lib64\/libc.a \$(LINK_CTXHX) \$(CTXHXOBJ) \$(INSO_LINK)/g' -i /opt/oracle/11g/ctx/lib/ins_ctx.mk

重试

(4)链接错误ins_emagent.mk 'agent nmhs'

Error in invoking target 'agent nmhs' of makefile '/opt/oracle/11g/sysman/lib/ins_emagent.mk'

解决办法:

sed 's/$(MK_EMAGENT_NMECTL)$/\$(MK_EMAGENT_NMECTL) -lnnz11/g' -i /opt/oracle/11g/sysman/lib/ins_emagent.mk

重试

(5)netca无法启动

/u01/Oracle/bin/netca: line 178: 11819 Aborted $JRE $JRE_OPTIONS -classpath $CLASSPATH oracle.net.ca.NetCA $*

解决办法:

cat >/etc/sysconfig/network <<EOM

NETWORKING=yes

HOSTNAME=hotDB11g

GATEWAY=192.168.1.1

EOM

echo '127.0.0.1hotDB11g' /etc/hosts

hostname hotDB11g

4. 测试

启动服务

su - oracle -c 'lsnrctl start'

连接查询所有数据库

su - oracle -c 'sqlplus / as sysdba'

SQL>statup

SQL>select name from v$database


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/225820.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-08
下一篇2023-04-08

发表评论

登录后才能评论

评论列表(0条)

    保存