opensuse following jdk, apache, tomcat, mysql, jsp layout and testing

分类:Database 2010-06-04 来源:CodeWeblog.com 人气:279

A project the company needs to build a virtual machine and apache web cluster platform, out for a week, finally tomcat and apache, mysql integration is complete, refer to the experience of online friends, in the light of their own installation process, write down, in particular, problems and a solution for everyone to share, hope to go the other of a friend some detours also to contribute to Zi Ji Zuo notes, all software was Muqianzuixin version, are downloaded from the official site (recommended) .
1. Install jdk, I suggest, are not familiar with linux friends, do not directly ysat or yum and other tools to download, it will not find the file where, if they are more familiar with the words on linux can be.
sun official website to download jdk-6u20-linux-x64.bin
# Chmod u + x jdk-6u20-linux-x64.bin
# ./jdk-6u20-linux-x64.bin
ln-s / usr/local/jdk1.6.0_20 / usr / local / jdk
ln-s / usr/local/jdk1.6.0_20 / jre / usr / local / jre
# Vi / etc / profile
Add the following lines
export JAVA_HOME = / usr/local/jdk1.6.0_20
export CLASSPATH =.: $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar
export PATH = $ PATH: $ JAVA_HOME / bin
export CATALINA_HOME = / usr / local / tomcat
Save exit.
# Source / etc / profile
jdk java-version see whether the installation was successful
2. Install apache, apache is an excellent tool for dealing with static pages, tomcat can build a powerful set of web server processing power.
Download httpd-2.2.15.tar.gz
# Cp httpd-2.2.15.tar.gz / usr / local
# Cd / usr / local
# Tar zxvf httpd-2.2.15.tar.gz
# Cd httpd-2.2.15
#. / Configure-prefix = / usr / local / apache - enable-module = so
# Make
# Make install
Start Apache, and test.
# Cd / usr / local / apache / bin
#. / Apachectl start
Open the browser and in the address bar http://localhost, you can see "it works" page, indicating apache installed successfully.
3. Install tomcat, tomcat is apache handle dynamic pages out of a tool, you can debug jsp, php and so on.
Download apache-tomcat-6.0.26.tar.gz
# Tar zxvf apache-tomcat-6.0.14.tar.gz
# Cp-r apache-tomcat-6.0.14 / usr / local / tomcat
# / Usr / local / tomcat / bin / startup.sh
Open http://localhost:8080, saw a cat, you can verify the tomcat start
4. The whole, and apache and tomcat
Download tomcat-connectors-1.2.28-src.tar.gz
# Tar zxvf tomcat-connectors-1.2.28-src.tar.gz
Compile configuration. All of the following folders, if not, need to create.
# Cd tomcat-connectors-1.2.28-src/native
#. / Buildconf.sh
#. / Configure - with-apxs = / usr / local / apache / bin / apxs - with-tomcat = / usr / local / tomcat - with-java-home = / usr / java / jdk - with- jni
# Make
# Make install
# Cd / usr / local / apache / modules /
Found mod_jk.so generate success.

Edit apache configuration file:
# Vi / usr / local / apache / conf / httpd.conf

Add the following lines at the end
LoadModule jk_module modules / mod_jk.so
JkWorkersFile / usr / local / apache / conf / workers.properties
JkLogFile / usr / local / apache / logs / mod_jk.log
JkLogLevel info
JkLogStampFormat "[% a% b% d% H:% M:% S% Y]"
JkRequestLogFormat "% w% V% T"
JkMount / servlet / * worker1
JkMount / *. jsp worker1

Create a file workers.proferties
# Vi / usr / local / apache / conf / workers.porperties
Add the following:
workers.tomcat_home = / usr / local / tomcat
workers.java_home = / usr/local/jdk1.6.0_20
ps = /
worker.list = worker1
worker.worker1.port = 8009
worker.worker1.host = localhost
worker.worker1.type = ajp13
worker.worker1.connection_pool_timeout = 600
worker.worker1.socket_keepalive = 1
worker.worker1.lbfactor = 1
worker.inprocess.stdout = $ (workers.tomcat_home) $ (ps) logs $ (ps) inprocess.stdout
worker.inprocess.stderr = $ (workers.tomcat_home) $ (ps) logs $ (ps) inprocess.stderr
Finally restart tomcat and apache, the installation is completed we
# / Usr / local / tomcat / bin / shutdown.sh / / close the tomcat
# / Usr / local / tomcat / bin / startup.sh / / start tomcat
# / Usr / local / apache / bin / apachectl restart / / restart apache
This point, if everything is not wrong, this time apache jsp pages do not have the processing capacity, can only deal with some html page, if you want to deal with dynamic pages, requires the following configuration:
Configure server.xml, the file / usr / local / tomcat / webapps / conf folder below, modify the following places:
Host section in the back to add:
<Context Path="" docBase="/usr/local/apache/htdocs" debug="0" reloadable="true" crossContext="true">
Open the tomcat and apache, input http://localhost:8080/index.jsp, you can see the tomcat and apache are connected up.
5. Install mysql
Would have to download the installation package to install, but later found not installed, Guer directly opensuse the yast tool, download the latest version of mysql, will also be dependent packages and libraries down under.
Mysql installation key documents such as:
/ Etc / init.d / mysql ------ start script
/ Etc / logrotate.d / mysql
/ Etc/sysconfig/susefirewall2
/ Var / lib / mysql / ------ start mysql parameters
/ Etc / my.cnf ------ set the parameters, on the port
/ Usr / localmysql
If you want to delete the downloaded mysql, need to delete all the above three behind a clean, otherwise the installation of mysql will not start. Another is to delete the above data, the start mysql after Tishi Cuowuqueshao "mysql.sock" (the file in the / var / lib / mysql / below), in which case, can restart the machine, mysql server will be in After starting the machine generate the document. Start the mysql service, a database group_data, and then build the form in which the test, the following statement:
create table test / / build table test
(
id int (3) auto_increment not null primary key,
name char (10) not null,
address varchar (50) default 'dongguan',
year date
); / / Build the table end
/ / The following Insert Field
insert into test values ('1 ',' gdeii ',' dongguan ', '2010-06-04');
6. Connect mysql, tomca do download jsp test connector mysql-connector-java-5.1.12.tar.gz
# Tar-zxvf mysql-connector-java-5.1.12.tar.gz
# Cp mysql-connector-java-5.1.12-bin.jar / usr / local / tomcat / lib
, Prepared by the jsp test page mysql.jsp
I used the test page is as follows:
<% @ Page contentType = "text / html; charset = gb2312"%>
<% @ Page import = "java.sql .*"%>
<html>
<body>
<%
String sql = "select * from test;";
String url = "jdbc: mysql: / / localhost: 3306/group_data";
String user = "root";
String password = "";
try
(
Class.forName ("com.mysql.jdbc.Driver"). NewInstance ();
)
catch (ClassNotFoundException e)
(
out.println ("driver not found");
)
Connection conn = DriverManager.getConnection (url, user, password);
Statement stm = conn.createStatement ();
ResultSet rs = stm.executeQuery (sql);
if (rs.next ())
(
out.println (rs.getString (1 )+"");
out.println ("|");
out.println (rs.getString (2));
)
else
(
out.println ("fail");
)
rs.close ();
stm.close ();
conn.close ();
%>
</ Body>
</ Html>
Restart tomcat, mysql, in your browser and enter http://localhost:8080/mysql
Page appears
1 | gdeii
Note the database connect successful.

分享到:
blog comments powered by Disqus

相关文章

  • Linux, Tomcat and the Apache Web server integration 2010-12-30

    Linux, Tomcat and the Apache Web server consolidation 1 Introduction Web-based technology, Internet / Intranet in recent years has been widely used, Intranet is a TCP / IP protocol-based, enterprise Web as the core network, users low-cost, easy to use at

  • Linux + Nginx + Php set up WEB server performance 2010-12-04

    Nginx ("engine x") is a high-performance HTTP server and reverse proxy, but also a IMAP/POP3/SMTP proxy server. Nginx by Igor Sysoev of Russia's second Rambler.ru site visits developed, it has been running for more than two and a half the si

  • 20 Nginx Web server security best practices 2010-10-02

    Nginx is a lightweight, high-performance Web server / reverse proxy and e-mail agent (IMAP/POP3), it can run on UNIX, GNU / Linux, BSD variants, MAC OS X, Solaris and Microsoft Windows. According to Netcraft's survey data show that 6% of Internet doma

  • Tomcat Web server clusters and load balancing technology 2010-09-15

    Into the architecture of cluster system before define some terminology: 1. Cluster (Cluster): is a group of independent computer systems to form a loosely coupled multi-processor system, the network between them to achieve inter-process communication. App

  • Reprinted with the web application web server and browser 2010-11-09

    Chapter I: Application Server Application Server (By huihoo.com tonyliu) Why should there be an application server The last decade, Internet-based applications at an unprecedented high-speed forward, one important direction is the application of Web-

  • Recommended introduced several small Web Server program 2010-04-30

    This article comes from http://blog.csdn.net/heiyeshuwu/archive/2007/08/22/1753900.aspx Came across a few small interesting Web Server process, feel the need to bring to share, let everyone know that in addition to Apache, IIS, the original and more ...

  • Three Web Server analysis (Apache.Lighttpd.Nginx) 2010-06-11

    Transfer from race question First, the software introduced 1. Lighttpd Lighttpd is a very low memory overhead, CPU occupancy rate is low, performance is good, and a wealth of modules and so on. Lighttpd is a lightweight, OpenSource webserver many of

  • Cloud Computing and Cluster. Virtual Machine 2010-06-29

    Thank http://nightknight.javaeye.com/blog/440461 Here, "cluster" refers to the core of the distributed parallel computing system. 1. Cloud computing platform using the abstract virtual machine isolation of different users. A user platform i

  • kvm virtual machine ubuntu server in the installation and use of 2011-09-13

    ubuntu server installation in kvm virtual machine Server environment: ubuntu 11.04 amd64, cpu in the bios to turn on the vt. Installing software sudo apt-get install kvm libvirt-bin python-vm-builder Configure virtual machine networking I am here to

  • When starting mysql error: mysqld_safe Logging to '/ usr / local / mysql / data / zrf.err'. 2010-10-21

    After installing mysql, execute mysqld_safe - user = mysql & command reported the following error: [Root @ zrf ~] # / usr / local / mysql / bin / mysqld_safe - user = mysql & [1] 3527 [Root @ zrf ~] # 101021 16:37:39 mysqld_safe Logging to

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.488 (s). 14 q(s)