最近要運維一個項目,,準備在家辦公,公司無遠程作業(yè)環(huán)境,,個人本本不喜歡別人碰,,第一次在CentOS上安裝,,本案留以后使用,,畢竟不是經(jīng)常安裝。 注:Oracle11gR2 X64安裝 一,、環(huán)境準備 安裝包: 1.VMware-workstation-full-11.1.0-2496824.exe 2.CentOS-7-x86_64-DVD-1511.iso 3.linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip 以上覺得不是重點,,不給下載地址,不描述安裝過程,,安裝完CentOS 7,,截圖如下:
第一次安裝防坑,沒有進行任何操作之前,,先在VMware中創(chuàng)建該虛擬機快照,,后期搞郁悶了,,可以回歸到該快照版本。特么還是不放心,,又把該虛擬機完整克隆一份(強迫癥),。 二、安裝Oracle前準備 1.創(chuàng)建運行oracle數(shù)據(jù)庫的系統(tǒng)用戶和用戶組 [sonny@localhost ~]$ su root #切換到root Password: [root@localhost sonny]# groupadd oinstall #創(chuàng)建用戶組oinstall [root@localhost sonny]# groupadd dba #創(chuàng)建用戶組dba [root@localhost sonny]# useradd -g oinstall -g dba -m oracle #創(chuàng)建oracle用戶,,并加入到oinstall和dba用戶組 [root@localhost sonny]# passwd oracle #設置用戶oracle的登陸密碼,,不設置密碼,在CentOS的圖形登陸界面沒法登陸 Changing password for user oracle. New password: # 密碼 BAD PASSWORD: The password is shorter than 8 characters Retype new password: # 確認密碼 passwd: all authentication tokens updated successfully. [root@localhost sonny]# id oracle # 查看新建的oracle用戶 uid=1001(oracle) gid=1002(dba) groups=1002(dba) [root@localhost sonny]# 為啥要創(chuàng)建oinstall用戶組及dba組,? 參考:http://www.oracle.com/technetwork/cn/articles/hunter-rac11gr2-iscsi-2-092412-zhs.html#13 理論上單例按照需要3種用戶組,,實際只建兩個oinstall和dba,后面再安裝oracle數(shù)據(jù)庫的時候把OSOPER組也設置是dba組,。 a.oracle 清單組(一般為oinstall): OINSTALL 組的成員被視為 Oracle 軟件的“所有者”,,擁有對 Oracle 中央清單 (oraInventory) 的寫入權限。在一個 Linux 系統(tǒng)上首次安裝 Oracle 軟件時,, 2.創(chuàng)建oracle數(shù)據(jù)庫安裝目錄 [sonny@localhost ~]$ su root Password: [root@localhost sonny]# mkdir -p /data/oracle #oracle數(shù)據(jù)庫安裝目錄 [root@localhost sonny]# mkdir -p /data/oraInventory #oracle數(shù)據(jù)庫配置文件目錄 [root@localhost sonny]# mkdir -p /data/database #oracle數(shù)據(jù)庫軟件包解壓目錄 [root@localhost sonny]# cd /data [root@localhost data]# ls #創(chuàng)建完畢檢查一下(強迫癥) database oracle oraInventory [root@localhost data]# chown -R oracle:oinstall /data/oracle #設置目錄所有者為oinstall用戶組的oracle用戶 [root@localhost data]# chown -R oracle:oinstall /data/oraInventory [root@localhost data]# chown -R oracle:oinstall /data/database [root@localhost data]# 3.修改OS系統(tǒng)標識 oracle默認不支持CentOS系統(tǒng)安裝,,Oracle Database 11g Release 2 的 OS要求參考: https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1106 我安裝是64位數(shù)據(jù)庫,On Linux x86-64:Red Hat Enterprise Linux 7 (RHEL 7) 另外,CentOS7.0.1511 基于 RHEL7.2 參考:http://www./Linux/2015-12/126283.htm 修改文件 /etc/RedHat-release [sonny@localhost data]$ su root Password: [root@localhost data]# cat /proc/version Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015 [root@localhost data]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@localhost data]# vi /etc/redhat-release [root@localhost data]# cat /etc/redhat-release redhat-7 [root@localhost data]# 4.安裝oracle數(shù)據(jù)庫所需要的軟件包 重復一遍,,我安裝時Oracle Database 11g Release 2 64位數(shù)據(jù)庫,。 Oracle Database Package Requirements for Linux x86-64 如下:(參考:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#BABCFJFG) 操作系統(tǒng):Oracle Linux 7 and Red Hat Enterprise Linux 7 The following packages (or later versions) must be installed: binutils-2.23.52.0.1-12.el7.x86_64 compat-libcap1-1.10-3.el7.x86_64 gcc-4.8.2-3.el7.x86_64 gcc-c++-4.8.2-3.el7.x86_64 glibc-2.17-36.el7.i686 glibc-2.17-36.el7.x86_64 glibc-devel-2.17-36.el7.i686 glibc-devel-2.17-36.el7.x86_64 ksh libaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64 libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64 libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64 libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64 libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64 libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64 libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64 make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64 老實人,第一次搞,,一個一個的安裝,命令也很簡單,,反正文檔要求高版本也可以: [sonny@localhost data]$ su root Password: [root@localhost data]# yum install binutils 5.關閉防火墻 CentOS 7.2默認使用的是firewall作為防火墻 [sonny@localhost /]$ su root Password: [root@localhost /]# systemctl status firewalld.service #查看防火墻狀態(tài),運行中 ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2016-04-07 18:54:29 PDT; 2h 20min ago Main PID: 802 (firewalld) CGroup: /system.slice/firewalld.service └─802 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. [root@localhost /]# systemctl stop firewalld.service #關閉防火墻 [root@localhost /]# systemctl status firewalld.service #再次查看防火墻狀態(tài),,發(fā)現(xiàn)已關閉 ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since Thu 2016-04-07 21:15:34 PDT; 9s ago Main PID: 802 (code=exited, status=0/SUCCESS) Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. Apr 07 21:15:33 localhost systemd[1]: Stopping firewalld - dynamic firewall daemon... Apr 07 21:15:34 localhost systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@localhost /]# systemctl disable firewalld.service #禁止使用防火墻(重啟也是禁止的) Removed symlink /etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. [root@localhost /]# 防火墻先禁用,,搞好之后再配置,個人虛擬機,,要毛線防火墻~~ 6.關閉selinux(需重啟生效) [root@localhost /]# vi /etc/selinux/config [root@localhost /]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled #此處修改為disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@localhost /]# 為啥要關閉selinux,?因為selinux太高深,非專業(yè)人士搞不懂~~ 7.修改內(nèi)核參數(shù) 紅色部分為添加代碼 [sonny@localhost /]$ su root Password: [root@localhost /]# vi /etc/sysctl.conf [root@localhost /]# cat /etc/sysct.conf cat: /etc/sysct.conf: No such file or directory [root@localhost /]# cat /etc/sysctl.conf # System default settings live in /usr/lib/sysctl.d/00-system.conf. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file # # For more information, see sysctl.conf(5) and sysctl.d(5). net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.rp_filter = 1 fs.file-max = 6815744 #設置最大打開文件數(shù) fs.aio-max-nr = 1048576 kernel.shmall = 2097152 #共享內(nèi)存的總量,,8G內(nèi)存設置:2097152*4k/1024/1024 kernel.shmmax = 2147483648 #最大共享內(nèi)存的段大小 kernel.shmmni = 4096 #整個系統(tǒng)共享內(nèi)存端的最大數(shù) kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范圍 net.core.rmem_default = 262144 net.core.rmem_max= 4194304 net.core.wmem_default= 262144 net.core.wmem_max= 1048576 [root@localhost /]# 使配置參數(shù)生效 [root@localhost /]# sysctl -p net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.rp_filter = 1 sysctl: setting key "fs.file-max": Invalid argument fs.file-max = 6815744 #設置最大打開文件數(shù) fs.aio-max-nr = 1048576 sysctl: setting key "kernel.shmall": Invalid argument kernel.shmall = 2097152 #共享內(nèi)存的總量,,8G內(nèi)存設置:2097152*4k/1024/1024 sysctl: setting key "kernel.shmmax": Invalid argument kernel.shmmax = 2147483648 #最大共享內(nèi)存的段大小 sysctl: setting key "kernel.shmmni": Invalid argument kernel.shmmni = 4096 #整個系統(tǒng)共享內(nèi)存端的最大數(shù) kernel.sem = 250 32000 100 128 sysctl: setting key "net.ipv4.ip_local_port_range": Invalid argument net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范圍 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 [root@localhost /]# 8.對oracle用戶設置限制,提高軟件運行性能(紅色為添加部分) [sonny@localhost /]$ su root Password: [root@localhost /]# vi /etc/security/limits.conf [root@localhost /]# cat /etc/security/limits.conf # /etc/security/limits.conf # #This file sets the resource limits for the users logged in via PAM. #It does not affect resource limits of the system services. # #Also note that configuration files in /etc/security/limits.d directory, #which are read in alphabetical order, override the settings in this #file in case the domain is the same or more specific. #That means for example that setting a limit for wildcard domain here #can be overriden with a wildcard setting in a config file in the #subdirectory, but a user specific setting here can be overriden only #with a user specific setting in the subdirectory. # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # #<domain> <type> <item> <value> # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 # End of file [root@localhost /]# 9.配置用戶的環(huán)境變量(紅色部分為添加代碼) [root@localhost /]# vi /home/oracle/.bash_profile [root@localhost /]# cat /home/oracle/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH export ORACLE_BASE=/data/oracle #oracle數(shù)據(jù)庫安裝目錄 export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle數(shù)據(jù)庫路徑 export ORACLE_SID=orcl #oracle啟動數(shù)據(jù)庫實例名 export ORACLE_TERM=xterm #xterm窗口模式安裝 export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系統(tǒng)環(huán)境變量 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系統(tǒng)環(huán)境變量 export LANG=C #防止安裝過程出現(xiàn)亂碼 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #設置Oracle客戶端字符集,,必須與Oracle安裝時設置的字符集保持一致,,如:ZHS16GBK,否則出現(xiàn)數(shù)據(jù)導入導出中文亂碼問題 [root@localhost /]# 使上述配置立即生效: [oracle@localhost /]$ su root
Password:
[root@localhost /]# source /home/oracle/.bash_profile
[root@localhost /]#
10.上述都搞定了,,上傳安裝包我喜歡xftp,,將oracle安裝包上傳到/usr/local/src 11.解壓安裝包 [oracle@localhost /]$ cd /usr/local/src #進入/usr/local/src目錄 [oracle@localhost src]$ ls linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip [oracle@localhost src]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/database/ #解壓 (省略...) [oracle@localhost src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/ #解壓 (省略...) [oracle@localhost src]$ su root Password: [root@localhost src]# chown -R oracle:oinstall /data/database/database/ [root@localhost src]# 三、oracle安裝 1.圖形界面登陸oracle用戶: 2.啟動oralce安裝,,到/data/database/database/目錄下,,執(zhí)行runInstaller
3.去掉勾,懶得填,,個人使用環(huán)境不需要自動接收Oracle的安全更新,。 4.下一步,只安裝數(shù)據(jù)庫軟件,,個人用不要那些玩意~~ 更多詳情見請繼續(xù)閱讀下一頁的精彩內(nèi)容: http://www./Linux/2016-04/130559p2.htm |
|