Oracle Apex Installation Notes for CentOS
This is a note for how to setup Oracle Apex 5.1 on CentOS 6.9 from fresh. Also it was proven working for Apex 18.2 on CentOS 6.10. You can view the video here. Copy and paste scripts from notes, you can setup the server more easily.
1. Boot CentOS 6.x DVD
2. Select “Desktop” on Software Installation Screen, which is more convenience for Oracle setup.
3. Setup the network configuration with following command at console
# system-config-network-tui
or
# system-config-network
4. (optional) To minimize the needs to control the machine console, I install an Xwindow server with for a better installation experience. Without this you need to do the rest at console only.
- Download Xming https://sourceforge.net/projects/xming/
- Follow the installation wizard.
- After Launching the Xming , you will get an icon on the icon tray.
- Create a profile on putty terminal tool and enable the X11 forwarding feature
5. OS configuration and preparation
OS configuration is executed as root. To login as root just execute following command in terminal.
su - root
Add groups
--required groups
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
Add user Oracle
/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle
Change password for user
passwd oracle
Add kernel parameters to /etc/sysctl.conf
kernel.shmmni = 4096
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
Apply kernel parameters
/sbin/sysctl -p
Add following lines to set shell limits for user oracle in file /etc/security/limits.conf
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 50000000
oracle hard memlock 50000000
The “/etc/hosts” file must contain a fully qualified name for the server.
For example.
188.4.72.11 cloud cloud.xxx.com
Modify .bash_profile for user oracle in his home directory (REMEMBER TO CHANGE THE HOSTNAME)
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=cloud.xxx.com
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'
umask 022
Check which packages are installed and which are missing
# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel \
compat-libstdc++-33 \
glibc
you should missing following
# yum install elfutils-libelf-devel gcc gcc-c++ libaio-devel libstdc++-devel unixODBC unixODBC-devel ksh compat-libstdc++-33
after that make sure there is no packages in above list is not installed
# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel \
compat-libstdc++-33 \
glibc
you should get the following result:
binutils-2.20.51.0.2-5.46.el6(x86_64)
elfutils-libelf-0.164-2.el6(x86_64)
elfutils-libelf-devel-0.164-2.el6(x86_64)
gcc-4.4.7-23.el6(x86_64)
gcc-c++-4.4.7-23.el6(x86_64)
glibc-2.12-1.209.el6(x86_64)
glibc-common-2.12-1.209.el6(x86_64)
glibc-devel-2.12-1.209.el6(x86_64)
glibc-headers-2.12-1.209.el6(x86_64)
ksh-20120801-37.el6_9(x86_64)
libaio-0.3.107-10.el6(x86_64)
libaio-devel-0.3.107-10.el6(x86_64)
libgcc-4.4.7-23.el6(x86_64)
libstdc++-4.4.7-23.el6(x86_64)
libstdc++-devel-4.4.7-23.el6(x86_64)
make-3.81-23.el6(x86_64)
sysstat-9.0.4-33.el6(x86_64)
unixODBC-2.2.14-14.el6(x86_64)
unixODBC-devel-2.2.14-14.el6(x86_64)
compat-libstdc++-33-3.2.3-69.el6(x86_64)
glibc-2.12-1.209.el6(x86_64)
Create directory structure
mkdir -p /ora01/app
chown oracle:oinstall /ora01/app
chmod 775 /ora01/app
create ORACLE_BASE directory for oracle
mkdir -p /ora01/app/oracle
chown oracle:oinstall /ora01/app/oracle
chmod 775 /ora01/app/oracle
Create ORACLE_HOME directory for oracle
mkdir -p /ora01/app/oracle/product/11.2.0/db_1
chown oracle:oinstall -R /ora01/app/oracle
Disable secure linux by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows. It requires REBOOT to be effective !!!
SELINUX=permissive
REBOOT the Machine now
# init 6
4. Download Oracle Database 11gR2 from Oracle Official Site, you should get 2 files.
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
I placed them under /home/oracle directory
Install database software
Let’s start with database software installation as oracle user.
[oracle@cloud ~]$ whoami
oracle
[oracle@cloud ~]$ pwd
/home/oracle
[oracle@cloud ~]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@cloud ~]$ unzip linux.x64_11gR2_database_2of2.zip
You should now have a directory /home/oracle/database
--run installation from install directory
If you want to rerun the “./runInstaller” below after some failures, you may need to run the following command to clean the earlier installations first.
rm -Rf /ora01
mkdir -p /ora01/app
chown oracle:oinstall /ora01/app
chmod 775 /ora01/app
mkdir -p /ora01/app/oracle
chown oracle:oinstall /ora01/app/oracle
chmod 775 /ora01/app/oracle
mkdir -p /ora01/app/oracle/product/11.2.0/db_1
chown oracle:oinstall -R /ora01/app/oracle
rm -f /etc/oratab /etc/oraInst.loc
[kevinchui@cloud~]$ su - oracle
Password:
[oracle@cloud ~]$ cd database
[oracle@cloud database]$ ./runInstaller
Uncheck the “I wish to receive ….” to bypass the notification.
Press Yes
Press Next
Select Server Class and Next
Click Next
Click Next
input the Administrative password for dba and click Next
Click Next
Check the ignore All and click Next (since we have fixed the package dependencies earlier)
Click Finish
Please be patient for this takes a very long time from my experience (over 30 minutes)
press retry if Oracle Net Configuration Assistant Failure Message appear.
Press OK
Now you need to open another shell for running the configuration scripts mentioned above.
[root@cloud ~]# /ora01/app/oraInventory/orainstRoot.sh
Changing permissions of /ora01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /ora01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@cloud ~]# /ora01/app/oracle/product/11.2.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /ora01/app/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
Click OK after running the scripts
Click Next
Click Close
Now you have Oracle 11gR2 installed successful.
Testing the database connection
login oracle and run the following,
[oracle@cloud ~]$ whoami
oracle
[oracle@cloud ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 15 10:46:10 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> connect sys@orcl as sysdba
Enter password:
Connected.
SQL> select sysdate from dual;
SYSDATE
---------
15-NOV-17
SQL>
Setup the Oracle autostart configuration (both database and enterprise manager)
# vi /etc/oratab
change the following line from
orcl:/ora01/app/oracle/product/11.2.0/db_1:N
to
orcl:/ora01/app/oracle/product/11.2.0/db_1:Y
Notes for startup / shutdown database
login as oracle
for startup database run
$ $ORACLE_HOME/bin/dbstart $ORACLE_HOME
for shutdown database run
$ $ORACLE_HOME/bin/dbshut $ORACLE_HOME
Setup CentOS auto start Oracle on boot
Login as root and create the following file
# vi /etc/init.d/oracle
with following contents
#!/bin/bash
#
# Oracle Startup script for the Oracle
#
# chkconfig: 345 85 15
### END INIT INFO
. /etc/init.d/functions
start() {
echo -n "Starting Oracle: "
echo -n ""
sudo -u oracle -i /ora01/app/oracle/product/11.2.0/db_1/bin/dbstart /ora01/app/oracle/product/11.2.0/db_1
echo -n ""
sudo -u oracle -i /ora01/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole
echo -n ""
}
stop() {
echo -n "Shutting down Oracle: "
echo -n ""
sudo -u oracle -i /ora01/app/oracle/product/11.2.0/db_1/bin/emctl stop dbconsole
sudo -u oracle -i /ora01/app/oracle/product/11.2.0/db_1/bin/dbshut /ora01/app/oracle/product/11.2.0/db_1
echo -n ""
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
;;
esac
exit $?
|
note: where the line # chkconfig: 345 85 15
345 is the running level
85 is the startup sequence
15 is the killing sequence
Then launch the chkconfig
# chkconfig --add oracle
and test it
# service oracle start
# service oracle stop
# service oracle restart
Now install the APEX 5
1. Download the Apex
Option 1: Download from Oracle
I downloaded the All Language verion here and got a zip file “apex_5.1.3.zip” in /home/oracle/Downloads and move it to /home/oracle
I downloaded the All Language verion here and got a zip file “apex_5.1.4.zip” in /home/oracle/Downloads and move it to /home/oracle
[oracle@cloud ~]mv /home/oracle/Downloads/apex_5.1.3.zip /home/oracle/
[oracle@cloud ~]mv /home/oracle/Downloads/apex_5.1.4.zip /home/oracle/
Option 2: Download directly from Internal Server
[oracle@cloud ~]cd /home/oracle
[oracle@cloud ~]$ wget --user=software --password=download123 ftp://188.4.72.23/homes/software/apex_5.1.3.zip
[oracle@cloud ~]$ wget --user=software --password=download123 ftp://188.4.72.23/homes/software/apex_5.1.4.zip
2. unzip the file to /home/oracle
[oracle@cloud ~]$ cd /home/oracle
[oracle@cloud ~]$ unzip apex_5.1.3.zip
[oracle@cloud ~]$ unzip apex_5.1.4.zip
now you have a directory /home/oracle/apex which contains necessary installation scripts
3. running apex installation scripts
[oracle@cloud ~]$ cd /home/oracle/apex
create a directory for storing apex database
[oracle@cloud ~]$ mkdir -p /home/oracle/orcldata/orcl
[oracle@ apex]$ sqlplus /nolog
SQL> connect sys@orcl as sysdba
Enter password:
Connected.
SQL> CREATE TABLESPACE APEX DATAFILE '/home/oracle/orcldata/orcl/apex01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M;
SQL> @apexins.sql APEX APEX temp /i/
It takes several minutes to complete and finally you should see the screen.
4. now setting up the apex admin password (the password must contains punctuation symbol and difference cases of characters and number. try to include _ / A-Z /a -z/1-9)
[oracle@cloud ~]$ cd /home/oracle/apex
[oracle@cloud apex]$ sqlplus /nolog
SQL> connect sys@orcl as sysdba
Enter password:
Connected.
SQL> @apxchpwd.sql
input just simply press default except the password
Enter the administrator's username [ADMIN]
Enter ADMIN's email [ADMIN]
Enter ADMIN's password []
5. Now, setting up the Embedded PL/SQL Gateway (EPG)
5.1 loading images
[oracle@cloud ~]$ cd /home/oracle/apex
[oracle@cloud apex]$ sqlplus /nolog
SQL> connect sys@orcl as sysdba
Enter password:
Connected.
SQL> @apxldimg.sql /home/oracle
It takes several minutes to complete, and you should see the screen.
5.2 config epg
SQL> @apex_epg_config.sql /home/oracle
it takes several minutes to complete and you should see the screen
5.3 unlock anonymous account
SQL> alter user anonymous account unlock;
5.4 setup http listening port
SQL> select dbms_xdb.gethttpport from dual;
SQL> exec dbms_xdb.sethttpport(8080);
SQL> commit;
Login to apex admin (from local machine)
your should now able to login with http://127.0.0.1:8080/apex/apex_admin at your console or through xwindow system
Login to apex admin (from other machines)
To allow other machine to access it, do the following,
[oracle@cloud ~]$ sqlplus /nolog
SQL> connect sys@orcl as sysdba
Enter password:
Connected.
SQL> exec dbms_xdb.setListenerLocalAccess (l_access => FALSE);
One more thing, stop the local firewall (iptables) for testing, you need to include the port in iptables rules later. We will modify that with Webmin. Try to refer Webmin setup guide.
[oracle@cloud ~]$ service iptables stop
now it should work, in my case, I can access apex admin from other machine now with following url