日期:2014-05-16  浏览次数:21118 次

(转)OpenSuse下安装jdk\mysql\tomcat\nginx\mysql-proxy


1.安装 jdk
a.去http://java.sun.com下载jdk(j2se)1.6.0_19.bin
b.#chkmod 777 ./jdkxxx.bin
c.#./jdkxxx.bin
d.#vi /etc/profile
在文件最后加上: (假如安装在/usr/local/jdk目录 下)
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
e.在终端上初如化环境变量
#source /etc/profile
f.测试是否安装成功
#java
有显示 表示 成功

2.安装 mysql
a.去http://dev.mysql.com下载mysql-server,mysql-client的rpm包
b.#rpm -ivh mysql-server-xxx.rpm
c.#rpm -ivh mysql-client-xxx.rpm
d.安装服务
#chkconfig --list
查看是否有mysql的服务,如果没有请执行
#chkconfig --add mysql
e.开启服务
#service mysql start
f.测试
#netstat -nat
查看是否开启了3306端口
#mysql
进入表示已成功安装

3.安装 tomcat
a.去http://tomcat.apache.org下载最新版(tar.gz)
b.解压到/usr/local/目录 下
c.加权限
#chmod a+x /usr/local/tomcat/bin/startup.sh
#chmod a+x /usr/local/tomcat/bin/shutdown.sh
#chmod a+x /usr/local/tomcat/bin/catalina.sh
#chmod a+x /usr/local/tomcat/bin/setclasspath.sh
d.测试
#/usr/local/tomcat/bin/startup.sh
用浏览器访问http://127.0.0.1:8080,如果能看到tomcat主界面表示成功
f.编写tomcat服务
#vi /etc/init.d/tomcat
#!/bin/bash
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $ALL
# Required-Stop: $ALL
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop ORS
# Description: tomcat ORS SERVER
### END INIT INFO
export JAVA_HOME=/usr/local/jdk
case $1 in
??? 'start')
?? ??? echo -n "Starting tomcat..."
??? ??? /usr/local/tomcat/bin/startup.sh
????? echo " done"
?????? ;;
??? 'stop')
?? ??? echo -n "Stopping tomcat..."
??? ??? /usr/local/tomcat/bin/shutdown.sh
??? ??? echo " done"
?????? ;;
??? 'restart')
??? ??? /usr/local/tomcat/bin/shutdown.sh
??? ??? sleep 5
??? ??? /usr/local/tomcat/bin/startup.sh
?????? ;;
??? *)
??? ??? echo -n "Usage: $0 {start|restart|stop}"
?????? ;;
???
esac
:quit
g.添加服务
#chkconfig --add tomcat

4.安装 nginx
a.去http://www.nginxcn.com下载linux版本的源代码包
b.解压下载的包
c.查看系统有无gcc包,如果没有请安装gcc
d.安装pcre组件及其依赖包
e.安装openssl组件及其依赖包
f.安装make组件及其依赖包
g.编译nginx
#./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
没有错误提示表示编译成功
h.安装
#make
#make install
i.测试
#/usr/local/nginx/sbin/nginx
用浏览器访问http://127.0.0.1,出现欢迎界面表示成功

j.修改配置文件,添加负载

#vi /usr/local/nginx/conf/nginx.conf

用下面的内容替换


#user? nobody;
worker_processes? 1;

#error_log? logs/error.log;
#error_log? logs/error.log? notice;
#error_log? logs/error.log? info;

#pid??????? logs/nginx.pid;

worker_rlimit_nofile 65535;
events {
??? use epoll;
??? worker_connections? 65535;
}


http {
??? include?????? mime.types;
??? default_type? application/octet-stream;

??? log_format? main? '$remote_addr - $remote_user [$time_local] "$request" '
????????????????????? '$status $body_bytes_sent "$http_referer" '
????????????????????? '"$http_user_agent" "$http_x_forwarded_for"';

??? #设定请求缓冲
??? client_header_buffer_size??? 1k;
??? large_client_header_buffers 4 4k;
??? #开启gzip模块
??? gzip on;
??? gzip_min_length 1100;
??? gzip_buffers??? 4 8k;
??? gzip_types????? text/plain;
??? output_buffers 1 32k;
??? postpone_output 1460;
??? #设定access log
??? access_log logs/access.log main;
??? client_header_timeout 3m;
??? client_body_timeout??? 3m;
??? send_timeout????????? 3m;
??? sendfile??????????????? on;
??? tcp_nopush????????????? on;
??? tcp_nodelay??????????? on;
??? keepalive_timeout 65;
???
??? #