知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

Ubuntu Server 10.04 搭建JSP环境

发布时间:2014-09-05 17:19:21作者:知识屋

 1 安装java
sudo apt-get install sun-java6-jdk sun-java6-fonts sun-java6-plugin
可能会先要求装jre,装就是了
sudo update-java-alternatives -s java-6-sun

2 环境变量
sudo vim /etc/environment
加入 JAVA_HOME=/usr/lib/jvm/java-6-openjdk/


PATH改为如下
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-openjdk/bin/"


3 安装apache
sudo apt-get install apache2
然后 sudo /etc/init.d/apache2 start/stop/restart 可以进行启动之类的
启动后看看浏览器地址栏输入127.0.0.1看结果
其中/etc/init.d/apache2和/usr/sbin/apachectl 作用是相同的, 只是在/etc/init.d会自动执行
而有任何要改动的设定, 加在/etc/apache2/httpd.conf中

4 安装tomcat
sudo apt-get install tomcat6 tomcat6-common tomcat6-docs tomcat6-examples libtomcat6-java
同样/etc/init.d/tomcat6 start/stop/restart 进行启动

5 mod_jk的安
如此一来,apache跟tomcat应该都可以正常运行了,只是两者互不认识,www.linuxidc.com要把他连在一起还要mod_jk.
sudo apt-get install libapache2-mod-jk
/usr/lib/apache2/modules/mod_jk.so就是让负责apache将request交给tomcat处理的module.

然后将/usr/share/doc/libapache2-mod-jk/httpd_example_apache2.con内容直接copy到/etc/apache2/httpd.conf,

6 验证
sudo gedit /etc/apache2/httpd.conf
#gedit 吧,你可以直接粘贴到结尾
Alias /examples "/usr/share/tomcat6-examples/examples"
<Directory "/usr/share/tomcat6-examples/examples">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
#/tomcat6-examples/examples 来自 sudo apt-get install tomcat6 tomcat6-examples
重启apache2后浏览器输入http://localhost/examples查看是否成功。
 
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜