Ubuntu 安装java环境搭建
1、下载JDK 8
从http://www.oracle.com/technetwork/java/javasebusiness/downloads/选择下载JDK的最新版本 JDK 8。
2、解压文件
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk-8u11-linux-x64.tar.gz /usr/lib/jvm/
$ cd /usr/lib/jvm/
$ sudo tar -zxvf jdk-8u11-linux-x64.tar.gz
$ rm ./jdk-8u11-linux-x64.tar.gz
3、配置
$ sudo gedit /etc/environment
报错:(gedit:7473): Gtk-WARNING **: cannot open display:
运行xhost +
xhost: unable to open display ""
总之用网上各种方法均不见效,最后用vim /etc/environmen
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_11"
CLASSPATH=".:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar"
然后就是要告诉系统,我们使用的sun的JDK,而非OpenJDK了:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_11/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_11/bin/javac 300
4. 测试一下运行 java -version
root@iZ23htt4xm4Z:/etc# java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
java安装完成下一步
下载安装最新版本的Tomcat
从tomcat的官方下载页面
http://tomcat.apache.org/download-70.cgi
下载Binary->Core分类中的zip或者tar.gz包后,本地解压缩并将新生成的目录重命名为tomcat,以方便使用。将这个文件夹移动至某路径PATH/。 参考以上设置环境变量和端口设置等步骤,大功告成! 直接运行
PATH/tomcat/bin/./startup.sh
Tomcat 便即刻在后台服务了。 (请将PATH替换成适合您的路径)
下载maven
设置环境变量
M2_HOME=/home/weibo/apache-maven-3.0.5
M2=$M2_HOME/bin
PATH=$M2:$PATH
保存
source /etc/environmen
测试
mvn -version
root@iZ23htt4xm4Z:/usr/lib/jvm# mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T21:51:42+08:00)
Maven home: /usr/lib/jvm/maven
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-30-generic", arch: "amd64", family: "unix"
maven安装完成
apache安装
官网下载httpd-2.4.10.tar.gz
$ gzip -d httpd-2.4.10.tar.gz
$ tar xvf httpd-2.4.10.tar.gz
$ cd httpd-2.4.10.tar.gz
./configure --prefix=/usr/lib/jvm/apache
root@iZ23htt4xm4Z:/usr/lib/jvm/httpd-2.4.10# ./configure --prefix=/usr/lib/jvm/apache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
用Apache搭www服务时“APR not found”(APR-Util not found)的解决办法
原来以为很简单的事,操作起来还是会遇到很多问题,这个问题很典型,调出来与大家分享。
#./configure —prefix……检查编辑环境时出现:
checking for APR… no
configure: error: APR not found . Please read the documentation.
可以用./configure –help | grep apr 查看帮助。
—with-included-apr Use bundled copies of APR/APR-Util
—with-apr=PATH prefix for installed APR or the full path to apr-config
—with-apr-util=PATH prefix for installed APU or the full path to
安装APR(Apache Portable Runtime )
[root@localhost 52lamp]# tar -zxvf apr-1.5.1.tar.gz //unzip -o apr-apr-1.5.1.zip
[root@localhost 52lamp]# cd apr-apr-1.5.1
[root@localhost apr-1.5.1]# ./configure
[root@localhost apr-1.5.1]# make
[root@localhost apr-1.5.1]# make install
再次检查编译环境出现
checking for APR-util… no
configure: error: APR-util not found . Please read the documentation.
[root@localhost httpd-httpd-2.4.10]# ./configure –help | grep apr-util
—with-apr-util=PATH prefix for installed APU or the full path to
[root@localhost 52lamp]# tar -zxvf apr-util-1.3.9.tar.gz
[root@localhost 52lamp]# cd apr-util-1.3.9
[root@localhost apr-util-1.3.9]# ./configure —prefix=/usr/local/apr-util —with-apr=/usr/local/apr
[root@localhost apr-util-1.3.9]# make
[root@localhost apr-util-1.3.9]# make install
./configure仍提示APR-util not found,增加—with-apr=/usr/local/apr —with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@localhost httpd-2.4.10]# ./configure –help | grep pcre
—with-pcre=PATH Use external PCRE library
[root@localhost 52lamp]# unzip -o pcre-8.10.zip
[root@localhost 52lamp]# cd pcre-8.10
[root@localhost cd pcre-8.35]# ./configure —prefix=/usr/local/pcre
[root@localhost cd pcre-8.35]# make
[root@localhost cd pcre-8.35]# make install
继续安装Apache/httpd,./configure 时加上参数 —with-apr=/usr/local/apr/ —with-apr-util=/usr/local/apr-util/ —with-pcre=/usr/local/pcre,这个问题就解决了。
注:方法从网上搜到看到的,不是原创
启动apache
root@iZ23htt4xm4Z:/usr/lib/jvm/apache/bin# apachectl -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.171.250.114. Set the 'ServerName' directive globally to suppress this message
vi conf/httpd.conf
加入一句 ServerName localhost:80
Ubuntu 安装java环境搭建的更多相关文章
- Ubuntu安装java环境
Ubuntu安装java环境 1.添加ppa sudo add-apt-repository ppa:webupd8team/java sudo apt-get update 2.安装oracle-j ...
- Ubuntu安装Java环境经历
1.权限不够 sudo su gedit /etc/sudoers 添加 用户名 ALL=(ALL:ALL) ALL 2.配置java 放到 /usr/lib/jvm/下 sudo gedit /et ...
- Ubuntu下java环境的搭建
喜欢捣鼓计算机相关的,然后大二的时候就想着用linux,于是当时就装了个ubuntu,还想着把java环境搭建进去,但当时由于"意志不坚定"后来就没用linux了,知道最近突然想在 ...
- 阿里云服务器ubuntu安装java运行环境
服务器 阿里云服务器ubuntu安装java运行环境 转:http://www.codingyun.com/article/45.html 今天来给大家介绍一下在阿里云ubuntu服务器下安装java ...
- Java全栈程序员之02:Ubuntu下Java环境安装、配置、测试
在上文讲完之后,我们手里的ubuntu只能算是一个上网机,什么也干不了,本篇我们将折腾它为开发机. 这里,我们这里假定你对linux体系是初级选手,所以本篇会讲的啰嗦一点,高手就出门左转吧. 1.安装 ...
- Ubuntu Desktop开发生产环境搭建
Ubuntu Desktop开发生产环境搭建 1 开发生产环境搭建 在本节内容开始前,先定义一下使用场合,没有哪种系统或者设备是万能的,都有它的优点和缺点,能够在具体的使用场景,根据自身的需求来取 ...
- Ubuntu中Hadoop环境搭建
Ubuntu中Hadoop环境搭建 JDK安装 方法一:通过命令行直接安装(不建议) 有两种java可以安装oracle-java8-installer以及openjdk (1)安装oracle-ja ...
- 【Java学习系列】第1课--Java环境搭建和demo运行
本文地址 分享提纲: 1. java环境的搭建 2. java demo代码运行 3.参考文档 本人是PHP开发者,一直感觉Java才是程序的王道(应用广,科班出身),所以终于下决心跟一跟. 主要是给 ...
- 第一章 andriod studio 安装与环境搭建
原文 http://blog.csdn.net/zhanghefu/article/details/9286123 第一章 andriod studio 安装与环境搭建 一.Android Stu ...
随机推荐
- 疯狂java学习笔记之面向对象(六) - 构造器重载、方法重载和方法重写
一.方法重载(Overload): Java允许同一个类中定义多个同名方法,只要形参不一样就可以,如果同一个类中包含了两个或两个以上方法名相同的方法,但形参列表不同,则被成为方法重载(两同一异). 同 ...
- FString的相关文档,另外还有4种LOG的方法
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FString/index ...
- memcached启动脚本以及telnet测试
memcached -m 1024 -u root -p 11211 -c 1024 -P /var/memcached.pid -d memcached 1.2.2 -p <num> T ...
- poj2386(简单dfs)
就是求图中有多少个水洼.对图进行dfs遍历,并把是水洼的地方全部标记.然后从下一个是水哇的地方再进行dfs. #include <cstdio> #include <iostream ...
- Document 按照xml格式输出
private void GetXMLDocument(Document doc) { OutputFormat format1 = new OutputFormat(" ", t ...
- 关于jsp乱码问题的产生原因 及 解决方法。
http://blog.csdn.net/caoxiaohong/article/details/1781777 JSP/JDBC MySQL乱码问题JSP的request 默认为ISO8859_1, ...
- ACM: Just a Hook 解题报告 -线段树
E - Just a Hook Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u D ...
- [WP8.1UI控件编程]Windows Phone VirtualizingStackPanel、ItemsStackPanel和ItemsWrapGrid虚拟化排列布局控件
11.2.2 VirtualizingStackPanel.ItemsStackPanel和ItemsWrapGrid虚拟化排列布局控件 VirtualizingStackPanel.ItemsSta ...
- win8.1上wamp环境中利用apache自带ab压力测试工具使用超简单讲解
2015.10.4apache自带ab压力测试工具使用:本地环境:win8.1 wampserver2.5 -Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b 可以参考一 ...
- JavaScript进阶篇
组团,并给团取个名(如何创建数组) 使用数组之前首先要创建,而且需要把数组本身赋至一个变量.好比我们出游,要组团,并给团定个名字“云南之旅”. 创建数组语法: var myarray=new Arra ...