1. After minimal installation of CentOS 7, first set a fixed IP
You can first check the name of your own network card device, it is ens33 , so the name of the network card configuration file is ifcfg-ens33 (the previous ifcfg-don't care, fixed)
ip addr
Open the network card configuration file:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
Modify (add) the following lines as needed:
BOOTPROTO="static"IPADDR=192.168.80.254 #Fill in the IP address you need to set
NETMASK=255.255.255.0 #Subnet mask
GATEWAY=192.168.80.2
#Gateway DNS1=8.8.8.8 #DNS fill in
ONBOOT="yes as needed " #boot the network card
After saving, restart the network card
service network restart
Configure the local-IP mapping
vi /etc/hosts
Fill in the local IP address and your preferred local name in the last line
At this time, you can actually connect to the CentOS 7 for remote configuration through related remote tools, which will be much more convenient. I use SecureCRT.
2. Install the dependencies required by Oracle (run the following code)
yum -y install binutils compat-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
Complete! Check the installation of dependencies after the words (run the following code)
rpm -q binutils compat-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 "not installed"
When the red not installed appears, it means that some dependent packages have not been installed successfully
A separate installation found that CentOS 7 does not have the pdksh dependency package by default
Then you can only go to the Internet to find the dependency package of pdksh, download it and install it manually, because it is a minimal installation without wget, so install wget first, and then download pdksh (run the following two codes respectively)
yum install wget -y
wget http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
Install the downloaded pdksh-5.2.14-37.el5_8.1.x86_64.rpm
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
Check the Oracle dependency package again. If nothing appears, it means that it is installed.
3. Create Oracle installation user group and oracle user
groupadd oinstall -g 2000 && groupadd dba -g 2001 && groupadd asmadmin -g 2002 && groupadd asmdba -g 2003
useradd oracle -g oinstall -G dba,asmdba
View oracle user creation
id oracle
set oracle password
passwd oracle
4. Optimize kernel parameters
vi /etc/sysctl.conf
Inside add:
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=419430 #The unit is 4K, my virtual machine memory is 4G, so the default shm of linux is 2G, I gave 80% of 2G to oracle is 419430
kernel.shmmni=4096
kernel.shmmax = 1073741824
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
.core.wmem_max=1048586
Oracle official documents are also posted http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html
Reload after setup is complete
/sbin/sysctl -p
Restrict oracle user permissions and add restrictions in limits.conf, login, and profile ( the source of these three restrictions has not yet been found in the official website documentation, but in the spirit of groundlessness, it is still done, even if it is not done, it should not affect the installation )
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
vi /etc/pam.d/loginsession required /lib64/security/pam_limits.so
session required pam_limits.so
vi /etc/profileif [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
5. Create an installation directory and give permissions to configure oracle environment variables
su oracle
vi ~ / .bashrcexport ORACLE_HOSTNAME=oracle
export ORACLE_BASE=/db/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
cd ~ && source .bashrc
6. Go to the official website to download the relevant Oracle installation package to the local Windows, mine is 64-bit, so I downloaded it:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
These two things are imported into CenOS 7 after the download is complete. I use lrzsz.x86_64, because the software is not installed because of the minimization, first install lrzsz.x86_64
su root
yum install lrzsz unzip -y
Then cd to tmp, use rz to upload the downloaded linux compressed package
cd /tmp && rz7. Unzip the oracle compressed package, and modify the installation parameters according to the content you set earlier
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
vi database/response/db_install.rsporacle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/db/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/db/oracle/product/11.2.0
ORACLE_BASE=/db/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
reboot
8. Start the installation
su oracle
cd /tmp/database
./runInstaller -silent -ignorePrereq -responseFile /tmp/database/response/db_install.rsp
Run the prompt two scripts as root
Halfway through, I copied the decompressed database folder to /db, this is also possible without copying
cp -R /tmp/database /dbConfigure monitoring
netca /silent /responsefile /db/database/response/netca.rsp
View listening ports
netstat -tnulp | grep 1521
A red letter indicates normal monitoring
Modify configuration parameters and create a database
vi /db/database/response/dbca.rspGDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/db/oracle/oradata
RECOVERYAREADESTINATION=/db/oracle/recovery
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "1638" #Gives 40% of memory
vi /db/oracle/product/11.2.0/dbs/init.ora
Change all the <ORACLE_BASE> in it to the real ORACLE_BASE , that is, build the database after /db/oracle
dbca -silent -responseFile /db/database/response/dbca.rsp
After completion, you can use sqlplus to connect to the database
over