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环境搭建的更多相关文章

  1. Ubuntu安装java环境

    Ubuntu安装java环境 1.添加ppa sudo add-apt-repository ppa:webupd8team/java sudo apt-get update 2.安装oracle-j ...

  2. Ubuntu安装Java环境经历

    1.权限不够 sudo su gedit /etc/sudoers 添加 用户名 ALL=(ALL:ALL) ALL 2.配置java 放到 /usr/lib/jvm/下 sudo gedit /et ...

  3. Ubuntu下java环境的搭建

    喜欢捣鼓计算机相关的,然后大二的时候就想着用linux,于是当时就装了个ubuntu,还想着把java环境搭建进去,但当时由于"意志不坚定"后来就没用linux了,知道最近突然想在 ...

  4. 阿里云服务器ubuntu安装java运行环境

    服务器 阿里云服务器ubuntu安装java运行环境 转:http://www.codingyun.com/article/45.html 今天来给大家介绍一下在阿里云ubuntu服务器下安装java ...

  5. Java全栈程序员之02:Ubuntu下Java环境安装、配置、测试

    在上文讲完之后,我们手里的ubuntu只能算是一个上网机,什么也干不了,本篇我们将折腾它为开发机. 这里,我们这里假定你对linux体系是初级选手,所以本篇会讲的啰嗦一点,高手就出门左转吧. 1.安装 ...

  6. Ubuntu Desktop开发生产环境搭建

    Ubuntu Desktop开发生产环境搭建 1   开发生产环境搭建 在本节内容开始前,先定义一下使用场合,没有哪种系统或者设备是万能的,都有它的优点和缺点,能够在具体的使用场景,根据自身的需求来取 ...

  7. Ubuntu中Hadoop环境搭建

    Ubuntu中Hadoop环境搭建 JDK安装 方法一:通过命令行直接安装(不建议) 有两种java可以安装oracle-java8-installer以及openjdk (1)安装oracle-ja ...

  8. 【Java学习系列】第1课--Java环境搭建和demo运行

    本文地址 分享提纲: 1. java环境的搭建 2. java demo代码运行 3.参考文档 本人是PHP开发者,一直感觉Java才是程序的王道(应用广,科班出身),所以终于下决心跟一跟. 主要是给 ...

  9. 第一章 andriod studio 安装与环境搭建

    原文 http://blog.csdn.net/zhanghefu/article/details/9286123 第一章   andriod studio 安装与环境搭建 一.Android Stu ...

随机推荐

  1. Codeforces 617E XOR and Favorite Number(莫队算法)

    题目大概说给一个序列,多次询问区间异或和为k的连续子序列有多少个. 莫队算法,利用异或的性质,通过前缀和求区间和,先处理出序列各个前缀和,然后每次区间转移时维护i以及i-1前缀和为某数的个数并增加或减 ...

  2. WPF中ComboBox用法

    The ComboBox control is in many ways like the ListBox control, but takes up a lot less space, becaus ...

  3. CF# Educational Codeforces Round 3 A. USB Flash Drives

    A. USB Flash Drives time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. Visual Studio: 暂时?绕过 fatal error C1083: Cannot open precompiled header file

    可以使用右键点击项目工程中的该cpp文件,选择setting,在c/c++栏,选择PreCompiled headers,然后设置第一选项,选择不使用预编译头.

  5. 20145308刘昊阳 《Java程序设计》第8周学习总结

    20145308刘昊阳 <Java程序设计>第8周学习总结 教材学习内容总结 第15章 通用API 15.1 日志 15.1.1 日志API简介 java.util.loggging包提供 ...

  6. Java 日期格式化工具类

    import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; impor ...

  7. ACM Longest Repeated Sequence

    Description You are given a sequence of integers, A = a1, a2, ... an. A consecutive subsequence of A ...

  8. Linux之线程管理

    linux下查看线程数的几种方法   1. cat /proc/${pid}/status [root@limt01 2325]# ps -ef|grep xinetd|grep -v grep ro ...

  9. gui学习

    GUI 图形用户界面(Graphical User Interface,简称 GUI,又称图形用户接口)是指采用图形方式显示的计算机操作用户界面 有名的实现 : ucgui   . 实现围绕几个问题: ...

  10. Sumsets

    题目连接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=91209#problem/A 题意:给定一个整数几何S,找出一个最大的d,使得a ...