apache + tomcat + oracle + opencms 备忘

httpd-2.2.22 编译
httpd-2.2.22 编译与 rpm 版本 apr 冲突, 必须先卸载 apr, svn 等软件 (rpm)

libiconv-1.14 编译
./configure --enable-static

echo "/usr/local/lib" >> /etc/ld.so.conf.d/lamp.conf
ldconfig

apr-1.4.6 编译
./configure --disable-ipv6
echo "/usr/local/apr/lib"  >> /etc/ld.so.conf.d/lamp.conf
ldconfig

apr-iconv-1.2.1 编译
./configure --with-apr=/usr/local/apr/bin/apr-1-config
echo "/usr/local/apache2/lib/iconv"  >> /etc/ld.so.conf.d/lamp.conf
ldconfig


apr-util-1.5.2 编译
ln -s /usr/src/lamp/apr-iconv-1.2.1 /usr/src/lamp/apr-util-1.5.2/apr-iconv-1.2.1
./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-iconv=/usr/local --with-apr-iconv=./apr-iconv-1.2.1
ldconfig

 ln -s /usr/src/lamp/apr-util-1.5.2/./apr-iconv-1.2.1/lib/libapriconv-1.la /usr/src/lamp/apr-util-1.5.2/./apr-iconv-1.2.1/lib/libapriconv.la


httpd-2.2.22 编译
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-headers --enable-expires --enable-filter --enable-deflate --enable-file-cache --enable-env --enable-proxy --enable-vhost-alia

建立 apache 启动脚本

cp /usr/local/apache2/bin/apachectl  /etc/rc.d/init.d/apache

vi /etc/rc.d/init.d/apache
# Description: tomcat connector
# chkconfig: 2345 80 80

chkconfig --add apache
chkconfig apache on

apache 配置修改

Listen 80
Listen 81

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

DirectoryIndex index.html index.jsp

Include conf/extra/httpd-vhosts.conf

虚拟端口主机调度配置

vi /usr/local/apache2/conf/extra/httpd-vhosts.conf

NameVirtualHost *:80
NameVirtualHost *:81

<VirtualHost *:80>
        ProxyPreserveHost On
        ServerName sybase
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/
</Virtualhost>

<VirtualHost *:81>
        ProxyPreserveHost On
        ServerName sybase
        ProxyPass / http://localhost:8081/
        ProxyPassReverse / http://localhost:8081/
</Virtualhost>

JDK 安装

tar xf  /opt/tools/jdk-7u6-linux-x64.tar.gz
mv jdk1.7.0_06 /usr/local/java.1.7.0_06
ln -s /usr/local/java.1.7.0_06 /usr/local/java

vi /etc/profile

JAVA_HOME=/usr/local/java
TOMCAT_HOME=/usr/local/tomcat
CATALINA_HOME=$TOMCAT_HOME
CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin:$TOMCAT_HOME/bin

source /etc/profile

tomcat 安装

配置文件 /usr/local/tomcat/conf/server.xml
端口  8080  8081
服务 service tomcatd start

安装方法

tar xf /opt/tools/apache-tomcat-7.0.29.tar.gz
ln -s /usr/local/apache-tomcat-7.0.29 /usr/local/tomcat

cd /usr/local/tomcat/webapps/
rm -rf *

配置

vi /usr/local/tomcat/conf/server.xml

添加 8081 端口监听
    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

vi /usr/local/tomcat/bin/startup.sh
JAVA_HOME=/usr/local/java
TOMCAT_HOME=/usr/local/tomcat
CATALINA_HOME=$TOMCAT_HOME
CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin:$TOMCAT_HOME/bin
export JAVA_HOME TOMCAT_HOME CATALINA_HOME CLASS_PATH PATH

tomcat daemon 安装

cd $CATALINA_HOME/bin
tar xvfz commons-daemon-native.tar.gz
cd commons-daemon-1.0.x-native-src/unix
./configure --with-java=/usr/local/java
make
cp jsvc ../..
cd ../..
cd $CATALINA_HOME
./bin/jsvc -cp ./bin/bootstrap.jar:./bin/tomcat-juli.jar \
   -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
   org.apache.catalina.startup.Bootstrap

/etc/rc.d/init.d/tomcatd 启动进程

#!/bin/bash
#
# tomcatd This shell script takes care of starting and stopping
# standalone tomcat
# chkconfig: 345 91 10
# description: tomcat service
# processname: tomcatd
# config file:

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
#[ = "no" ] && exit 0

prog=tomcatd

export JAVA_HOME=/usr/local/java
export CATALINA_HOME=/usr/local/tomcat
PATH=$PATH:$JAVA_HOME/bin

STARTUP=$CATALINA_HOME/bin/startup.sh
SHUTDOWN=$CATALINA_HOME/bin/shutdown.sh

if [ ! -f $CATALINA_HOME/bin/startup.sh ]
then
    echo "CATALINA_HOME for tomcatd not available"
    exit
fi

start() {
    # Start daemons.

    echo -n $"Startting tomcat service: "
    daemon $STARTUP
    RETVAL=$?
return $RETVAL
}

stop() {
    # Stop daemons.
    echo -n $"Stoping tomcat service: "
    $SHUTDOWN
RETVAL=$?
  exit  $RETVAL
}

# See how we were called.
case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
restart|reload)
    stop
    start
    RETVAL=$?
    ;;
status)
    status $prog
    RETVAL=$?
    ;;
*)
    echo $"Usage: $0 {start|stop|restart|status}"
    exit 1
esac

exit $RETVAL

Oracle 11gR2 安装
添加用户

groupadd dba
groupadd oinstall
useradd oracle -g oinstall -G dba

定义环境变量

/etc/profile 
ORACLE_BASE=/u1/oracle/
ORACLE_HOME=/u1/oracle/product/11gr2
ORACLE_SID=ITVDB
ORACLE_PATH=/home/oracle
PATH=$PATH:$JAVA_HOME/bin:$TOMCAT_HOME/bin:$ORACLE_HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH ORACLE_PATH

创建目录

mkdir /u1/oracle/product/11gr2 -p
chown oracle:oinstall /u1 -R

优化 oracle 进程

/etc/security/limits.conf
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

利用图形完成整个 oracle 11gR2, 唯一需要注意地方, 填写正确的 SID, 其余部分, 略
安装过程中, listener 出现失败, 跳过listener, 以后手动进行修改


listener 配置

/u1/oracle/product/11gr2/network/admin/listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ITVDB)
      (ORACLE_HOME = /u1/oracle/product/11gr2)
      (SID_NAME = ITVDB)
    )
    )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.17.124 )(PORT = 1521))
    )
  )

连接器配置

/u1/oracle/product/11gr2/network/admin/tnsnames.ora
ITVDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.17.124)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ITVDB)
    )
  )

利用 lsnrctl start | lsnrctl status 命令检测连接器启动信息

为 opencms 创建对应 oracle 表空间与用户

建表空间, 用户
sqlplus / as sysdba

create tablespace opencms datafile  '/u1/oracle/oradata/ITVDB/opencms.dbf' size 4g;
create user opencms identified by opencms default tablespace opencms temporary tablespace temp;
grant connect, resource to opencms;
grant unlimited tablespace to opencms;

创建的表空间名为 opencms ,数据库用户及密码为:opencms/opencms

 

opencms 安装

cd /usr/src/opencms
unzip opencms_8.0.4.zip 
mkdir /usr/local/tomcat/webapps/opencms
cp opencms.war /usr/local/tomcat/webapps/opencms
cd /usr/local/tomcat/webapps/opencms
jar xvf opencms.war 
rm -f opencms.war


配置 opencms

vi /usr/local/tomcat/webapps/opencms/WEB-INF/config/opencms-system.xml

 <site server="http://localhost:8080" uri="/sites/default/"/>
 <site server="http://localhost:8081" uri="/sites/media/"/>  ## 添加
</sites>

重启 tomcatd
确保, 80, 81, 8080, 8081 端口全部正常启用

利用下面地址配置 opencms http://<host>:<port>/opencms/setup
注意部分

连接 sys as sysdba
用户 opencms
表空间, index opencms
原
jdbc:oracle:thin:@locaalhost:1521:opencms
修改为
jdbc:oracle:thin:@192.168.17.124:1521:ITVDB

安装完成后访问位置
http://192.168.17.124/opencms/opencms/system/login
Admin/admin

你可能感兴趣的:(apache + tomcat + oracle + opencms 备忘)