linux下搭建java环境

简介:

linux下安装jdk

1、 下载jdk-6u21-linux-i586-rpm.bin

2、 上传到linux

3、 sh jdk-6u21-linux-i586-rpm.bin 直到安装完成

4、 默认安装在/usr/java目录下

5、 vi /etc/profile

添加下面的内容:

export JAVA_HOME=/usr/java/jdk1.6.0_21 
export JAVA_BIN=/usr/java/jdk1.6.0_21/bin 
export PATH=$PATH:$JAVA_HOME/bin 
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
export JAVA_HOME JAVA_BIN PATH CLASSPATH

6、 进入 /usr/bin/目录 

cd /usr/bin 
ln -s -f /usr/java/jdk1.6.0_21/jre/bin/java 
ln -s -f /usr/java/jdk1.6.0_21/bin/javac

7、 在命令行输入 

java –version

输出

over,安装成功

linux下安装resin

1、 tar

2、 ./configure prefix=/usr/local/resin

3、 Make && make install

4、 配置resin为系统服务

V/etc/rc.d/rc.local

===加入如下代码=====

sh /usr/local/resin/bin/resin.sh start

resin admin:

1、访问:http://192.168.1.107/resin-admin/index.php

即可进入admin的页面,首次使用需要注册,同时会在conf目录下生成一个类似admin-users.xml的文件,修改名字去掉后缀

2、vi resin.xml,修改为下图所示

3、从新访问页面,输入刚才注册的username and password即可进入

linux下安装nginx

1、 先安装pcre

Tar

./configure

Make && make install

2、 安装nginx

Tar

./configure --prefix=/usr/local/nginx

Make && make install

V/etc/rc.d/init.d/nginx

======粘贴如下代码,配置为自启动服务====

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# this script create it by gcec at 2009.10.22.
# it is v.0.0.1 version.
# if you find any errors on this scripts,please contact gcec cyz.
# and send mail to support at gcec dot cc.
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf

nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid

RETVAL=0
prog="nginx"

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

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

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $nginxd ] || exit 0


# Start nginx daemons functions.
start() {

if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi

   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL

}


# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}


# reload nginx service functions.
reload() {

    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo

}

# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop
        ;;

reload)
        reload
        ;;

restart)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac

exit $RETVAL

==========结束,退出vi=========

1、 nginx有可执行的权限
chmod +x nginx

6nginx加入到服务当中
chkconfig --add nginx
配置nginx的运行级别,让其可以在系统启动的时候跟着启动
chkconfig --level 35 nginx on

7我们可以通过以下命令来操作nginx
启动:service nginx start
关闭:service nginx stop 
重起:service nginx restart

配置nginx转发请求给resin

修改nginx的配置文件nginx.conf(cd /usr/local/nginx/conf)

 程序代码

server {
        listen       80;
        server_name  localhost;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


        location / {
             access_log on;
             proxy_pass http://127.0.0.1:8080;
             proxy_set_header X-Real-IP $remote_addr;                                                             
             proxy_set_header Host $host;                                                                         
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;                                         
                                                                                                                  
             client_max_body_size    10m;                                                                         
             client_body_buffer_size 128k;                                                                        
        }       
}       










本文转自 小强测试帮 51CTO博客,原文链接:http://blog.51cto.com/xqtesting/923623,如需转载请自行联系原作者
目录
相关文章
|
5月前
|
Java Linux Windows
java 图片上绘制文字Graphics2D linux 中文乱码
java 图片上绘制文字Graphics2D linux 中文乱码
106 0
|
5月前
|
Java 关系型数据库 Linux
Linux|Java|jar包的解压和重新打包(更新配置)
Linux|Java|jar包的解压和重新打包(更新配置)
82 0
|
3月前
|
Java 关系型数据库 应用服务中间件
阿里云RDS购买Linux完整过程——安装java环境并跑起来tomcat
阿里云RDS购买Linux完整过程——安装java环境并跑起来tomcat
50 0
|
6月前
|
Java Linux
java环境配置 linux
java环境配置 linux
44 0
|
5月前
|
Kubernetes Java Linux
Linux|操作系统|Error: Could not create the Java Virtual Machine 报错的解决思路
Linux|操作系统|Error: Could not create the Java Virtual Machine 报错的解决思路
541 0
|
3月前
|
Java Linux
手把手教你Linux系统下的Java环境配置,简单到不行!
手把手教你Linux系统下的Java环境配置,简单到不行!
93 1
|
4月前
|
Linux Windows
FinalShell连接Linux虚拟机报错java.net.ConnectException: Connection timed out: connect(亲测有效)
FinalShell连接Linux虚拟机报错java.net.ConnectException: Connection timed out: connect(亲测有效)
196 0
|
1月前
|
监控 Java Linux
linux下监控java进程 实现自动重启服务
linux下监控java进程 实现自动重启服务
|
2月前
|
网络协议 Java Linux
Java 开发常用的 Linux 命令知识积累
Java 开发常用的 Linux 命令知识积累
41 0
|
4月前
|
Java Unix Linux
Java大神常用Linux命令整理二
Java大神常用Linux命令整理二
16 0