วันพุธที่ 11 ธันวาคม พ.ศ. 2556

Install Moodle Learning Managment System on CentOS 6

Moodle is a Course Management System (CMS), also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). It is a free web application that educators can use to create effective online/offline learning sites.

autostart oracle database/listener/em on centos 6.5

login เป็น root, 
สร้างไฟล์ /etc/init.d/oracle :
ก๊อปปี้ส่วนนี้ลงไป
-------------------------------------------------------------------------------------------------------------------------

#!/bin/bash


# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: Oracle 11g R2
#
# processname: oracle

. /etc/rc.d/init.d/functions

LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1/
ORACLE_USER=oracle

case "$1" in
'start')
   if [ -f $LOCKFILE ]; then
      echo $0 already running.
      exit 1
   fi
   echo -n $"Starting Oracle Database:"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
   touch $LOCKFILE
   ;;
'stop')
   if [ ! -f $LOCKFILE ]; then
      echo $0 already stopping.
      exit 1
   fi
   echo -n $"Stopping Oracle Database:"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
   su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
   rm -f $LOCKFILE
   ;;
'restart')
   $0 stop
   $0 start
   ;;
'status')
   if [ -f $LOCKFILE ]; then
      echo $0 started.
      else
      echo $0 stopped.
   fi
   ;;
*)
   echo "Usage: $0 [start|stop|status]"
   exit 1
esac


exit 0
---------------------------------------------------------------------------------------------------------------------------------

Make it executable:
chmod +x /etc/init.d/oracle


Test:
/etc/init.d/oracle start
/etc/init.d/oracle stop


Make it active:
chkconfig --add oracle
chkconfig oracle on


Verify:

chkconfig --list oracle

อ้างอิง : http://janhellevik.com/?p=923

วันจันทร์ที่ 9 ธันวาคม พ.ศ. 2556

How to install Oralce 11g R2 Database server on Centos 6.5

1-Before to begin you have to  download  Some  dependencies
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
2-adjust the  sysctl.conf
in my case
[root@Oracle ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
Please  change to the  standard  Oracle  values
net.ipv4.ip_forward = 0
 net.ipv4.conf.default.rp_filter = 1
 net.ipv4.conf.default.accept_source_route = 0
 kernel.sysrq = 0
 kernel.core_uses_pid = 1
 net.ipv4.tcp_syncookies = 1
 net.ipv4.ip_local_port_range = 9000 65500
 fs.file-max = 65536
 kernel.shmall = 10523004
 kernel.shmmax = 6465333657
 kernel.shmmni = 4096
 kernel.sem = 250 32000 100 128
 net.core.rmem_default = 262144
 net.core.wmem_default = 262144
 net.core.rmem_max = 4194304
 net.core.wmem_max = 1048576
 fs.aio-max-nr = 1048576
3-add  users and  groups and  permissions
[root@Oralce ~]#groupadd -g 200 oinstal
[root@Pirat9 ~]#groupadd -g 201 dba
[root@Pirat9 ~]#useradd -u 440 -g oinstall -G dba -d /app/oracle oracle
[root@Pirat9 ~]#vi /etc/pam.d/login
# add
session    required     pam_selinux.so open
 session    required     pam_namespace.so
 session    required     pam_limits.so
 session    optional     pam_keyinit.so force revoke
 session    include      system-auth
 -session   optional     pam_ck_connector.so
[root@Pirat9 ~]#vi /etc/security/limits.conf
 # add This  bellow
 oracle   soft   nproc   2047
 oracle   hard   nproc   16384
 oracle   soft   nofile   1024
 oracle   hard   nofile   65536
 [root@Pirat9 ~]#vi /etc/profile
 # add at the last line
 if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 fi
Now Switch to a user Oracle
 [oracle@Pirat9 ~]$chmod 755 /app/oracle
[oracle@Pirat9 ~]$mkdir /app/oracle/app
[oracle@Pirat9 ~]$chmod 775 /app/oracle/app
[oracle@Pirat9 ~]$mkdir /app/oracle/oradata
[oracle@Pirat9 ~]$chmod 775 /app/oracle/oradata
[oracle@Pirat9 ~]$vi ~/.bash_profile
 # add this to oracle profile
ORACLE_HOME=/app/oracle/11.2.0.2/client
ORACLE_BASE=/app/oracle
TEMP=/app/tmp/ora
TMPDIR=/app/tmp/ora

export ORACLE_HOME
export ORACLE_BASE
export TEMP
export TMPDIR
export PATH

PATH=$PATH:$HOME/bin::$ORACLE_HOME/bin
umask 022
Create the directories and set the appropriate permissions in which the Oracle software will be installed.
[root@oracle]# mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
[root@oracle]# chown -R oracle:oinstall /u01
[root@oracle]# chmod -R 775 /u01
 download these files for your system architecture somewhere under “/home/oracle/“.
wget http://10.10.2.108/software/Oracle/linux.x64_11gR2_database_1of2.zip
wget http://10.10.2.108/software/Oracle/linux.x64_11gR2_database_2of2.zip


Now let’s start Oracle installation. First of all need to switch as ‘oracle’ user to install database.
[oracle@oracle ~]$ su oracle
Extract compressed Oracle database source files to the same directory “/home/oracle/“.
[oracle@oracle ~]$ unzip linux_11gR2_database_1of2.zip

[oracle@oracle ~]$ unzip linux_11gR2_database_2of2.zip
Post unzip source file, directory called database will be created, go to inside the directory and execute below script to start Oracle database installation process.
[oracle@oracle database]$ cd database

[oracle@oracle database]$ ./runInstaller
1. RunInstaller will call Oracle Universal Installer (OUI), wherein look and feel & steps are the same across all the operating system.
Oracle Universal Installer
Oracle Universal Installer
2. Provide your email address to be informed of security issues and receive security updates.
Configure Security Updates
Configure Oracle Security Updates
3. Create and Configure a Database
Create Oracle Database
Create Oracle Database
4. Choose the system class, either Desktop or Server.
Select System Class
Select Oracle System Class
5. Select the type of database installation you want to perform.
Oracle Node Selection
Select Database Installation Type
6. Select “Typical install” option to install full oracle installation with basic configuration.
Select Oracle Install Type
Select Typical Install
7. Set Administrative password and perform full Database installation with basic configuration.
Oracle Typical Installation Configuration
Set Oracle Administrative Password
8. Please click on “Yes” to continue with installation.
Oracle Typical Install Configuration
Typical Install Configuration Confirm
9. Create Inventory
Create Oracle Inventory
Create Inventory
10. If you faced prerequisites warning during installation. Click on “Fix & Check Again“. Oracle fixes Prerequisites by itself. This is the new feature of Oracle Database 11g.
Perform Prerequisite Checks
Perform Prerequisite Checks
The pdksh package is not available in Oracle repository due to which you need to download and install it manually.
[root@oracle]# wget ftp://rpmfind.net/linux/redhat-archive/6.2/en/os/i386/RedHat/RPMS/pdksh-5.2.14-2.i386.rpm
During pdksh package installation you may encountered conflict error of ksh package. Remove ksh package forcefully and install the pdksh package with given below command:-
[root@oracle]# rpm -e ksh-20100621-19.el6_4.4.i686 --nodeps
[root@oracle]# rpm -ivh pdksh-5.2.14-2.i386.rpm
11. Performing Prerequisite checks: It’s test whether sufficient total SWAP space is available on the system.
Performing Prerequisite SWAP Check
Performing Prerequisite SWAP Check
12. Installation Summary: Click on Save Response File. This file is useful for Oracle Silent Mode Installation
Oracle Installation Summary
Oracle Installation Summary
13. Save Response File somewhere in your system.
Save Response File
Save Response File
14. Product Installation Progress
Install Oracle Product
Product Install
15. Copying database files
Copying Database Files
Copying Database Files
16. Click on “Password Management“.
Oracle Password Management
Oracle Password Management
17. Set password for user “SYS” and click on OK to continue.
Set SYS User Password
Set SYS User Password
18. Configuration scripts need to be executed as the “root” user. Go to the path given in the screen and execute the scripts one by one. Click on ‘OK‘ once scripts is executed.
Execute Configuration Scripts
Execute Configuration Scripts
[root@oracle]# cd /u01/app/oraInventory
[root@oracle oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oracle]# cd /u01/app/oracle/product/11.2.0/dbhome_2/
[root@oracle dbhome_2]# ./root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_2

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.
19. The installation of Oracle Database is successful.
Oracle Installation Completed
Oracle Installation Finish
20. To test your Oracle installation navigate to web based management interface for your system at “localhost” with the user name “SYS” connecting as “SYSDBA” and using thepassword you set during the install of Oracle. Remember to open port 1158 on your firewall and restart the iptables service.
[root@oracle]# iptables -A INPUT -p tcp --dport 1158 -j ACCEPT
[root@oracle]# service iptables restart
https://localhost:1158/em/
Oracle Enterprise Manager Login
Oracle Enterprise Manager Login
21. Oracle Enterprise Database Control Manager
Oracle Database Control Manager
Oracle Database Control Manager
Now you can start using Oracle. I highly recommend you to follow the Oracle Documentation for more help. There are number of client applications out there which can help you, like the command line tool called Oracle Instant Client and the Oracle SQL Developer UI program.
This is end of the Oracle Database Software Installation. In our upcoming article we will be covering how to create database using DBCA and how to Start-up and Shutdown Oracle Database. Please stay tuned…!!!