supremest.35 개발 블로그

[Naver Cloud Platform] 서버 구축 본문

Study/Server

[Naver Cloud Platform] 서버 구축

supremest.35 2021. 4. 6. 18:28

FileZiller 설치

 

sftp://서버 접속용 공인 IP 를 통해 접속한 뒤에

 

usr폴더에 app 폴더를 만들어서

JDK 11, Oracle Database 11g Release, Apach Tomcat 9, maven 파일 옮김.

 


1. 구축에 필요한 도구 설치

  • 명령어 yum install -y gcc-c++ httpd-devel java1.8.0-openjdk-devel.x86_64 wget libtool make

2. 압축풀기

  • 위에서 옮긴 파일들이 있는 디렉토리로 이동
  • tar zxvf jdk-11.0.10_linux-x64_bin.tar.gz 명령어로 압축풀기
  • mkdir /usr/java 명령어로 폴더 만들고 mv (압축 푼 폴더이름)/ /usr/java/jdk11 명령어로 압축 푼 파일 이동시키기 

3. 환경변수 등록

  • vi /etc/profile 로 편집기 열기

       export JAVA_HOME=/usr/java/jdk11        

       export PATH=$PATH:$JAVA_HOME/bin

       export CLASSPATH=.:$JAVA_HOME/lib/tools.jar

  • 위 코드를 맨 아래 추가

  • source /etc/profile 명령어로 환경변수 적용, java -version으로 설치확인

swap용량 2GB이상으로 늘리기

  • mkdir /swap
  • dd if=/dev/zero of=/swap/swapfile bs=1024 count=2097152
  • cd /swap
  • mkswap swapfile
  • swapon swapfile

free 명령어로 늘린 용량 확인

 

재부팅시 적용되게끔 하기

  • vi /etc/fstab 파일 아래와 같이 수정하기

 


Oracle Database 11g 설치하기

 

  1. unzip 명령어로 압축풀기 ( 압축 풀리지 않는다면 yum install -y unzip 명령어로 unzip 설치 후 시도한다)
  2. 압축 풀면 Disk1 디렉토리가 생성되는데 해당 디렉토리로 이동해서
    rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm 명령어로 설치한다.
  3. 설치가 완료되면
    ln -s /u01/app/oracle/product/11.2.0/xe/bin/sqlplus /usr/bin/plus 명령어로 sqlplus 명령만으로 DB가 실행될 수 있게 한다.
  4. vi ~/.bash_profile 명령어로 .bash_profile을 수정한다.

` 기호 조심하기

 

   5. source ~/.bash_profile 명령어로 환경변수 등록

   6. 오라클 DB를 설치하면 기본적으로 oracle 계정이 생성됨
       id oracle 명령어로 계정이 생성됐는지 확인하기

   7. 오라클 계정 .bash_profile 수정하기

      vi ~oracle/.bash_profile

 

   8. env | grep -i oracle 명령어로 환경변수 설정되었는지 확인하기

   9. /etc/init.d/oracle-xe configure 명령어로 DB포트와 시스템 계정의 비밀번호 설정하기

   10. vi /u01/app/oracle/product/11.2.0/xe/config/log 로 변경된 값 확인

   11. oracle 계정으로 sqlplus의 시스템 계정에 접속

       >> su - oracle

       >> sqlplus "/as sysdba"

   

   12. DB 동작확인 후 shutdown 명령으로 중지시키기

        >> select status from v$instance;

        >> shutdown immediate

        >> quit

 

   13. createdb.sh를 실행시켜 oracle DB에 기본적으로 필요한 DB, 테이블, 데이터를 기록하게 한다.

       >>  /u01/app/oracle/product/11.2.0/xe/bin/createdb.sh

   14. DB로 접근하기 위한 계정생성과 권한(DB연결, 자원관리) 설정

        >> sqlplus "/as sysdba"

        >> select status from $instance;

        >> create user (아이디) identified by (비밀번호);

        >> grant connect, resource to (아이디);

        >> quit

 

   15. 위에서 만든 계정으로 로그인하기

        >> sqlplus (아이디)/(비밀번호)

 


톰캣설치 및 실행

 

1. tar zxvf apache-tomcat-9.0.43.tar.gz 명령어로 압축풀기

2. conf 폴더의 sever.xml 에서 69번째 라인 port 8080을 80으로 바꾸고 저장

3. bin 폴더의 startup.bat 실행