分类: LINUX
2011-06-11 11:28:22
1. 安装 jdk
a.去下载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/lib/jvm/java-1.6.0-openjdk-1.6.0.0/
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/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
安装时把系统自带的rpm –e 了,在rpm –ivh server的时候提示错误,后来重新安装了个mysql-libs 5.5 rpm –e 卸的,在装就没问题了
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.去下载最新版(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
用浏览器访问,如果能看到tomcat主界面表示成功
f.编写tomcat服务
#vi /etc/init.d/tomcat
(更改为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.去下载linux版本的源代码包
b.解压下载的包
c.查看系统有无gcc包,如果没有请安装gcc
d.安装pcre组件及其依赖包
e.安装openssl组件及其依赖包
f.安装make组件及其依赖包
开始编译出错,少了个pcre-devel 7.8 装上之后正常
g.编译nginx
#
没有错误提示表示编译成功
h.安装
#make
#make install
i.测试
#/usr/local/nginx/sbin/nginx
用浏览器访问,出现欢迎界面表示成功
还没进行整合,下面的配置还没改。
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;
#设定负载均衡的服务器列表
upstream mysvr {
#weigth参数表示权值,权值越高被分配到的几率越大
server 127.0.0.1:8080 weight=1;
}
server {
listen 80;
server_name localhost;
root
/usr/local/tomcat/webapps/ROOT;
index index.jsp;
#charset utf-8;
#access_log
logs/host.access.log main;
location / {
proxy_pass
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP
$remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size
128k;
proxy_connect_timeout
90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
#error_page
404
/404.html;
}