Using Java in Debian
Using Java in Debian
要安装个solr的环境调试,需要安装java,我的虚拟机使用的是debian,搜索了好多还是sun时代的写的blog。最后在debian的官网找到如下:
To install the default JRE (Java Runtime Environment) on your system, run:
apt-get install default-jre
To install the default JDK (Java Development Kit) on your system, run:
apt-get install default-jdk
安装完成后
#java -version
java version "1.6.0_31"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1~deb6u1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
升级版本
到官网下载linux版java
解压
tar xvf java-版本.tar.gz
解压出来的文件夹复制到
/usr/lib/jvm/ #(64位/usr/lib64/jvm/)
update-alternatives --install /usr/bin/java java /usr/lib/jvm/你的版本/bin/java 1065
1065表示优先级
检测java安装的配置
update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
- 0 /usr/lib/jvm/jdk1.8.0_25/bin/java 1065 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/jdk1.8.0_25/bin/java 1065 manual mode
java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
将安装源添加上网易的源 http://mirrors.163.com/.help/debian.html
以Squeeze为例, 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份)
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib