기술노트

기술노트

게시물 상세
[Linux] ubuntu 16.04에 java 1.8, tomcat8, apache2.4, mysql 5.7 설치
작성자 : 관리자(jieun@ehostidc.co.kr)  작성일 : 2018-07-19   조회수 : 4308

OS : ubuntu 16.04

서비스 : java 1.8, tomcat8, apache2.4, mysql 5.7 설치 

 

해당 설치는 apt-get 으로 진행되며, 

java 설치 정보를 openjdk-java 와 oracle-java 2가지로 나눠서 정리.

 

0. 서버 설치 완료 후 root 계정으로 테스트 진행되며, 서버 업데이트 완료 후 진행 

root@ubuntu:~# apt-get upgrade 

 

1. JAVA 설치1.1. openjdk java 설치 

 a. 자바 해석기 설치

 root@ubuntu:~# apt-get install openjdk-8-jre-headless 

 b. 자바 컴파일러 설치

 root@ubuntu:~# apt-get install openjdk-8-jdk 

 c. java 버전 확인

 root@ubuntu:~# java -version 

 openjdk version "1.8.0_171"

 openJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11) 

 openJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

 

1.2 oracle java 설치

 a. 의존성 설치 

 root@ubuntu:~# apt-get install software-properties-common

 b. apt 저장소 추가 

 root@ubuntu:~# add-apt-repository ppa:webupd8team/java

 

 d. oracle-java8 설치

 root@ubuntu:~#  apt-get install oracle-java8-installer

 Reading package lists... Done

 Building dependency tree     

 Reading state information... Done

 Package oracle-java8-installer is not available, but is referred to by another package.

 This may mean that the package is missing, has been obsoleted, or

 is only available from another source

 E: Package 'oracle-java8-installer' has no installation candidate

 root@ubuntu:~# apt-get install software-properties-common

 Reading package lists... Done

 Building dependency tree     

 Reading state information... Done

 software-properties-common is already the newest version (0.96.20.7).

 The following packages were automatically installed and are no longer required:

 linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic

 Use 'apt autoremove' to remove them.

 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

 root@ubuntu:~# add-apt-repository ppa:webupd8team/java

 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK8). There are no actual Java files in this PPA.

 Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

 The PPA supports Ubuntu 18.04, 17.10, 16.04, 14.04 and 12.04.

 More info (and Ubuntu installation instructions):

 - for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

 Debian installation instructions:

 - Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

 For Oracle Java 10, see a different PPA: https://www.linuxuprising.com/2018/04/install-oracle-java-10-in-ubuntu-or.html

 More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java

 Press [ENTER] to continue or ctrl-c to cancel adding it

  gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com

 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   

 

 

 e. java 버전 확인             

 root@ubuntu:~# java -version           

 java version "1.8.0_171"

 java(TM) SE Runtime Environment (build 1.8.0_171-b11) 

 java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

 

2. tomcat 8 설치

 a. tomcat 8 설치  

 root@ubuntu:~# apt-get install tomcat8

 b. tomcat 버전 확인 

 root@ubuntu:~# apt-get install tomcat8

 root@ubuntu:~# /usr/share/tomcat8/bin/version.sh 

 Using CATALINA_BASE:   /usr/share/tomcat8

 Using CATALINA_HOME:   /usr/share/tomcat8 

 Using CATALINA_TMPDIR: /usr/share/tomcat8/temp

 Using JRE_HOME:        /usr 

 Using CLASSPATH:       /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar

 Server version: Apache Tomcat/8.0.32 (Ubuntu) 

 Server built:   May 28 2018 17:21:29 UTC

 Server number:  8.0.32.0 

 OS Name:        Linux

 OS Version:     4.4.0-128-generic 

 Architecture:   amd64

 JVM Version:    1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 

 JVM Vendor:     Oracle Corporation

 

 c. 추가 examples, docs, admin 필요시  

 root@ubuntu:~# apt-get install tomcat8-admin tomcat8-examples tomcat8-docs

 

3. apache 설치

 a. 패키지 설치 

 root@ubuntu:~# apt-get install apache2

 b. 버전 확인

 root@ubuntu:~# apache2 -v

 Server version: Apache/2.4.18 (Ubuntu)

 Server built:   2018-04-18T14:53:04

 

4.  mysql 5.7 설치

 a. 패키지 설치 

 root@ubuntu:~# apt-get install mysql-server 

 b. 버전 확인  

 root@ubuntu:~# mysqladmin --version mysqladmin  Ver 8.42 Distrib 5.7.22, for Linux on x86_64

 

5. apache-tomcat 연동  설치 (mod-jk)

 a.mod-jk 설치 

 root@ubuntu:~# apt-get install libapache2-mod-jk

 Reading package lists... Done 

 Building dependency tree     

 Reading state information... Done 

 The following packages were automatically installed and are no longer required:

 linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic 

 Use 'apt autoremove' to remove them.

 Suggested packages: 

 libapache-mod-jk-doc

 The following NEW packages will be installed: 

 libapache2-mod-jk

 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. 

 Need to get 159 kB of archives.

 After this operation, 451 kB of additional disk space will be used. 

 Get:1 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libapache2-mod-jk amd64 1:1.2.41-1 [159 kB]

 Fetched 159 kB in 1s (124 kB/s)           

  (Reading database ... 130861 files and directories currently installed.)

 Preparing to unpack .../libapache2-mod-jk_1%3a1.2.41-1_amd64.deb ... 

 Unpacking libapache2-mod-jk (1:1.2.41-1) ...

 Setting up libapache2-mod-jk (1:1.2.41-1) ... 

 apache2_invoke: Enable module jk

 

6. 일괄 설치 

 root@ubuntu:~# apt-get install openjdk-8-jre-headless openjdk-8-jdk tomcat8 apache2 mysql-server libapache2-mod-jk 

 
이전글 [Linux] SSH key login
다음글 [Windows] Nagios Window 서버 client 등록