본문 바로가기

학습/시스템

[WSL] 리눅스에서 웹서비스 준비

1. JDK 설치

명령어 : sudo dnf install java-latest-openjdk

실행 내용 : 
[root@DESKTOP-L46HHOA User]# dnf install java-1.8.0-openjdk
Last metadata expiration check: 0:06:08 ago on Thu 07 Dec 2023 01:36:10 PM KST.
Dependencies resolved.
=======================================================================================
 Package                     Arch   Version                    Repository         Size
=======================================================================================

 

블라 블라

 

1.1. 설치 확인 : alternatives --config java

java-1.8 버전을 사용할 것임.

[root@DESKTOP-L46HHOA opt]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.21.0.9-2.0.1.el9.x86_64/bin/java)
   2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-3.0.1.el9.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 2
[root@DESKTOP-L46HHOA opt]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.21.0.9-2.0.1.el9.x86_64/bin/java)
 + 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-3.0.1.el9.x86_64/jre/bin/java)

 

1.2 환경 변수 설정
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$PATH:$JAVA_HOME/bin

[root@DESKTOP-L46HHOA opt]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
[root@DESKTOP-L46HHOA opt]# export PATH=$PATH:$JAVA_HOME/bin

 

 

2. apache tomcat 

2가지 방법이 있다.

방법1.dnf를 이용하는 방법과

방법2.apache에서 다운로드해서 압축을 해제 하는 방식

 

방법1. dnf install tomcat 을 선택 했다.

2.1. apache tomcat 설치

[root@DESKTOP-L46HHOA User]# dnf install tomcat
Oracle Linux 9 BaseOS Latest (x86_64)                   18 MB/s |  17 MB     00:00
Oracle Linux 9 Application Stream Packages (x86_64)     26 MB/s |  26 MB     00:01
Last metadata expiration check: 0:00:02 ago on Thu 07 Dec 2023 01:36:10 PM KST.
Dependencies resolved.

[root@DESKTOP-L46HHOA bin]# cd /usr/share
[root@DESKTOP-L46HHOA share]#cd bin

[root@DESKTOP-L46HHOA bin]# pwd
/usr/share/tomcat/bin

 

2.2. startup.sh 작성 및 권한부여

[root@DESKTOP-L46HHOA bin]# vi /usr/share/tomcat/bin/startup.sh

/usr/libexec/tomcat/server start
:wq


[root@DESKTOP-L46HHOA bin]#  chmod +x /usr/share/tomcat/bin/startup.sh

 

2.3. startup.sh 실행

/usr/share/tomcat/bin/startup.sh

 

[root@DESKTOP-L46HHOA bin]#  /usr/share/tomcat/bin/startup.sh
Java virtual machine used: /usr/lib/jvm/jre/bin/java
classpath used: /usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:
main class used: org.apache.catalina.startup.Bootstrap
flags used: -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory
options used: -Dcatalina.base=/var/lib/tomcats/DESKTOP-L46HHOA -Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
arguments used: start
07-Dec-2023 14:21:50.548 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name:   Apache Tomcat/9.0.62
07-Dec-2023 14:21:50.549 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jan 8 1970 10:38:38 UTC
07-Dec-2023 14:21:50.549 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.62.0
07-Dec-2023 14:21:50.549 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
07-Dec-2023 14:21:50.550 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            5.10.16.3-microsoft-standard-WSL2
07-Dec-2023 14:21:50.550 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
07-Dec-2023 14:21:50.551 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-3.0.1.el9.x86_64/jre
07-Dec-2023 14:21:50.551 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_392-b08
07-Dec-2023 14:21:50.551 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Red Hat, Inc.
07-Dec-2023 14:21:50.551 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /var/lib/tomcats/DESKTOP-L46HHOA
07-Dec-2023 14:21:50.551 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/share/tomcat

 블라블라..

 

 

 

'학습 > 시스템' 카테고리의 다른 글

journalctl, systemctl, /var/log/messages 차  (0) 2024.05.24
[WSL] 리눅스에서 jar로 서버 실행. fastAPI 실행  (3) 2023.12.07
[윈도우] putty 설정  (1) 2023.12.07
[윈도우] OenSSH 서버 설치  (1) 2023.12.07
[WSL] root 사용  (0) 2023.12.07