1. 자바 설치 여부를 확인합니다.
1 2 3 4 5 6 7 8 9 10 | $ java -version The program 'java' can be found in the following packages: * default-jre * gcj-5-jre-headless * openjdk-8-jre-headless * gcj-4.8-jre-headless * gcj-4.9-jre-headless * openjdk-9-jre-headless Try: sudo apt install <selected package> | cs |
* java -version 혹은 javac -version 으로 확인합니다.
2. 패키지 인덱스를 업데이트합니다.
1 2 3 4 5 6 7 8 9 10 | $ sudo apt-get update Hit:1 http://kr.archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://kr.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 http://kr.archive.ubuntu.com/ubuntu xenial-backports InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Hit:5 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease Hit:6 https://download.docker.com/linux/ubuntu xenial InRelease Fetched 102 kB in 2s (39.2 kB/s) Reading package lists... Done | cs |
3. apt 리포지토리에 개인 패키지 저장소 정보를 추가합니다.
1 2 3 4 5 6 7 8 9 10 11 | $ sudo add-apt-repository -y ppa:webupd8team/java gpg: keyring `/tmp/tmpioqd13si/secring.gpg' created gpg: keyring `/tmp/tmpioqd13si/pubring.gpg' created gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com gpg: /tmp/tmpioqd13si/trustdb.gpg: trustdb created gpg: key EEA14886: public key "Launchpad VLC" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK | cs |
4. 패키지 인덱스 정보를 업데이트합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 | $ sudo apt update Hit:1 http://kr.archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://kr.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:3 https://download.docker.com/linux/ubuntu xenial InRelease Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] Hit:5 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease Hit:6 http://kr.archive.ubuntu.com/ubuntu xenial-backports InRelease Fetched 102 kB in 2s (48.3 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 100 packages can be upgraded. Run 'apt list --upgradable' to see them. | cs |
5. java 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | $ sudo apt install -y oracle-java8-installer Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming Recommended packages: gsfonts-x11 oracle-java8-set-default The following packages will be upgraded: oracle-java8-installer 1 upgraded, 0 newly installed, 0 to remove and 99 not upgraded. 1 not fully installed or removed. Need to get 32.9 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 oracle-java8-installer all 8u151-1~webupd8~0 [32.9 kB] Fetched 32.9 kB in 1s (31.9 kB/s) Preconfiguring packages ... (Reading database ... 215673 files and directories currently installed.) Preparing to unpack .../oracle-java8-installer_8u151-1~webupd8~0_all.deb ... oracle-license-v1-1 license has already been accepted Unpacking oracle-java8-installer (8u151-1~webupd8~0) over (8u144-1~webupd8~0) ... Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ... Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ... Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.59ubuntu1) ... Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ... Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ... Setting up oracle-java8-installer (8u151-1~webupd8~0) ... Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc Downloading Oracle Java 8... --2017-10-24 10:17:08-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e 758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz Resolving download.oracle.com (download.oracle.com)... 121.254.136.10, 121.254.1 36.18 Connecting to download.oracle.com (download.oracle.com)|121.254.136.10|:80... co nnected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e246 06bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz [following] --2017-10-24 10:17:08-- https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12 /e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.74.178.67, 2600:141 7:e:28e::2d3e, 2600:1417:e:28b::2d3e Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.74.178.67|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1508807949_4547063169aa1d1617794b8b2df71b41 [following] --2017-10-24 10:17:09-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1508807949_4547063169aa1d1617794b8b2df71b41 Connecting to download.oracle.com (download.oracle.com)|121.254.136.10|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 189736377 (181M) [application/x-gzip] Saving to: ‘jdk-8u151-linux-x64.tar.gz’ 0K ........ ........ ........ ........ ........ ........ 1% 10.8M 17s 3072K ........ ........ ........ ........ ........ ........ 3% 11.3M 16s 6144K ........ ........ ........ ........ ........ ........ 4% 11.4M 15s 9216K ........ ........ ........ ........ ........ ........ 6% 11.3M 15s 12288K ........ ........ ........ ........ ........ ........ 8% 11.3M 15s 15360K ........ ........ ........ ........ ........ ........ 9% 11.3M 15s 18432K ........ ........ ........ ........ ........ ........ 11% 11.3M 14s 21504K ........ ........ ........ ........ ........ ........ 13% 11.3M 14s 24576K ........ ........ ........ ........ ........ ........ 14% 11.3M 14s 27648K ........ ........ ........ ........ ........ ........ 16% 11.3M 13s 30720K ........ ........ ........ ........ ........ ........ 18% 11.3M 13s 33792K ........ ........ ........ ........ ........ ........ 19% 11.3M 13s 36864K ........ ........ ........ ........ ........ ........ 21% 11.3M 13s 39936K ........ ........ ........ ........ ........ ........ 23% 11.3M 12s 43008K ........ ........ ........ ........ ........ ........ 24% 11.3M 12s 46080K ........ ........ ........ ........ ........ ........ 26% 11.2M 12s 49152K ........ ........ ........ ........ ........ ........ 28% 11.3M 12s 52224K ........ ........ ........ ........ ........ ........ 29% 11.3M 11s 55296K ........ ........ ........ ........ ........ ........ 31% 11.3M 11s 58368K ........ ........ ........ ........ ........ ........ 33% 11.3M 11s 61440K ........ ........ ........ ........ ........ ........ 34% 11.3M 10s 64512K ........ ........ ........ ........ ........ ........ 36% 11.3M 10s 67584K ........ ........ ........ ........ ........ ........ 38% 11.3M 10s 70656K ........ ........ ........ ........ ........ ........ 39% 11.2M 10s 73728K ........ ........ ........ ........ ........ ........ 41% 11.3M 9s 76800K ........ ........ ........ ........ ........ ........ 43% 11.3M 9s..] 79872K ........ ........ ........ ........ ........ ........ 44% 11.3M 9s 82944K ........ ........ ........ ........ ........ ........ 46% 11.3M 9s 86016K ........ ........ ........ ........ ........ ........ 48% 11.3M 8s 89088K ........ ........ ........ ........ ........ ........ 49% 11.3M 8s 92160K ........ ........ ........ ........ ........ ........ 51% 11.3M 8s 95232K ........ ........ ........ ........ ........ ........ 53% 10.5M 8s 98304K ........ ........ ........ ........ ........ ........ 54% 12.2M 7s 101376K ........ ........ ........ ........ ........ ........ 56% 11.1M 7s 104448K ........ ........ ........ ........ ........ ........ 58% 10.9M 7s 107520K ........ ........ ........ ........ ........ ........ 59% 11.3M 6s 110592K ........ ........ ........ ........ ........ ........ 61% 10.4M 6s 113664K ........ ........ ........ ........ ........ ........ 63% 10.5M 6s 116736K ........ ........ ........ ........ ........ ........ 64% 11.0M 6s 119808K ........ ........ ........ ........ ........ ........ 66% 11.3M 5s 122880K ........ ........ ........ ........ ........ ........ 67% 11.3M 5s 125952K ........ ........ ........ ........ ........ ........ 69% 11.3M 5s 129024K ........ ........ ........ ........ ........ ........ 71% 11.3M 5s 132096K ........ ........ ........ ........ ........ ........ 72% 11.3M 4s 135168K ........ ........ ........ ........ ........ ........ 74% 11.4M 4s 138240K ........ ........ ........ ........ ........ ........ 76% 11.3M 4s 141312K ........ ........ ........ ........ ........ ........ 77% 11.3M 4s 144384K ........ ........ ........ ........ ........ ........ 79% 10.6M 3s 147456K ........ ........ ........ ........ ........ ........ 81% 12.1M 3s 150528K ........ ........ ........ ........ ........ ........ 82% 11.3M 3s 153600K ........ ........ ........ ........ ........ ........ 84% 11.3M 2s 156672K ........ ........ ........ ........ ........ ........ 86% 11.3M 2s 159744K ........ ........ ........ ........ ........ ........ 87% 11.3M 2s 162816K ........ ........ ........ ........ ........ ........ 89% 10.5M 2s 165888K ........ ........ ........ ........ ........ ........ 91% 12.0M 1s 168960K ........ ........ ........ ........ ........ ........ 92% 11.3M 1s 172032K ........ ........ ........ ........ ........ ........ 94% 10.8M 1s 175104K ........ ........ ........ ........ ........ ........ 96% 11.3M 1s 178176K ........ ........ ........ ........ ........ ........ 97% 11.3M 0s 181248K ........ ........ ........ ........ ........ ........ 99% 11.3M 0s 184320K ........ ....... 100% 11.4M=16s 2017-10-24 10:17:25 (11.2 MB/s) - ‘jdk-8u151-linux-x64.tar.gz’ saved [189736377/189736377] Download done. Removing outdated cached downloads... update-alternatives: error: no alternatives for java update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/java to provide /usr/bin/java (java) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jar to provide /usr/bin/jar (jar) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javac to provide /usr/bin/javac (javac) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javafxpackager to provide /usr/bin/javafxpackager (javafxpackager) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javah to provide /usr/bin/javah (javah) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javap to provide /usr/bin/javap (javap) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/javapackager to provide /usr/bin/javapackager (javapackager) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jmc to provide /usr/bin/jmc (jmc) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jps to provide /usr/bin/jps (jps) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/jvisualvm to provide /usr/bin/jvisualvm (jvisualvm) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode Oracle JDK 8 installed #####Important######## To set Oracle JDK8 as default, install the "oracle-java8-set-default" package. E.g.: sudo apt install oracle-java8-set-default On Ubuntu systems, oracle-java8-set-default is most probably installed automatically with this package. ###################### | cs |
* -y 옵션은 설치 여부를 묻지 않고 자동으로 y 처리할 경우 사용합니다.
6. 아래 화면은 -y 옵션을 주었을 경우 출력되지 않습니다.
6-1. license 동의서
6-2. license 동의서
* 위와 같이 Yes 를 선택하고 다음으로 넘어갑니다.
7. 설치 후 java 버전 출력 여부 확인
1 2 3 4 5 | $ java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) | cs |
8. java 설치 및 확인 작업이 끝나면 환경 변수를 설정합니다.
8-1. /etc/environment 파일을 편집합니다.
1 2 | $ sudo vi /etc/environment | cs |
8-2. 하단에 아래와 같이 추가 후 저장합니다.
1 2 | JAVA_HOME="/usr/lib/jvm/java-8-oracle" | cs |
8-3. 해당 부분을 반영합니다.
1 2 | $ source /etc/environment | cs |
8-4. /etc/profile 파일을 편집합니다.
1 2 | $ sudo vi /etc/profile | cs |
8-5. 하단에 아래와 같이 추가 후 저장합니다.
1 2 3 4 | export JAVA_HOME=/usr/lib/jvm/java-8-oracle export CLASSPATH=.:$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar PATH=$PATH:$JAVA_HOME/bin | cs |
8-6. 해당 부분을 반영합니다.
1 2 | $ source /etc/profile | cs |
8-7. ~/.bashrc 파일을 편집합니다.
1 2 | $ vi ~/.bashrc | cs |
8-8. 하단에 아래와 같이 추가 후 저장합니다.
1 2 | export PATH=$PATH:$JAVA_HOME/bin | cs |
8-9. 해당 부분을 반영합니다.
1 2 | $ source ~/.bashrc | cs |
'Operating System > Linux' 카테고리의 다른 글
ruby 설치 (0) | 2017.10.31 |
---|---|
ubuntu desktop eclipse 설치 (0) | 2017.10.24 |
ubuntu 패키지 목록 확인 (0) | 2017.10.19 |
ubuntu git 설치 (0) | 2017.10.19 |
ubuntu vim 설치 (0) | 2017.10.19 |