Sunteți pe pagina 1din 15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

Home > Blog > Development

Oracle Database 11g + Drupal 7 Installation Routine


05.09.2013

0 Comments

Author: kef

The article describes CMS Drupal deployment, as being performed with the use of Oracle
DB and with Debian server employed. Thus, at our disposal we have Debian X64 operation
system, nginx webserver and php-fpm back end server which is geared toward handling
the php scripts. A good many of articles have described Nginx + php-fpm server
deployment routine, hence there's no need to fix on it for long, and we shall directly
proceed to preparing the Oracle DB installment. First a Drupal developer will need to install
http://internetdevels.com/blog/oracleinstall

1/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

the whole number of php modules that we may require:


# apt-get install php5-mysql php5-curl php5-dev php-pear php-db php5-gd php5-idn
php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps
php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
# /etc/init.d/php5-fpm restart
As long as we have used Debian Based , RPM packages, the standard installation
routine, thus and so, will not work out. Hence, we will make use of Alien utility in this case:
# apt-get install alien
We next proceed to the libraries we require:
# apt-get install libaio1 unixodbc
As to core parameters, we work them out as follows: we create /etc/sysctl.d/60-oracle.conf
file which contains:
fs.filemax=6815744
net.ipv4.ip_local_port_range=900065000
kernel.sem=25032000100128
kernel.shmmax=536870912
And then we get the following command running:
# service procps start
On top of this, for we are dealing with Debian operation system, it seems that we are in
need of a catalog to keep the database and the client:
# mkdir /home/oracle-xe
# ln -s /home/oracle-xe /u01
Next, we take up the Oracle DB installation, proper. We have to primarily download zip
archive Oracle Database Express Edition 11g Release 2 for Linux x64 right away which can
be

accessed

http://internetdevels.com/blog/oracleinstall

at:

http://www.oracle.com/technetwork/products/express2/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

edition/downloads/index.html.Then we do the unpacking which is to be followed by cleaning

out the wastes (mind that the version of your package may differ!) :
# unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
# mv Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm ./
# rm -r Disk1
We are creating the package with the help of Alien utility:
# alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
At this point we are in lack of /sbin/chkconfig file in the Debian system, which is required to
support the installer, this type of file, thus, should be created and should contain the
following:
#!/bin/bash
#Oracle11gR2XEinstallerchkconfighackforDebianbasedLinux(bydude)
#Onlyrunonce.
echo"Simulating/sbin/chkconfig..."
if[[!`tailn1/etc/init.d/oraclexe|grepINIT`]];then
cat>>/etc/init.d/oraclexe<<EOM
#
###BEGININITINFO
#RequiredStart:\$remote_fs\$syslog
#RequiredStop:\$remote_fs\$syslog
#DefaultStart:2345
#DefaultStop:016
#ShortDescription:Oracle11gExpressEdition
###ENDINITINFO
EOM
fi
updaterc.doraclexedefaults8001
We supply the launch admission:
# chmod 755 /sbin/chkconfig
http://internetdevels.com/blog/oracleinstall

3/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

Incidentally, we shoud configure out the compatibility with Debian system:


# ln -s /usr/bin/awk /bin/awk
# mkdir /var/lock/subsys
Next, we proceed to installing Oracle DB (in the event of conflict of the following file
configuration /etc/init.d/oracle-xe we should opt for install the package version [Y]) :
# dpkg --install ./oracle-xe_11.2.0-2_amd64.deb
Setting up Oracle:
# service oracle-xe configure
We enter the web interface port number, database port number and the password which
the user of SYSTEM database will require.
We set the password for Oracle system user:
# passwd oracle
We set the HOME directory for Oracle user:
# cp /etc/skel/.bash_logout /u01/app/oracle
# cp /etc/skel/.bashrc /u01/app/oracle
#

echo

'.

/u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh'

>

/u01/app/oracle/.profile
# chown -R oracle:dba /u01/app/oracle
To

set

up

the

correct

SID,

we

make

the

file

/u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora look like follows (you set


the PORT value to one of your own):
#tnsnames.oraNetworkConfigurationFile:
XE=
(DESCRIPTION=
http://internetdevels.com/blog/oracleinstall

4/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(SERVICE=XEXDB)(HOST=127.0.0.1)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=XE)
)
)
While /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora should look like
(you should replace PORT and HOST values for your own, and mind that HOST should
stand for the hostname, not the IP address):
#listener.oraNetworkConfigurationFile:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=XE)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe)
(PROGRAM=extproc)
)
)
LISTENER=
(DESCRIPTION_LIST=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))
(ADDRESS=(PROTOCOL=TCP)(HOST=debian)(PORT=1521))
)
)
DEFAULT_SERVICE_LISTENER=(XE)
Besides, the environment variables need to be adjusted, as they are not set up at the
moment of package installation. For this, we add the following strings into
/etc/environment file:
http://internetdevels.com/blog/oracleinstall

5/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
TNS_ADMIN=/u01/app/oracle/product/11.2.0/xe/network/admin
ORACLE_SID=XE
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib
NLS_LANG=AMERICAN_AMERICA.AL32UTF8

Then we perform installation of the variables for $PATH environment as meant for the users
whohavebeengrantedtheaccesstosqlplus:
#echo'PATH=$PATH:/u01/app/oracle/product/11.2.0/xe/bin'>>~root/.bash_profile
#echo'PATH=$PATH:/u01/app/oracle/product/11.2.0/xe/bin'>>~oracle/.bash_profile
As

it

is,

the

file

admission

status

should

be

set

up

correctly

to

the

/u01/app/oracle/product/11.2.0/xe/bin/oraclefile,orelseanerrormessagewillbethrownupat
themomentofsqlplusauthorizationORA12547:TNS:lostcontact:
#chmod6751/u01/app/oracle/product/11.2.0/xe/bin/oracle
Afterwards,weperformtheserverrebootandtrylogginginthesqlplusconsole:
#reboot
(Important! The download having been done, 502 Bad Gateway error may pop up the
moment the page is accessed. That requires rebooting phpfpm: # /etc/init.d/phpfpm
restart )
#sqlplusSYSTEM
At this point, Oracle DB set up is complete. The next step involves installing php PDO_OCI
modulewhichiscrucialforDrupalandOracleDBinteraction.We,further,createatemporary
directory to download Oracle instance client into. It can be tracked by the following link:
http://www.oracle.com/technetwork/topics/linuxx8664soft092277.html, (here we need the foll.

archives: instantclientbasic, instantclientsdk, instantclientsqlplus) and then we unpack them


(mindthatyourarchives'versionscandiffer):
http://internetdevels.com/blog/oracleinstall

6/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

#unzipinstantclientbasiclinux.x6412.1.0.1.0.zip
#unzipinstantclientsqlpluslinux.x6412.1.0.1.0.zip
Weshouldcreatesymboliclinksatthispoint,whichwillreferustotherequiredlibraries:
#cd/u01/app/oracle/instantclient
#lnslibclntsh.so.*libclntsh.so
#lnslibocci.so.*libocci.so
#echo/u01/app/oracle/instantclient>>/etc/ld.so.conf
#ldconfig
#mkdirpinclude/oracle/11.1/
#cdinclude/oracle/11.1/
#lns/u01/app/oracle/instantclient/sdk/include/client
#cd/u01/app/oracle/instantclient
#mkdirplib/oracle/11.1/client
#cdlib/oracle/11.1/client
#lns/u01/app/oracle/instantclientlib
#lns/usr/include/php5//usr/include/php
Weproceedtophp_ocimoduledownloading:
#mkdirp/tmp/pear/download/
#cd/tmp/pear/download/
#pecldownloadpdo_oci
Nowit'sbiengunpacked:
#tarxvzfPDO_OCI*.tgz
#cdPDO_OCI*

CONTACT NOW

Nowwehavetopatchthemodule.Wewriteinconfig.m4.patchfilewhichcontainsthefollowing:
*** config.m4 2005-09-24 17:23:24.000000000 -0600
--- config.m4 2009-07-07 17:32:14.000000000 -0600
***************
*** 7,12 ****
--- 7,14 ----

http://internetdevels.com/blog/oracleinstall

7/15

CO

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then


PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][
]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
+ elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+ PDO_OCI_VERSION=11.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
PDO_OCI_VERSION=10.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
***************
*** 119,124 ****
--- 121,129 --- 10.2)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
;;
+ 11.1)
+ PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
+ ;;
*)
AC_MSG_ERROR(Unsupported Oracle version! $PDO_OCI_VERSION)
;;
Wesavethefileandpatchit:
#exportORACLE_HOME=/u01/app/oracle/instantclient
# patch --dry-run -i config.m4.patch
# patch -i config.m4.patch
Thenwehavethemodulecompiledandinstalled:
#phpize
# ./configure --with-pdo-oci=instantclient,/u01/app/oracle/instantclient,11.1
#make
# make test
# make install

http://internetdevels.com/blog/oracleinstall

8/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

Phpconfigurationfilehavingbeenadded,wegetthemodulerunning:
#touch/etc/php5/fpm/conf.d/pdo_oci.ini
#echo"extension=pdo_oci.so">/etc/php5/fpm/conf.d/pdo_oci.ini
#/etc/init.d/php5fpmrestart
Youcancheckupwhetherphpmoduleworkswithuseofinfo.phpfile.Toachivethiswecreate
info.phpfile(Fornginxit's/usr/share/nginx/html/)thatcontainsthefollowing:

<strong><span><?php<br><span>phpinfo</span><span>();</span><br><span>?></span></span></strong>

Once finished, we start it running in the browser window http://host-ip/info.php (where


hostip will be changed for addres or domain which points out to the server), and the
activatedmodulesshouldenlistpdo_oci.

Ifit'sdone,wecanproceedtoemployingDrupal.First,tablespaceshouldbecreatedandgotten
ready.Thattakescaution:sqlplusconsoletakesnoexcuses:
#sqlplusSYSTEM
SQL>createtablespacedrupal
2logging
3datafile'/u01/app/oracle/oradata/XE/drupal.dbf'
4size32m
5autoextendon
6next32mmaxsize3072m
7extentmanagementlocal
SQL>createuserdrupalidentifiedbypassword(wherepasswordisuserpassword)
2defaulttablespacedrupal
http://internetdevels.com/blog/oracleinstall

9/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

3temporarytablespacetemp
SQL>grantunlimitedtablespacetodrupal
SQL>connsys/passwordassysdba(passwordreplacewithpasswordofuserSYSTEM)
SQL>grantexecuteondbms_cryptotodrupal
SQL>grantselectonv_$sql_plantodrupal
SQL>grantselectonv_$sqlareatodrupal
SQL>grantconnecttodrupal
SQL>grantresourcetodrupal
Tablespaseisupandrunning,thuswecanleavethesqlplusconsole(Cntrl+D).Wemoveinto
therootofoursite,sayinthewhereaboutsof/usr/share/nginx/html/(asthedefaultone,Nginx
serverdirectoryisbeingused)
#cd/usr/share/nginx/html/
Intheeventofanyfiletherein,theyaretobedeleted:
#rmr./*
The recent Drupal version is to be downloaded, which can be accessed by reference on the
site https://drupal.org/project/drupal (the version may differ):
#wgethttp://ftp.drupal.org/files/projects/drupal7.23.tar.gz
Weunpackthearchiveandpastethefilesintotherootcataloge:
#tarxzvfdrupal7.23.tar.gz
#cprdrupal7.23/*./
ThenwedeletethearchiveandDrupalcatalogwhichwedon'tneedanymore:
http://internetdevels.com/blog/oracleinstall

10/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

#rmrdrupal7.23drupal7.23.tar.gz
WeinstallthemodulewhichallowsthecooperationwithOracleDB.
We

download

the

module

(it's

recent

version

can

be

linked

to

by

https://drupal.org/project/oracle):

#cdincludes/database/
#wgethttp://ftp.drupal.org/files/projects/oracle-7.x-1.12.tar.gz
Weunpackanddeletethearchivewearenolongerinneed:
#tarxzvforacle7.x1.12.tar.gz
#rmoracle7.x1.12.tar.gz
#cdoracle/module/
#mvoracle//usr/share/nginx/html/sites/all/modules/
(westilldefineourpathtotherootcatalogofDrupal)
Wesetupthecorrectfileadmissions:
#cd/usr/share/nginx/html/
#chownRwwwdata:wwwdata./
#chmodR750./
Finally, in the browser window. we activate the link leading to our future site http://hostip/install.php(wherein we replace host-ip with the address, which points out to
the server). One should keep in mind that the next step implies writing in XE into the
Database name field, by no means tablespace, which has been created by us, whareas
Database username the user proper (the one created by us) and not the SYSTEM.

http://internetdevels.com/blog/oracleinstall

11/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

The remaining part of the installation process does not differ from the usual routine much:
we enter data about the site and take up the next step.Now the installation is complete.
we are in a possession of a ready-to-use Drupal package, which runs on Oracle.
Rating

http://internetdevels.com/blog/oracleinstall

12/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

READ ALSO
1

Creating drush-commands
Development

7281 views

Experienced Drupal coders can hardly do without Drush (Drupal shell) utility, as it speeds up a
good deal of routine function along the...

http and https usage in Drupal


Development

6963 views

You may face a situation, at times, when both HTTPand...

ACL API Utilization For Creating Access Control Lists


Development

2848 views

There are certain instances when you are being encouraged to implement access control
practices...

Creating of custom actions and events using rules api


Development

8070 views

Module rules allows ustoimplement the events (actions) after performing certain actions
(events).It has a...

Chart Plotting in Drupal Via Library pChart


Development

4009 views

Let us give a brief outline of the library to be going with.pChart...

Join to peoples who already subscribe


Email
SUBSCRIBE

http://internetdevels.com/blog/oracleinstall

13/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

0Comments
Recommend

internetdevels.com

Share

Login

SortbyNewest

Startthediscussion

Bethefirsttocomment.

Subscribe

AddDisqustoyoursite

HEAD OFFICE
Bozhenka st. 34g, Lutsk,
43017, Ukraine
+38 066 170 74 18
office@internetdevels.com
v.levandovsky
http://internetdevels.com/blog/oracleinstall

Privacy

NEWSLETTER
Subscribe to receive our exclusive
newsletter. Don't worry we'll never
use your email address for evil
purposes.
Enter your email here!

SUBSCRIBE
14/15

7/30/2015

OracleDatabase11g+Drupal7InstallationRoutineInternetdevelsofficialblog

2007 - 2015 INTERNETDEVELS.


Web development army for hire

http://internetdevels.com/blog/oracleinstall

15/15

S-ar putea să vă placă și