๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ๋ฐœ/์„œ๋ฒ„ ํ™˜๊ฒฝ

[CentOS 7] ์ž๋ฐ” ์„ค์น˜ :: ๋งˆ์ด์ž๋ชฝ

by ๐ŸŒปโ™š 2018. 8. 25.

์„œ๋ฒ„ํ™˜๊ฒฝ ๊ตฌ์ถ•์„ ์‹œ์ž‘ํ•˜๋ฉด์„œ ๊ฐ€์žฅ ๋จผ์ € ์ž๋ฐ”๋ฅผ ์„ค์น˜ํ•  ๊ฒƒ์ด๋‹ค.

CentOS ์„ค์น˜ ํ• ๋•Œ ์ธํ”„๋ผ ์„œ๋ฒ„๋กœ ์„ค์น˜๋ฅผ ํ•ด์„œ ์ด๋ฏธ ์ž๋ฐ” 1.8์ด ์„ค์น˜๋˜์–ด์žˆ์„ ๊ฒƒ์ด๋‹ค.

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ ๊ฐ„ํ˜น ์ด์ „๋ฒ„์ „์˜ ์ž๋ฐ”๋ฅผ ์‚ฌ์šฉ ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค.

ํ˜„์žฌ ์„ค์น˜ ๋˜์–ด์žˆ๋Š” ์ž๋ฐ” ํŒจํ‚ค์ง€๋ฅผ ์‚ญ์ œํ•˜๊ณ  ์ž๋ฐ” 1.7.0_80์œผ๋กœ ์„ค์น˜๋ฅผ ํ•  ์˜ˆ์ •์ด๋‹ค.


๊ธฐ์กด ์ž๋ฐ” ์‚ญ์ œ

1
2
3
4
5
6
7
8
9
10
[jamong@localhost ~]$ sudo yum remove java*
...
...
...
...
 
 
 
[jamong@localhost ~]$ java -version
-bash: /usr/bin/java: ๊ทธ๋Ÿฐ ํŒŒ์ผ์ด๋‚˜ ๋””๋ ‰ํ„ฐ๋ฆฌ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค
cs




๋ณดํ†ต ์ž๋ฐ”๋‚˜ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€๋“ค์„ ์„ค์น˜ํ•  ๋•Œ /usr/local/ ๊ฒฝ๋กœ์— ์„ค์น˜๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์€๋ฐ

์„ค์น˜ํ•œ ํŒจํ‚ค์ง€๋“ค์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์‰ฝ๊ฒŒ jamong๊ณ„์ •์— ํด๋”๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ด€๋ฆฌ๋ฅผ ํ• ๊ฒƒ์ด๋‹ค.

1
[jamong@localhost ~]$ mkdir dev_util
[jamong@localhost ~]$ cd dev_util
cs




์ด์ œ ์˜ค๋ผํด ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•ด์„œ ์ž๋ฐ” ์„ค์น˜ํŒŒ์ผ์„ ๋ฐ›๋Š”๋‹ค.

์•„๋ž˜ ์นดํ…Œ๊ณ ๋ฆฌ๋ฅผ ๋”ฐ๋ผ Java SE ํด๋ฆญ




๋‹ค์šด๋กœ๋“œ ํด๋ฆญ




์ด์ „ ๋ฒ„์ „๋“ค์„ ๋ณด๊ธฐ์œ„ํ•ด ๊ฐ€์žฅ ํ•˜๋‹จ ๋‹ค์šด๋กœ๋“œ ํด๋ฆญ




์ž์‹ ์ด ์›ํ•˜๋Š” ๋ฒ„์ „ ํด๋ฆญ

ํ•„์ž๋Š” 1.7์„ ๋ฐ›๋Š”๋‹ค.




Decline License์—์„œ Accept๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค.

์ƒ์œ„ ๋ฒ„์ „๋“ค์€ ์˜ค๋ผํด ๋กœ๊ทธ์ธ์„ ํ•ด์•ผ ๋‹ค์šด๋กœ๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

wget ๋ช…๋ น์œผ๋กœ ๋งํฌ์ฃผ์†Œ๋ฅผ ๋ฐ›์•„์™€์„œ ์„ค์น˜๊ฐ€ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ, ์˜ค๋ผํด ์‚ฌ์ดํŠธ์˜ ๊ถŒํ•œ ๋ฌธ์ œ๋“ค์ด ์žˆ๊ธฐ์—

ํ•„์ž๋Š” ๊ณ ๋ฏผ์—†์ด ๋งˆ์Œ ํŽธํ•˜๊ฒŒ ftp๋‚˜ scpํ”„๋กœ๊ทธ๋žจ์„ ์‚ฌ์šฉํ•ด์„œ ํŒŒ์ผ์„ ์ „์†กํ• ๊ฑฐ๋‹ค.




ํŒŒ์ผ์ „์†ก์„ ์œ„ํ•ด ํŒŒ์ผ์งˆ๋ผ๋‚˜ Winscp๊ฐ™์€ ํ”„๋กœ๊ทธ๋žจ๋“ค์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

ํ•„์ž๋Š” Cyberduck์ด๋ผ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์‚ฌ์šฉํ•œ๋‹ค.

https://cyberduck.io/




ํŒŒ์ผ ์ด๋™ ์™„๋ฃŒ ํ›„, tar ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด์„œ ํ’€์–ด์ค€๋‹ค.

1
[jamong@localhost dev_util]$ tar xvfz jdk-7u80-linux-x64.tar.gz
cs




์ด์ œ alternatives์— ๋“ฑ๋กํ•ด์ค€๋‹ค.

1
2
3
4
[jamong@localhost jdk1.7.0_80]$ sudo alternatives --install /usr/bin/java java /home/jamong/dev_util/jdk1.7.0_80/bin/java 1
[jamong@localhost jdk1.7.0_80]$ sudo alternatives --install /usr/bin/javac javac /home/jamong/dev_util/jdk1.7.0_80/bin/javac 1
[jamong@localhost jdk1.7.0_80]$ sudo alternatives --install /usr/bin/jar jar /home/jamong/dev_util/jdk1.7.0_80/bin/jar 1
[jamong@localhost jdk1.7.0_80]$ sudo alternatives --install /usr/bin/javaws javaws /home/jamong/dev_util/jdk1.7.0_80/bin/javaws 1

cs




๊ฐ„ํ˜น alternatives๋ฅผ ๋“ฑ๋กํ•ด์ค„๋•Œ java๋ฅผ ๋“ฑ๋กํ•˜๊ณ  javac๋ฅผ ๋“ฑ๋กํ• ๋•Œ

"javac์˜ ์ผ์ฐจ ๋งํฌ๋Š” /usr/bin/java์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค"๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋–จ์–ด์งˆ๋•Œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋Ÿด๋–„๋Š” ๋“ฑ๋กํ•œ java alternatives๋ฅผ ํ•œ๋ฒˆ ์‚ญ์ œํ•˜๊ณ  ๋‹ค์‹œ ์œ„์—์ฒ˜๋ฆ„ ๋“ฑ๋ก์„ ํ•ด๋ณธ๋‹ค.

์•„๋ž˜ ์ฒ˜๋Ÿผ ๋ฆฌ์ŠคํŠธ๋ฅผ ํ™•์ธํ•˜๊ณ  alternatives๋ฅผ ์‚ญ์ œํ•ด์ค€๋‹ค.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[jamong@localhost ~]$ sudo alternatives --list
libnssckbi.so.x86_64    auto    /usr/lib64/pkcs11/p11-kit-trust.so
ld    auto    /usr/bin/ld.bfd
cifs-idmap-plugin    auto    /usr/lib64/cifs-utils/cifs_idmap_sss.so
print    auto    /usr/bin/lpr.cups
mysqlbug    auto    /usr/lib64/mysql/mysqlbug
cups_backend_smb    auto    /usr/bin/smbspool
mta    auto    /usr/sbin/sendmail.postfix
libwbclient.so.0.14-64    auto    /usr/lib64/samba/wbclient/libwbclient.so.0.14
java    auto    /home/jamong/dev_util/jdk1.7.0_80/bin/java
javac    auto    /home/jamong/dev_util/jdk1.7.0_80/bin/javac
jar    auto    /home/jamong/dev_util/jdk1.7.0_80/bin/jar
javaws    auto    /home/jamong/dev_util/jdk1.7.0_80/bin/javaws
 
 
[jamong@localhost ~]$ sudo alternatives --remove java /home/jamong/dev_util/jdk1.7.0_80/bin/java
cs




alternatives๊ฐ€ ๋ฌธ์ œ ์—†์ด ๋“ฑ๋ก์ด ๋ฌ๋‹ค๋ฉด

java์™€ javac ๋ฒ„์ „์„ ํ™•์ธํ•ด์ค€๋‹ค.

1
2
3
4
5
6
7
8
jamong@localhost jdk1.7.0_80]$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[jamong@localhost jdk1.7.0_80]$ javac -version
javac 1.7.0_80
[jamong@localhost jdk1.7.0_80]$
 

cs





์ž๋ฐ”์„ค์น˜๋Š” ๋๋‚ฌ์ง€๋งŒ, ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•ด์ค˜์•ผํ•œ๋‹ค.

์•„ํŒŒ์น˜ ํ†ฐ์บฃ์ด๋‚˜ ๋‹ค๋ฅธ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ๋“ค์„ ์„ค์น˜ํ•˜๋Š”๋ฐ ํ•„์š”ํ•˜๋‹ค.

๊ณ„์ • home์—์„œ .bash_profileํŒŒ์ผ์„ ์—ด์–ด์ค€๋‹ค.

1
[jamong@localhost ~]$ vi .bash_profile
cs



์•„๋ž˜์™€ ๊ฐ™์ด ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๊ณ  PATH์—๋„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€๋ฅผ ํ•ด์ค€๋‹ค.

1
2
3
4
5
6
7
JAVA_HOME=/home/jamong/dev_util/jdk1.7.0_80
JRE_HOME=/home/jamong/dev_util/jdk1.7.0_80/jre
 
PATH=$PATH:$HOME/.local/bin:$HOME/bin:JAVA_HOME/bin:JRE_HOME/bin
 
export JAVA_HOME JRE_HOME
export PATH

cs





์ถ”๊ฐ€ ์™„๋ฃŒ ํ›„ ๋ฐ˜์˜ ๋ฐ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ํ™•์ธํ•ด์ค€๋‹ค.

์•„๋ž˜์™€๊ฐ™์ด ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๊ฒฝ๋กœ๊ฐ€ ์ถœ๋ ฅ๋˜๋ฉด ๋ฐ˜์˜๋œ ๊ฒƒ์ด๋‹ค.

1
2
3
4
5
[jamong@localhost ~]$ source .bash_profile
[jamong@localhost ~]$ echo $JAVA_HOME
/home/jamong/dev_util/jdk1.7.0_80
[jamong@localhost ~]$ echo $JRE_HOME
/home/jamong/dev_util/jdk1.7.0_80/jre
cs











๋Œ“๊ธ€