728x90
๋ฐ˜์‘ํ˜•
  1. ec2 ๋ฐœ๊ธ‰
  2. ufw ์„ค์ • ๋ฐ port ๊ตฌ์„ฑ๋„
  3. swap ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
  4. docker ์„ค์น˜ (+ Ubuntu ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ…)
  5. docker-compose & jenkins ์„ค์น˜
  6. jenkins gitlab ์—ฐ๋™(project-build) ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜
  7. Nginx
  8. https ์ ์šฉ
  9. Jenkins Pipeline ์ž‘์„ฑ
  10. S3 ์„ค์น˜ ๋ฐ ์„ค์ •
  11. RDS ์„ค์น˜ ๋ฐ ์„ค์ •

 

https ์ ์šฉ

 

Certbot ????

: Let's encrypt๋ฅผ ์ด์šฉํ•ด์„œ ssl ์ธ์ฆ์„œ๋ฅผ ๋ฐœ๊ธ‰, ๊ฐฑ์‹ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” ๋ฌด๋ฃŒ ์˜คํ”ˆ์†Œ์Šค ํˆด
- Certbot์„ ๋”ฐ๋กœ ์„ค์น˜ํ•ด๋„ ๋˜๊ณ , letsencrypt๋ฅผ ์„ค์น˜ํ•ด๋„ ๋จ(certbot์ด ํฌํ•จ๋˜์–ด์žˆ์Œ)

 

 

์ธ์ฆ์„œ ๋ฐœ๊ธ‰(Let's Ecrypt)

 

- Let's Ecrypt๋Š” ์ด๋ฉ”์ผ๊ณผ ๋„๋ฉ”์ธ๋งŒ์œผ๋กœ, ๋น ๋ฅด๊ฒŒ ์ธ์ฆ์„œ๋ฅผ ๋ฐœ๊ธ‰ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌด๋ฃŒ ์„œ๋น„์Šค

- Certbot์„ ํ†ตํ•ด์„œ ๋ฐ›์„ ์ˆ˜ ์žˆ์Œ

 

 

certbot ์„ค์น˜

sudo snap install certbot-nginx
sudo apt-get update
sudo apt-get install python3-certbot-nginx

 

SSL(Secure Sockets Layer) ????

: Netscape Communications Corporation ์—์„œ ์›น ์„œ๋ฒ„์™€ ์›น ๋ธŒ๋ผ์šฐ์ €๊ฐ„์˜ ๋ณด์•ˆ์„ ์œ„ํ•ด ๋งŒ๋“  ํ”„๋กœํ† ์ฝœ
๊ณต๊ฐœํ‚ค / ๊ฐœ์ธํ‚ค ๋Œ€์นญํ‚ค ๊ธฐ๋ฐ˜์œผ๋กœ ์‚ฌ์šฉํ•จ

๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์‚ฌ์ดํŠธ 
=> Let's Encrypt / AWS Certificate Manager

 

 

Nginx์— SSL ์ ์šฉํ•˜๊ธฐ

sudo certbot --nginx -d {๋„๋ฉ”์ธ}

ex)
sudo certbot --nginx -d sokdaksokdak.com

 

- ์œ„์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ธ์ฆ์„œ๋ฅผ ๋ฐœ๊ธ‰ํ•˜๋ฉด์„œ nginx์— ์ธ์ฆ์„œ ๊ด€๋ จ ์„ค์ •์„ ์ž๋™์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋‹ค

- ์ž‘์„ฑํ•˜๋ฉด Successfullu received certificate๋ผ๋Š” ์•ˆ์• ์™€ ํ•จ๊ป˜ ์ธ์ฆ์„œ ์ •๋ณด๋ฅผ ์ถœ๋ ฅ

 

/etc/nginx/sites-availble ๊ฒฝ๋กœ๋กœ ๊ฐ€๋ฉด default๋ผ๋Š” ํŒŒ์ผ์ด ์žˆ๋Š”๋ฐ ์ด ๊ณต๊ฐ„์— default ํŒŒ์ผ์€ ์‚ญ์ œํ•˜๊ณ  project.conf๋ผ๋Š” ์ด๋ฆ„์„ ๊ฐ€์ง„ ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค(์ด๋ฆ„์€ ์ƒ๊ด€ ์—†์ง€๋งŒ ์œ„์น˜๋Š” ์ € ์œ„์น˜์—ฌ์•ผ ํ•จ)

 

server {
    listen 80;
    server_name k10d101.p.ssafy.io;

    # HTTP ์š”์ฒญ์„ HTTPS๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ
    location / {
        return 301 https://$host$request_uri;
    }
}
server {
    listen 443 ssl; // 443 ํฌํŠธ์˜ ์š”์ฒญ์„ ๋ฐ›์Œ
    server_name k10d101.p.ssafy.io; // ๋„๋ฉ”์ธใ€€์ง€์ •

    include /etc/nginx/conf.d/service_url.inc;

    ssl_certificate /etc/letsencrypt/live/k10d101.p.ssafy.io/fullchain.pem; # SSL ์ธ์ฆ์„œ
    ssl_certificate_key /etc/letsencrypt/live/k10d101.p.ssafy.io/privkey.pem; # SSL ํ‚ค
    include /etc/letsencrypt/options-ssl-nginx.conf; # SSL ์˜ต์…˜
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # DH ํŒŒ๋ผ๋ฏธํ„ฐ
    
     # Frontend: ์ •์  ํŒŒ์ผ ์„œ๋น™ ๋ฐ SPA ๋ผ์šฐํŒ… ์ง€์›
    location / {
        proxy_pass http://localhost:3000; # Docker ์„œ๋น„์Šค ์ด๋ฆ„ ์‚ฌ์šฉ
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    
     # Backend: API ์š”์ฒญ
    location /api/ {
        proxy_pass $service_url; # Docker ์„œ๋น„์Šค ์ด๋ฆ„๊ณผ ํฌํŠธ ์‚ฌ์šฉ
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection "close"; # API ์š”์ฒญ์—๋Š” 'Connection: upgrade' ๋ถˆํ•„์š”
    }
}

 

$ sudo service nginx restart

 

๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด nginx๋ฅผ ์žฌ์‹œ์ž‘ํ•˜๋ฉด...

 

 

 

์ฐธ๊ณ 

 

https://www.youtube.com/watch?v=wPdH7lJ8jf0&t=508s&ab_channel=%EC%9A%B0%EC%95%84%ED%95%9C%ED%85%8C%ED%81%AC

 

https://velog.io/@byeongju/HTTPS-%EC%A0%81%EC%9A%A9%EA%B8%B0

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•
  1. ec2 ๋ฐœ๊ธ‰
  2. ufw ์„ค์ • ๋ฐ port ๊ตฌ์„ฑ๋„
  3. swap ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
  4. docker ์„ค์น˜ (+ Ubuntu ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ…)
  5. docker-compose & jenkins ์„ค์น˜
  6. jenkins gitlab ์—ฐ๋™(project-build) ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜
  7. Nginx
  8. https ์ ์šฉ
  9. Jenkins Pipeline ์ž‘์„ฑ
  10. S3 ์„ค์น˜ ๋ฐ ์„ค์ •
  11. RDS ์„ค์น˜ ๋ฐ ์„ค์ •

 

jenkins gitlab ์—ฐ๋™(project-build) ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜

 

Backend Dockerfile(๋ฐฑ์—”๋“œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ปจํ…Œ์ด๋„ˆํ™”ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ)

FROM openjdk:17-jdk-alpine
VOLUME /tmp 
ADD ./build/libs/backend-0.0.1-SNAPSHOT.jar app.jar
ENV JAVA_OPTS=""
ENTRYPOINT ["java", "-jar", "/app.jar"]

 

  1. FROM openjdk:17-jdk-alpine
    : openjdk:17-jdk-alpine ์ด๋ฏธ์ง€๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ƒˆ docker ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑ
    - openjdk:17-jdk-alpine ๋Š” OpenJDK 17์„ ํฌํ•จ + ๋ฆฌ๋ˆ…์Šค ๋ฐฐํฌํŒ ์ค‘ ํ•˜๋‚˜์ธ Alpine Linux ๊ธฐ๋ฐ˜์˜ ์ด๋ฏธ์ง€
    - Alpine Linux๋Š” ๊ฒฝ๋Ÿ‰ํ™”๊ฐ€ ์ž˜ ๋˜์–ด ์žˆ์–ด ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋ฅผ ์ž‘๊ฒŒ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค
  2. VOLUME /tmp
    : /tmp ๊ฒฝ๋กœ์— ๋ณผ๋ฅจ์„ ๋งˆ์šดํŠธ ํ•จ
    - ์ผ๋ฐ˜์ ์œผ๋กœ Spring Boot ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ๋Š” /tmp๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž„์‹œ ํŒŒ์ผ ๋“ฑ์„ ์ €์žฅํ•˜๋Š”๋ฐ ์‚ฌ์šฉ
  3. ADD ./build/libs/backend-0.0.1-SNAPSHOT.jar app.jar
    : ๋กœ์ปฌ ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ backend-0.0.1-SNAPSHOT.jar ํŒŒ์ผ์„ ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ์— app.jar๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋ณต์‚ฌ
    -  ADD๋Š” COPY์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ ์›๊ฒฉ URL์—์„œ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ฑฐ๋‚˜ ๋กœ์ปฌ ํŒŒ์ผ์„ ์ž๋™์œผ๋กœ ์••์ถ• ํ•ด์ œํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€๋กœ ์ œ๊ณต
  4. ENV JAVA_OPTS=""
    : ํ™˜๊ฒฝ ๋ณ€์ˆ˜  JAVA_OPTS๋ฅผ ์„ค์ •

    - ๊ธฐ๋ณธ์ ์œผ๋กœ ๋นˆ ๋ฌธ์ž์—ด๋กœ ์„ค์ •๋˜์–ด ์žˆ์Œ
  5. ENTRYPOINT ["java", "-jar", "/app.jar"]
    : ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์‹œ์ž‘๋  ๋•Œ ์‹คํ–‰๋˜๋Š” ๋ช…๋ น์–ด๋ฅผ ์ง€์ •
    - java ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋ช…๋ น์–ด
    - -jar ์˜ต์…˜ ๋‹ค์Œ์— ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ JAR ํŒŒ์ผ์˜ ๊ฒฝ๋กœ์ธ /app.jar๋ฅผ ์ง€์ •ํ•จ

 

 

Frontend Dockerfile

FROM node:20.12.0

WORKDIR /app

COPY package.json /app

RUN npm install
COPY . /app

EXPOSE 3000
RUN npm run docs-build

CMD ["npm","run", "docs"]

 

 

  1. 'FROM node:20.12.0'.
    : 'node:20.12.0' ์ด๋ฏธ์ง€๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ƒˆ Docker ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑ
  2. WORKDIR /app
    : 'WORKDIR' ๋ช…๋ น์–ด๋Š” Docker ์ด๋ฏธ์ง€ ๋‚ด์—์„œ ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ '/app' ์œผ๋กœ ์„ค์ •
     ์ดํ›„์˜ ๋ช…๋ น์–ด๋“ค์€ ์ด ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์‹คํ–‰
  3. COPY package.json /app
    : ํ˜ธ์ŠคํŠธ ๊ธฐ๊ธฐ์˜ 'package.json' ํŒŒ์ผ์„ ์ด๋ฏธ์ง€ ๋‚ด์˜ '/app' ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋ณต์‚ฌ
  4. RUN npm install
    : npm install ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ package.json์— ์ •์˜๋œ Node.js ํ”„๋กœ์ ํŠธ์˜ ์˜์กด์„ฑ์„ ์„ค์น˜
  5. COPY . /app
    : ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ์˜ ๋ชจ๋“  ํŒŒ์ผ๊ณผ ์„œ๋ธŒ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ด๋ฏธ์ง€ ๋‚ด์˜ '/app' ๋””๋ ‰ํ† ๋ฆฌ์— ๋ณต์‚ฌ
  6. EXPOSE 3000
    : ์นธํ…Œ์ธ์ €๊ฐ€ ๋ฆฌ์Šค๋‹ํ•  ํฌํŠธ ๋ฒˆํ˜ธ 3000์„ Docker์— ์•Œ๋ฆผ. ์ด ํฌํŠธ๋ฅผ ํ†ตํ•ด ์™ธ๋ถ€์™€ ํ†ต์‹ ํ•  ์ˆ˜ ์žˆ๋‹ค
  7. RUN npm run docs-build
    : npm run docs-build ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๋ฌธ์„œ๋ฅผ ๋นŒ๋“œํ•˜๋Š” ์ž‘์—…์„ ์ˆ˜ํ–‰
  8. CMD ["npm","run", "docs"]
    : ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์‹คํ–‰๋  ๋–„ 'npm run docs' ๋ช…๋ น์„ ์‹คํ–‰(์ผ๋ฐ˜์ ์œผ๋กœ ๋ฌธ์„œ๋ฅผ ํ˜ธ์ŠคํŒ…ํ•˜๊ฑฐ๋‚˜ ์ƒ์„ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ)

 

Ngnix

Ngnix ????

: ๊ฒฝ๋Ÿ‰ ์›น์„œ๋ฒ„๋กœ ์ •์ ํŒŒ์ผ์„ serving ํ•˜๋Š” web server ๋˜๋Š” ์š”์ฒญ์„ ๋‹ค๋ฅธ ์„œ๋ฒ„๋กœ ์ „๋‹ฌํ•˜๋Š” reverse proxy server๋กœ ํ™œ์šฉ๋˜์–ด was์˜ ๋ถ€ํ•˜๋ฅผ ์ค„์ด๋Š” ๋กœ๋“œ ๋ฐธ๋Ÿฐ์„œ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค


=> ์›น  ์„œ๋ฒ„์ค‘ apache์™€์˜ ํŒŒ์ด์  : ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹
apache ์›น ์„œ๋ฒ„์˜ ๊ฒฝ์šฐ ์š”์ฒญ๋งˆ๋‹ค ์ƒˆ๋กœ์šด ์“ฐ๋ ˆ๋“œ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ์š”์ฒญ์„ ์ฒ˜๋ฆฌ๋˜๋ฏ€๋กœ ์š”์ฒญ์ด ๋งŽ์œผ๋ฉด ๋งŽ์„์ˆ˜๋ก ์ž์›์ด ๋งŽ์ด ์†Œ๋ชจ๋œ๋‹ค
๋ฐ˜๋ฉด์— nginx๋Š” event-driven ๊ตฌ์กฐ๋กœ ๋™์ž‘ํ•˜๋Š”๋ฐ, ์ด ๋•Œ๋ฌธ์— ํ•˜๋‚˜ ๋˜๋Š” ๊ณ ์ •๋œ ๊ฐœ์ˆ˜์˜ ํ”„๋กœ์„ธ์Šค๋งŒ ์ƒ์„ฑ๋˜๊ณ  ์š”์ฒญ๋“ค์€ ๋™์‹œ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋œ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ๋ณด๋‹ค ์ ์€ ์ž์›์œผ๋กœ๋„ ํšจ์œจ์ ์ธ ์šด์šฉ์ด ๊ฐ€๋Šฅ

 

 

sudo apt update 
sudo apt-get install nginx

 

- sudo apy update : ์‹œ์Šคํ…œ์˜ ํŒจํ‚ค์ง€ ๋ชฉ๋ก ์—…๋ฐ์ดํŠธ

- sudo apt-get install nginx :  nginx ์›น ์„œ๋ฒ„๋ฅผ ์„ค์น˜

 

 

nginx ์›น ์„œ๋ฒ„์—์„œ ์ƒˆ๋กœ์šด ์‚ฌ์ดํŠธ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•

sudo nano /etc/nginx/sites-available/๋‚ด๊ฐ€ ๋งŒ๋“ค ๊ฒƒ
vi์ฝ”๋“œ๋กœ ์—ด๊ณ  ๋ฐ‘์— ๋ช…๋ น์–ด๋ฅผ ์ž‘์„ฑํ•œ๋‹ค. 

server {
    listen 80;					// ์„œ๋ฒ„๊ฐ€ 80๋ฒˆ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ HTTP ์š”์ฒญ์„ ์ˆ˜์‹ ํ•˜๋„๋ก ์„ค์ •
    server_name abc.com www.abc.com;		// ํ•ด๋‹น ๋„๋ฉ”์ธ์œผ๋กœ ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋„๋ก ํ•จ

    root /var/www/abc.com/html;				// ์›น ๋ฌธ์„œ์˜ ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ €์žฅ(์‹ค์ œ ์›น ํŒŒ์ผ๋“ค์ด ์—ฌ๊ธฐ ์œ„์น˜/ abc.com์€ ๋‚ด ๋„๋ฉ”์ธ์œผ๋กœ ๋ณ€๊ฒฝํ•ด์•ผํ•จ)
    index index.html index.htm index.nginx-debian.html;	// ๊ธฐ๋ณธ ์ธ๋ฑ์Šค ํŒŒ์ผ๋“ค์„ ์ •์˜ nginx๋Š” ์š”์ฒญ๋œ ๋””๋ ‰ํ† ๋ฆฌ์— ์ด ํŒŒ์ผ์ด ์žˆ์œผ๋ฉด ํ•ด๋‹น ํŒŒ์ผ์„ ์‘๋‹ต์œผ๋กœ ๋ณด๋ƒ„

    location / {						// ๋ฃจํŠธ url('/') ์— ๋Œ€ํ•œ ์„ค์ •์„ ์ •์˜
        try_files $uri $uri/ =404;		// ์š”์ฒญ๋œ ํŒŒ์ผ์ด ์žˆ์œผ๋ฉด ํ•ด๋‹น ํŒŒ์ผ์„ ์„œ๋น™, ์—†์œผ๋ฉด ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ํ™•์ธ, ๋‘˜๋‹ค ์—†์œผ๋ฉด 404 ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜
    }
}

 

 

ํ•ด๋‹น ํŒŒ์ผ์„ sites-enabled๋กœ ์˜ฎ๊ฒจ์ค€๋‹ค.


: sites-available ๋””๋ ‰ํ† ๋ฆฌ๋Š” ๋ชจ๋“  ์‚ฌ์ดํŠธ์˜ ์„ค์ • ํŒŒ์ผ์„ ๋ณด๊ด€ํ•˜๋Š” ๊ณณ / sites-enabled๋Š” ํ˜„์žฌ ํ™œ์„ฑํ™”๋œ ์‚ฌ์ดํŠธ์˜ ์„ค์ • ํŒŒ์ผ์— ๋Œ€ํ•œ ์‹ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ๋ณด๊ด€ํ•จ์œผ๋กœ์จ, ํŠน์ • ์‚ฌ์ดํŠธ๋ฅผ ์‰ฝ๊ฒŒ ํ™œ์„ฑํ™”ํ•˜๊ฑฐ๋‚˜ ๋น„ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ๋‹ค

 

 

nginx ์žฌ์‹คํ–‰

 

sudo nginx -t 	 			// nginx์˜ ์„ค์ • ํŒŒ์ผ์— ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธ
sudo systemctl restart nginx		// nginx ์žฌ์‹œ์ž‘
sudo service nginx status		// nginx๊ฐ€ ์ž˜ ์‹คํ–‰์ค‘์ธ์ง€ ํ™•์ธ

 

 

๊ทธ ํ›„์— ec2 ํผ๋ธ”๋ฆญ ip์ฃผ์†Œ๋กœ ์ ‘์†ํ•˜๋ฉด 

๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค

 

 

์ฐธ๊ณ 

https://blog.naver.com/gi_balja/223028077537

 

Nginx๋ž€ ๋ฌด์—‡์ธ๊ฐ€?

Nginx(์—”์ง„์—‘์Šค)๋Š” ๋†’์€ ์„ฑ๋Šฅ๊ณผ ์•ˆ์ •์„ฑ ๊ทธ๋ฆฌ๊ณ  ํ˜„์žฌ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š” ์›น ์„œ๋ฒ„์ž…๋‹ˆ๋‹ค. Apache(์•„...

blog.naver.com

 

https://velog.io/@dev_leewoooo/Forward-Proxy-Reverse-Proxy%EC%97%90-%EA%B4%80%ED%95%98%EC%97%AC

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•
  1. ec2 ๋ฐœ๊ธ‰
  2. ufw ์„ค์ • ๋ฐ port ๊ตฌ์„ฑ๋„
  3. swap ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
  4. docker ์„ค์น˜ (+ Ubuntu ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ…)
  5. docker-compose & jenkins ์„ค์น˜
  6. jenkins gitlab ์—ฐ๋™(project-build) ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜
  7. dockerHub ์„ค์น˜ ๋ฐ ์—ฐ๋™(docker-build)
  8. dockerScript ์ž‘์„ฑ(pipeline)
  9. Nginx
  10. S3 ์„ค์น˜ ๋ฐ ์„ค์ •
  11. RDS ์„ค์น˜ ๋ฐ ์„ค์ •

 

docker ์„ค์น˜

 

Docker ?????

- ๋ฆฌ๋ˆ…์Šค ๊ธฐ๋ฐ˜์˜ ์ปจํ…Œ์ด๋„ˆํ™” ๊ธฐ์ˆ ๋กœ, ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ํšจ์œจ์ ์œผ๋กœ ๋ฐฐํฌํ•˜๊ณ  ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ
- ๋„์ปค ์ปจํ…Œ์ด๋„ˆ๋Š” ๊ฐ€์ƒ ๋จธ์‹ (VM ware, VirtualBox) ๋ณด๋‹ค ๊ฐ€๋ฒผ์›Œ ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ์ด ์ ๊ณ , ํ”„๋กœ์„ธ์Šค ๊ฒฉ๋ฆฌ๋ฅผ ํ†ตํ•ด ์„ฑ๋Šฅ ์†์‹ค์ด ๊ฑฐ์˜  ์—†๋‹ค
- ๊ฐ ์ปจํ…Œ์ด๋„ˆ๋Š” ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ์‹คํ–‰ ํŒŒ์ผ๋งŒ ํฌํ•จํ•˜๋ฏ€๋กœ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ์ž‘๊ณ , ๋งŒ๋“ค์–ด ๋ฐฐํฌํ•˜๋Š” ์‹œ๊ฐ„์ด ๊ฐ€์ƒ ๋จธ์‹ ์— ๋น„ํ•ด ๋น ๋ฅด๊ณ , ๋„์ปค ์—”์ง„์„ ํ†ตํ•ด ์ด๋ฏธ์ง€์™€ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ด€๋ฆฌํ•œ๋‹ค
- ๋„์ปค์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ด๋ฏธ์ง€์˜ ์ด๋ฆ„ ๊ตฌ์„ฑ
 [ ์ €์žฅ์†Œ ์ด๋ฆ„ ] / [ ์ด๋ฏธ์ง€ ์ด๋ฆ„ ] : [ ํƒœ๊ทธ ]

์ €์žฅ์†Œ ์ด๋ฆ„ : ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋œ ์žฅ์†Œ, ์ €์žฅ์†Œ ์ด๋ฆ„์ด ๋ช…์‹œ๋˜์ง€ ์•Š์€ ์ด๋ฏธ์ง€๋Š” ๋„์ปค ํ—ˆ๋ธŒ์˜ ๊ณต์‹ ์ด๋ฏธ์ง€๋ฅผ ๋œปํ•จ
์ด๋ฏธ์ง€ ์ด๋ฆ„ : ํ•ด๋‹น ์ด๋ฏธ์ง€๊ฐ€ ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€ ๋‚˜ํƒ€๋‚ด๋ฉฐ ํ•„์ˆ˜๋กœ ์„ค์ •
Ex) ubuntu:latest : ์šฐ๋ถ„ํˆฌ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์ด๋ฏธ์ง€
ํƒœ๊ทธ : ์ด๋ฏธ์ง€์˜ ๋ฒ„์ „์„ ๋‚˜ํƒ€๋ƒ„, ํƒœ๊ทธ๋ฅผ ์ƒ๋žตํ•˜๋ฉด ๋„์ปค ์—”์ง„์€ latest๋กœ ์ธ์‹ํ•จ

 

 

Ubuntu ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ…

 

sudo apt update
sudo apt upgrade

 

  • sudo apt update : ์‹œ์Šคํ…œ์ด ์ƒˆ๋กœ์šด ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•  ๋•Œ ๊ฐ€์žฅ ์ตœ์‹  ์ •๋ณด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•จ
  • sudo apt upgrade : ์‹œ์Šคํ…œ์— ์„ค์น˜๋œ ๋ชจ๋“  ํŒจํ‚ค์ง€๋ฅผ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•จ 
sudo apt install apt-transport-https ca-certificates

 

  • apt-transport-https 
    : HTTPS ํ”„๋กœํ† ์ฝœ์„ ํ†ตํ•ด ์•ˆ์ „ํ•˜๊ฒŒ ์†Œํ”„ํŠธ์›จ์–ด ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ํŒจํ‚ค์ง€
    : HTTPS๋Š” ๋ฐ์ดํ„ฐ ์ „์†ก ์ค‘์— ์•”ํ˜ธํ™”๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๋ณด์•ˆ์„ฑ์„ ๊ฐ•ํ™”ํ•จ
  • ca-certificates 
    : ์ธ์ฆ์„œ(authority certificates)๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ
    : HTTPS ํ†ต์‹  ์‹œ์— ์„œ๋ฒ„์˜ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์ฆ์„œ๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•จ
sudo apt install curl gnupg-agent software-properties-common
  • curl
    : ๋ฐ์ดํ„ฐ ์ „์†ก์„ ์œ„ํ•œ ๋ช…๋ น์ค„ ๋„๊ตฌ
    : ๋‹ค์–‘ํ•œ ํ”„๋กœํ† ์ฝœ์„ ์ง€์›ํ•˜๋ฉฐ ์ฃผ๋กœ ์›น์—์„œ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ฑฐ๋‚˜ api ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๋ฐ ์‚ฌ์šฉ
  • gnupg-agent
    : GNU Privacy Guard(GnuPG)์˜ ์—์ด์ „ํŠธ ํ”„๋กœ๊ทธ๋žจ
    : ์•”ํ˜ธํ™” ๋ฐ ์„œ๋ช… ์ž‘์—…์— ํ•„์š”ํ•œ ํ‚ค ๊ด€๋ฆฌ๋ฅผ ์ง€์›( ์บ์‹ฑํ•˜์—ฌ ์•”ํ˜ธ ํ†ต์‹ ์˜ ๋ณด์•ˆ์„ ๊ฐ•ํ™”ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ)
  • software-properties-common
    : ์†Œํ”„ํŠธ์›จ์–ด ์†Œ์Šค ๋ฐ ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ๊ณตํ†ต ์†Œํ”„ํŠธ์›จ์–ด ์†์„ฑ์„ ์ œ๊ณตํ•˜๋Š” ํŒจํ‚ค์ง€
    : add-apt-repository ์™€ ๊ฐ™์€ ์œ ์šฉํ•œ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋จ

 

GPG ํผ๋ธ”๋ฆญ ํ‚ค ์—๋Ÿฌ

 

GPG(GNU Privacy Guard) ????

- ๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ ๋ฐ ๋ฐ์ดํ„ฐ ์•”ํ˜ธํ™”๋ฅผ ์œ„ํ•œ ์˜คํ”ˆ ์†Œ์Šค ์†Œํ”„ํŠธ์›จ์–ด๋กœ, PGP(Pretty Good Privacy)๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ, ๋ณด์•ˆํ†ต์‹ ์„ ์œ„ํ•œ ์˜คํ”ˆ์†Œ์Šค
- ๊ณต๊ฐœ ํ‚ค(Public Key) : ์ด ํ‚ค๋Š” ๋‹ค๋ฅธ ์‚ฌ๋ฆ„๋“ค์—๊ฒŒ ๊ณต์œ ๋˜๋ฉฐ, ์ด ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฉ”์‹œ์ง€๋ฅผ ์•”ํ˜ธํ™”ํ•˜๊ฑฐ๋‚˜ ์‚ฌ์šฉ์ž์˜ ๋””์ง€ํ„ธ ์„œ๋ช…์„ ๊ฒ€์ฆํ•  ์ˆ˜ ์žˆ๋‹ค
- .๋น„๊ณต๊ฐœ ํ‚ค(Private Key) : ์ด ํ‚ค๋Š” ์‚ฌ์šฉ์ž๋งŒ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•˜๊ณ  ์ด ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฉ”์‹œ์ง€๋ฅผ ํ•ด๋…ํ•˜๊ฑฐ๋‚˜ ์ž์‹ ์˜ ๋””์ง€ํ„ธ ์„œ๋ช…์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค
- GPG ํ‚ค๋Š” ๋””์ง€ํ„ธ ์„œ๋ช…, ์—„ํ˜ธํ™”, ์†Œํ”„ํŠธ์›จ์–ด ํŒจํ‚ค์ง€์˜ ๋ฌด๊ฒฐ์„ฑ ๊ฒ€์ฆ ๋“ฑ์— ์‚ฌ์šฉ๋œ๋‹ค
Ex) ์˜คํ”ˆ ์†Œ์Šค ์†Œํ”„ํŠธ์›จ์–ด์˜ ๊ฐœ๋ฐœ์ž๋Š” GPG ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์†Œํ”„ํŠธ์›จ์–ด ํŒจํ‚ค์ง€์— ์„œ๋ช…ํ•˜๊ณ , ์‚ฌ์šฉ์ž๋Š” ๊ทธ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์šด๋กœ๋“œํ•œ ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ์›๋ณธ ๊ทธ๋Œ€๋กœ์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค

 

W: GPG error: https://download.docker.com/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu focal InRelease' is not signed.

 

ํ•ด๋‹น ์—๋Ÿฌ : Docker ์ €์žฅ์†Œ์˜ GPG ํ‚ค๊ฐ€ ์‹œ์Šคํ…œ์— ์ œ๋Œ€๋กœ ์ถ”๊ฐ€๋˜์ง€ ์•Š์•˜๋‹ค...๋ผ๋Š” ์˜๋ฏธ

 

 

๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡

์œ„ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•

 

  1. GPG ํ‚ค ์ถ”๊ฐ€
    : ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€์—๋Š” ๋ˆ„๋ฝ๋œ ๊ณต๊ฐœ ํ‚ค(NO_PUBKEY 7EA0A9C3F273FCD8) ๊ฐ€  ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. 
     ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹œ์Šคํ…œ์˜ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ํ‚ค ๋ชฉ๋ก์— ์ด ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•œ๋‹ค!!
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg : Docker์˜ GPG ํ‚ค๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ๋‹ค์šด๋กœ๋“œํ•œ๋‹ค...
    ์—ฌ๊ธฐ์„œ -f ๋Š” ์‹คํŒจ ์‹œ ์—๋Ÿฌ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ , -s ๋Š” ์นจ๋ฌต ๋ชจ๋“œ(์ถœ๋ ฅ ์—†์Œ)๋กœ ์‹คํ–‰ํ•˜๋ฉฐ, -S ๋Š” ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋ฅผ ์ถœ๋ ฅ, -L ๋Š” ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋ฅผ ๋”ฐ๋ฆ„
  • | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg : ๋‹ค์šด๋กœ๋“œํ•œ GPG ํ‚ค๋ฅผ dearmor ํ•˜์—ฌ ๋ฐ”์ด๋„ˆ๋ฆฌ ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  /usr/share/keyrings/docker-archive-keyring.gpg์— ์ €์žฅ

 

2. Docker ์ €์žฅ์†Œ ์ถ”๊ฐ€
  :  ์ด์ „์— ํ‚ค๊ฐ€ ์ œ๋Œ€๋กœ ์ถ”๊ฐ€๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ง€์ •๋œ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Docker ์ €์žฅ์†Œ๋ฅผ ๋‹ค์‹œ ์ถ”๊ฐ€ํ•ด์•ผ ํ•  ์ˆ˜ ๋„ ์žˆ๋‹ค

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

3. ์‹œ์Šคํ…œ ์—…๋ฐ์ดํŠธ
 : ํ‚ค์™€ ์ €์žฅ์†Œ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ถ”๊ฐ€ํ•œ ํ›„ ํŒจํ‚ค์ง€ ์ƒ‰์ธ์„ ์—…๋ฐ์ดํŠธ 

sudo apt-get update

 

4. Docker ์„ค์น˜ 

sudo apt-get install docker-ce docker-ce-cli containerd.io
docker -v

 

 

๋„์ปค์˜ ๊ธฐ๋ณธ ๋ช…๋ น์–ด๋“ค

 

$ docker run  // ์ƒˆ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹คํ–‰
$ docker ps   // ์‹คํ–‰ ์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ์˜ ๋ชฉ๋ก์„ ๋ณด์—ฌ์คŒ, -a ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•˜๋ฉด ์ข…๋ฃŒ๋œ ์ปจํ…Œ์ด๋„ˆ๊นŒ์ง€
$ doxker stop // ์‹คํ–‰ ์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ •์ง€
$ docker rm   // ์ปจํ…Œ์ด๋„ˆ ์‚ญ์ œ
$ docker images // ์‹œ์Šคํ…œ์— ์žˆ๋Š” ๋„์ปค ์ด๋ฏธ์ง€์˜ ๋ชฉ๋ก์„ ๋ณด์—ฌ์คŒ
$ docker pull 	// ๋ฆฌ๋ชจํŠธ ์ €์žฅ์†Œ์—์„œ ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ธฐ
$ docker build  // doxkerfile์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œ

 

 

docker-compose & jenkins ์„ค์น˜

 

Docker Compose ????

- ์—ฌ๋Ÿฌ ๊ฐœ์˜ Docker ์ปจํ…Œ์ด๋„ˆ๋“ค์„ ํ•˜๋‚˜์˜ ์„œ๋น„์Šค๋กœ ์ •์˜ํ•˜๊ณ  ๊ตฌ์„ฑํ•ด ํ•˜๋‚˜์˜ ๋ฌถ์Œ์œผ๋กœ ๊ด€๋ผํ•  ์ˆ˜ ์žˆ๋Š” ํ•˜๋‚˜์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“œ๋Š” ๊ฒƒ

 

 

๋„์ปค ์ปดํฌ์ฆˆ ์„ค์น˜

# ๋„์ปค ์ปดํฌ์ฆˆ V2 ๋ฒ„์ „ ์„ค์น˜
sudo curl -sSL "https://github.com/docker/compose/releases/download/v2.15.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 
# ์‹คํ–‰ ๊ถŒํ•œ ์„ค์ •
chmod +x /usr/local/bin/docker-compose
 
# ๋ฒ„์ „ ํ™•์ธ
docker-compose --version

 

 

docker-compose.yml ์ž‘์„ฑ

version: '3.7'

services:
  jenkins:
    image: 'jenkins/jenkins'
    restart: unless-stopped
    user: root
    privileged: true
    ports:
      - '9090:8080'
    volumes:
      - '/home/ubuntu/docker/jenkins-data:/var/jenkins_home'
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '/usr/bin/docker:/usr/bin/docker'
    container_name: 'jenkins'

 

 

ํ•ด๋‹น ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋น„๋ฒˆ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

 

 

์ฐธ๊ณ 

 

https://seosh817.tistory.com/345

 

[Docker] ๋„์ปค๋ž€? - ๋„์ปค ๊ฐœ๋… ์ •๋ฆฌ

๋„์ปค๋ž€? ๋„์ปค(Docker)๋Š” ๋ฆฌ๋ˆ…์Šค ์ปจํ…Œ์ด๋„ˆ์— ๋ฆฌ๋ˆ…์Šค ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ํ”„๋กœ์„ธ์Šค ๊ฒฉ๋ฆฌ๊ธฐ์ˆ ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋” ์‰ฝ๊ฒŒ ์ปจํ…Œ์ด๋„ˆ๋กœ ์‹คํ–‰ํ•˜๊ณ  ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ ์ž…๋‹ˆ๋‹ค. ๋„์ปค๋Š” ์ผ๋ฐ˜์ 

seosh817.tistory.com

 

https://uyfuyfuy-042.tistory.com/entry/GPG-keyPGP

 

GPG key(PGP)

GPG(GNU Privacy Guard) ๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ ๋ฐ ๋ฐ์ดํ„ฐ ์•”ํ˜ธํ™”๋ฅผ ์œ„ํ•œ ์˜คํ”ˆ ์†Œ์Šค ์†Œํ”„ํŠธ์›จ์–ด์ž…๋‹ˆ๋‹ค. PGP(Pretty Good Privacy)๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ, ๋ณด์•ˆํ†ต์‹ ์„ ์œ„ํ•œ ์˜คํ”„์†Œ์Šค์ด๋‹ค. ๊ณต๊ฐœ ํ‚ค(Public Key): ์ด ํ‚ค๋Š”

uyfuyfuy-042.tistory.com

 

https://hstory0208.tistory.com/entry/Docker-%EB%8F%84%EC%BB%A4-%EB%AA%85%EB%A0%B9%EC%96%B4-%EC%B4%9D%EB%AA%A8%EC%9D%8C%EC%A7%91-image-container-compose

 

[Docker] ๋„์ปค ๋ช…๋ น์–ด ์ด๋ชจ์Œ์ง‘ (image, container, compose)

๐Ÿ“Œ Docker ์‹คํ–‰ sudo systemctl status docker # 1 sudo /etc/init.d/docker start # 2 Docker Image ๊ด€๋ จ ๋ช…๋ น์–ด ์ด๋ฏธ์ง€ ๋นŒ๋“œ Dockerfile์„ ์ด์šฉํ•ด์„œ ์ด๋ฏธ์ง€ ์ƒ์„ฑ (์ œ์ผ ๋งŽ์ด ์“ฐ๋Š” ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋ฐฉ๋ฒ•) โžก docker build -t {์ด๋ฏธ์ง€

hstory0208.tistory.com

 

https://hstory0208.tistory.com/entry/Docker-%EB%8F%84%EC%BB%A4-%EC%BB%B4%ED%8F%AC%EC%A6%88Docker-Compose%EB%9E%80-%EC%99%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%EA%B0%80

 

[Docker] ๋„์ปค ์ปดํฌ์ฆˆ(Docker Compose)๋ž€? ์™œ ์‚ฌ์šฉํ•˜๋Š”๊ฐ€?

๐Ÿ“Œ ๋„์ปค ์ปดํฌ์ฆˆ๋ž€? ์—ฌ๋Ÿฌ ๊ฐœ์˜ Docker ์ปจํ…Œ์ด๋„ˆ๋“ค์„ ํ•˜๋‚˜์˜ ์„œ๋น„์Šค๋กœ ์ •์˜ํ•˜๊ณ  ๊ตฌ์„ฑํ•ด ํ•˜๋‚˜์˜ ๋ฌถ์Œ์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ํ•˜๋‚˜์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค. ๋„์ปค ์ปดํฌ์ฆˆ ์„ค์น˜ # ๋„์ปค ์ปดํฌ์ฆˆ V2

hstory0208.tistory.com

 

https://velog.io/@suhongkim98/jenkins-%EB%8F%84%EC%BB%A4%EB%A1%9C-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0

 

jenkins ๋„์ปค๋กœ ์„ค์น˜ํ•˜๊ธฐ

์šฐ๋ถ„ํˆฌ์— ์  ํ‚จ์Šค๋ฅผ ๋„์ปค๋กœ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ด…๋‹ˆ๋‹ค

velog.io

 

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

๋Œ€๋žต์ ์ธ ๋ฐฐํฌ ์ˆœ์„œ...

  1. ec2 ๋ฐœ๊ธ‰
  2. ufw ์„ค์ • ๋ฐ port ๊ตฌ์„ฑ๋„
  3. swap ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
  4. docker ์„ค์น˜
  5. docker-compose jenkins ์„ค์น˜
  6. jenkins gitlab ์—ฐ๋™(project-build) ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜
  7. dockerHub ์„ค์น˜ ๋ฐ ์—ฐ๋™(docker-build)
  8. dockerScript ์ž‘์„ฑ(pipeline)
  9. Nginx
  10. S3 ์„ค์น˜ ๋ฐ ์„ค์ •
  11. RDS ์„ค์น˜ ๋ฐ ์„ค์ •

 

EC2 ์„ค์ •

 

EC2 (Elastic Compute Cloud) ???

- ์•„๋งˆ์กด ์›น ์„œ๋น„์Šค(AWS) ์—์„œ ์ œ๊ณตํ•˜๋Š” ํด๋ผ์šฐ๋“œ ์ปดํ“จํŒ… ์„œ๋น„์Šค
- ํด๋ผ์šฐ๋“œ ์ปดํ“จํŒ… ์ธํ„ฐ๋„ท(ํด๋ผ์šฐ๋“œ)์„ ํ†ตํ•ด ์„œ๋ฒ„, ์Šคํ† ๋ฆฌ์ง€, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋“ฑ์˜ ์ปดํ“จํŒ… ์„œ๋น„์Šค๋ฅผ ์ œ๊ณต
  => AWS ์—์„œ ์›๊ฒฉ์œผ๋กœ ์ œ์–ดํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€์ƒ์˜ ์ปดํ“จํ„ฐ๋ฅผ ํ•œ ๋Œ€ ๋นŒ๋ฆฌ๋Š” ๊ฒƒ
- ์‚ฌ์šฉํ•œ ๋งŒํผ ๋น„์šฉ์„ ์ง€๋ถˆํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํƒ„๋ ฅ์ ์ธ ์ด๋ผ๋Š” ์˜๋ฏธ์˜  Elastic์ด๋ผ๋Š” ๋‹จ์–ด๊ฐ€ ๋ถ™์–ด์žˆ๋‹ค

์กฐ๊ธˆ ๋” ์•Œ๊ณ  ์‹ถ๋‹ค๋ฉด ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡
https://velog.io/@server30sopt/AWS-EC2-%EA%B0%9C%EB%85%90-%EC%A0%95%EB%A6%AC



AWS ์—์„œ ์ง์ ‘ EC2๋ฅผ ๋‚ด๊ฐ€ ํ• ๋‹นํ•  ๋•Œ ์ฐธ์กฐํ•  ๋ธ”๋กœ๊ทธ
https://velog.io/@sunblock99/AWS-%ED%94%84%EB%A6%AC%ED%8B%B0%EC%96%B4-EC2-%EC%9D%B8%EC%8A%A4%ED%84%B4%EC%8A%A4-%EB%A7%8C%EB%93%9C%EB%8A%94-%EB%B0%A9%EB%B2%95

 

[AWS] ํ”„๋ฆฌํ‹ฐ์–ด EC2 ์ธ์Šคํ„ด์Šค ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•

1) AWS ๊ณ„์ • ์ƒ์„ฑ ๊ฐœ์ธ์ •๋ณด์™€ ๊ฒฐ์ œ ์นด๋“œ ๋“ฑ์„ ๋“ฑ๋กํ•ด์„œ ๊ฐ€์ž…ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ธ๋‹น 1๊ณ„์ • ์ œํ•œ์ด ์—†์œผ๋‹ˆ ํ”„๋ฆฌํ‹ฐ์–ด ๊ธฐ๊ฐ„์ด ๋๋‚ฌ๋‹ค๋ฉด ๋‹ค๋ฅธ ์ด๋ฉ”์ผ๋กœ ๊ฐ€์ž…ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. 2) ์ธ์Šคํ„ด์Šค ์‹œ์ž‘ ๋ฉ”์ธ ํ™”๋ฉด์—์„œ EC2

velog.io

 

๋‚˜๋Š” ์‹ธํ”ผ์—์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์œ„ํ•ด ์ˆ˜ํ–‰ํ•ด์„œ ์„ค์ •์„ ํ•ด์ฃผ์‹œ๊ณ  ๋ฐœ๊ธ‰ ๋ฐ›์•˜๋‹ค...

๋”ฐ๋กœ ํฌํŠธ ์„ค์ •์ด๋‚˜ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ํ•  ํ•„์š” X

 

 

ufw ์„ค์ • 

 

ufw(Uncomplicated Firewall; ๋ณต์žกํ•˜์ง€ ์•Š์€ ๋ฐฉํ™”๋ฒฝ) ??????

- ๋ฆฌ๋ˆ…์Šค ๊ณ„์—ด ์šด์˜์ฒด์ œ์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฌ์šด ๋ฐฉํ™”๋ฒฝ ๊ด€๋ฆฌ ํ”„๋กœ๊ทธ๋žจ
- ๋ฆฌ๋ˆ…์Šค ์ปค๋„์€ ๋‹ค์–‘ํ•œ ๋„คํŠธ์›Œํฌ ๊ด€๋ จ ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๋Š” netfilter(๋„ท ํ•„ํ„ฐ) ๋ผ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”๋ฐ, ์ด๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์ด UFW
- netfilter๋Š” ๋ฆฌ๋ˆ…์Šค์—์„œ ๋ฐฉํ™”๋ฒฝ์„ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•ด iptables(๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ์„ ๊ด€๋ฆฌํ•˜๊ณ  ์ œ์–ด)๋ผ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์‚ฌ์šฉ
- ์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ iptables๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ์—๋Š” ๋ณต์žกํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๋Ÿฌํ•œ ์ ˆ์ฐจ๋ฅผ ๊ฐ„ํŽธํ•˜๊ฒŒ ํ•ด์ค€ ๊ฒƒ์ด UFW

 

 

๋ฐฉํ™”๋ฒฝ์ด๋ž€ ????

- ์ปดํ“จํ„ฐ์˜ ๋ณด์•ˆ์„ ์œ„ํ•ด ๋ฏธ๋ฆฌ ์ •์˜๋œ ๊ทœ์น™์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ ๋“ค์–ด์˜ค๊ณ  ๋‚˜๊ฐ€๋Š” ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๊ณ  ์ œ์–ดํ•˜๋Š” ๋„คํŠธ์›Œํฌ ๋ณด์•ˆ ์‹œ์Šคํ…œ
- ๋‚ด๋ถ€์—์„œ ์™ธ๋ถ€์˜ ์ •๋ณด ํ†ต์‹ ๋ง์— ์ ‘๊ทผํ•˜๊ฑฐ๋‚˜ ์™ธ๋ถ€์—์„œ ๋‚ด๋ถ€๋กœ ๋ถˆ๋ฒ•์ ์œผ๋กœ ์ ‘๊ทผํ•˜๋Š” ์›€์ง์ž„์„ ์ฐจ๋‹จ
- ๋ชฉ์  : ์ธ๊ฐ€๋ฐ›์ง€ ์•Š์€ ์‚ฌ์šฉ์ž๊ฐ€ ๋‚ด๋ถ€ ์ปดํ“จํ„ฐ ์ž์›์„ ์‚ฌ์šฉ ๋˜๋Š” ๊ต๋ž€ํ•˜๊ฑฐ๋‚˜ ์ค‘์š”ํ•œ ์ •๋ณด๋ฅผ ์™ธ๋ถ€์— ์œ ์ถœํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
- ์ž‘๋™ ์›๋ฆฌ  : ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ฐฉํ™”๋ฒฝ์€ ๋ชจ๋“  ์ ‘๊ทผ์„ ๊ฑฐ๋ถ€ํ•˜๊ณ , ๋‹จ๊ณ„์ ์œผ๋กœ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•œ๋‹ค. ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๊ฐ€ ์ด๋™ํ•˜๋Š” ํ†ต๋กœ๋ฅผ ํฌํŠธ(port)๋ผ ํ•˜๋Š”๋ฐ, ๋ฐฉํ™”๋ฒฝ์€ ์•ฝ 65,000๊ฐœ์˜ ํ†ต์‹  ํฌํŠธ๋ฅผ ๋ชจ๋‘ ์ฐจ๋‹จํ•˜๊ณ , ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•˜๋Š” ํŠน์ • ํฌํŠธ๋งŒ ์—ด์–ด๋‘”๋‹ค

 

 

.SSH(Secure Shell) ????

- ์›๊ฒฉ ํ˜ธ์ŠคํŠธ์— ์ ‘์†ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” ๋ณด์•ˆ ํ”„๋กœํ† ์ฝœ
- ์‚ฌ์šฉ์ž๊ฐ€ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ•ด์„ํ•ด์„œ ์ปค๋„๋กœ ์˜ฎ๊ฒจ ์‹คํ–‰ํ•˜๋Š” ์—ญํ• ์„ ํ•ด์ฃผ๋Š” ๊ฒƒ
- ๊ธฐ์กด ์›๊ฒฉ ์ ‘์†์€ Telnet ์ด๋ผ๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ, ์•”ํ˜ธํ™”๋ฅผ ์ œ๊ณตํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋ณด์•ˆ์ƒ ์ทจ์•ฝํ•˜๋‹ค๋Š” ๋‹จ์ ์ด   ์žˆ์—ˆ๋Š”๋ฐ ์ด๋ฅผ ์•”ํ˜ธํ™”ํ•˜๋Š” SSH ๊ธฐ์ˆ ์ด ๋“ฑ์žฅํ–ˆ๊ณ , ํ˜„์žฌ ์›๊ฒฉ ์ ‘์† ๋ณด์•ˆ์„ ์œ„ํ•œ ํ•„์ˆ˜ ๋ฐฉ๋ฒ•์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋‹ค

 

 

์šฐ๋ฆฌ ํ”„๋กœ์ ํŠธ์—์„œ๋Š” VMware์—์„œ ๋ฐ”๋กœ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์ง€ ์•Š๊ณ  puttygen์„ ์‚ฌ์šฉํ•ด์„œ ํ‚ค๋ฅผ ๋งŒ๋“ค๊ณ  ํŽธ์˜ ๊ธฐ๋Šฅ์„ฑ์˜ ํญ์„ ๋„“ํž˜

 

PuTTY

-  ์œˆ๋„์šฐ์šฉ ์˜คํ”ˆ์†Œ์Šค SHH ๋ฐ Telnet ํด๋ผ์ด์–ธํŠธ
-  ์›๊ฒฉ์œผ๋กœ ์„œ๋ฒ„ ๋ฐ ์žฅ์น˜์— ์—ฐ๊ฒฐ์ด ๊ฐ€๋Šฅํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ์ด ๊ต‰์žฅํžˆ ๊ฐ€๋ณ๊ณ  ๊ฐ„ํŽธํ•ด์„œ ์‚ฌ์šฉ์„ฑ์ด ๋›ฐ์–ด๋‚จ
-  ํด๋ผ์ด์–ธํŠธ๋Š” ๊ฐ•๋ ฅํ•œ ์•”ํ˜ธํ™”๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ๊ฐ„์— ์ „์†ก๋˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ณดํ˜ธํ•˜๋ฉฐ ์•”ํ˜ธ ์ธ์ฆ, ๊ณต๊ฐœ ํ‚ค ์ธ์ฆ ๋ฐ ํ‚ค๋ณด๋“œ ๋Œ€ํ™”์‹ ์ธ์ฆ์„ ํฌํ•จํ•œ ๋‹ค์–‘ํ•œ ์ธ์ฆ ๋ฐฉ๋ฒ•์„ ์ง€์›

 

https://www.puttygen.com/

 

PuTTYgen Download

Download PuTTYgen for Windows, Linux and Mac operating system. Find step by step guide to downloading PuTTYgen, a key generator for free.

www.puttygen.com

https://www.putty.org/

 

 

Download PuTTY - a free SSH and telnet client for Windows

Is Bitvise affiliated with PuTTY? Bitvise is not affiliated with PuTTY. We develop our SSH Server for Windows, which is compatible with PuTTY. Many PuTTY users are therefore our users as well. From time to time, they need to find the PuTTY download link. W

www.putty.org

  • ssh ์ ‘์†์„ ํ—ˆ์šฉํ•˜๋Š” ๊ทœ์น™ ์ถ”๊ฐ€ํ•˜๊ธฐ
$ sudo ufw allow 22

 

  • ufw ํ™œ์„ฑํ™”ํ•˜๊ธฐ
$ sudo ufw enable

 

  • ufw ์ƒํƒœ ํ™•์ธํ•˜๊ธฐ
$ sudo ufw status

 

  • ํฌํŠธ ์ •์ƒ ๋“ฑ๋ก๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ
$ sudo ufw status numbered

 

 

EC2 ๋ณด์•ˆ๊ทธ๋ฃน

22 : ssh 

8080 : Springboot

80 : Nginx

6379 : Redis

5000 : Docker

3306 : Database

 

 

swap ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •

swap memory ????

- ์‹ค์ œ ๋ฉ”๋ชจ๋ฆฌ Ram์ด ๊ฐ€๋“ ์ฐผ์ง€๋งŒ ๋” ๋งŽ์€ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ๋•Œ ๋””์Šคํฌ ๊ณต๊ฐ„์„ ์ด์šฉํ•˜์—ฌ ๋ถ€์กฑํ•œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋Œ€์ฒดํ•  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฐ„
- ์‹ค์ œ ์šด์˜ํ™˜๊ฒฝ์—์„œ๋Š” ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ์‹ค์ œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์˜ฌ๋ ค์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ๋” ์ข‹๋‹ค
 => ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ์ด  ์‹ค์ œ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ณด๋‹ค ๋œ ๋ฐ”๋žŒ์งํ•œ ์ด์œ 

1. ์†๋„ ์ฐจ์ด : ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ๋Š” ํ•˜๋“œ ๋“œ๋ผ์ด๋ธŒ์— ์œ„์น˜ํ•˜๋Š”๋ฐ, ์ด๋Ÿฌํ•œ ์ €์žฅ ์žฅ์น˜๋Š” RAM๋ณด๋‹ค ์ฝ๊ณ  ์“ฐ๋Š” ์†๋„๊ฐ€ ํ›จ์”ฌ ๋Š๋ ค์„œ ์‹œ์Šคํ…œ์ด ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ํ”„๋กœ๊ทธ๋žจ์˜ ์‘๋‹ต ์‹œ๊ฐ„์ด ๋Š˜์–ด๋‚˜๊ณ  ์ „๋ฐ˜์ ์ธ ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ๋‹ค
2. ์›จ์–ด ๋ผ๋ฒจ๋ง(Wear Leveling) : SSD์˜ ๊ฒฝ์šฐ, ๋ฐ์ดํ„ฐ๋ฅผ ์ง€์†์ ์œผ๋กœ ์“ฐ๊ณ  ์ง€์šฐ๋Š” ์ž‘์—…์ด SSD์˜ ์ˆ˜๋ช…์„ ๋‹จ์ถ•
3. ์‹œ์Šคํ…œ ์ž์›์˜ ํšจ์œจ์  ์‚ฌ์šฉ :  ํ”„๋กœ์„ธ์Šค ๊ด€๋ฆฌ์™€ ์ž์› ํ• ๋‹น์— ์žˆ์–ด์„œ ์ตœ์ ์˜ ์„ฑ๋Šฅ์„ ๋‚ด์ง€ ๋ชปํ•  ์ˆ˜ ์žˆ๋‹ค
4. ์‹œ์Šคํ…œ์˜ ์•ˆ์ •์„ฑ : ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๊ณผ๋„ํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋Š” ์‹œ์Šคํ…œ์€ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•  ๋•Œ ์ž์ฃผ ๋ฐœ์ƒํ•˜๋Š” '์Šค์™‘ ์Šค๋ ˆ์‹ฑ' ํ˜„์ƒ์„ ๋น ์งˆ ์ˆ˜ ์žˆ๋‹ค(๋ฉ”๋ชจ๋ฆฌ์™€ ์Šค์™‘ ์˜์—ญ ์‚ฌ์ด์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ด๋™์‹œ์ผœ ์ฒ˜๋ฆฌํ•˜๋Š” ํ˜„์ƒ์„ ๋งํ•˜๊ณ , ์‹œ์Šคํ…œ์ด ๋Š๋ ค์ง€๊ณ  ๋ถˆ์•ˆ์ •ํ•ด์งˆ ์ˆ˜ ์žˆ๋‹ค)

๊ทธ๋Ÿผ์—๋„ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ??
: ํ”„๋กœ๊ทธ๋žจ์˜ ๋น„์ •์ƒ ์ข…๋ฃŒ๋‚˜ ์‹œ์Šคํ…œ์˜ ๋ถˆ์•ˆ์ •์„ ๋ฐฉ์ง€ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ๋‹ค. ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์ œํ•œ์ ์ธ ํ™˜๊ฒฝ์—์„œ๋Š” ์Šค์™‘ ๊ณต๊ฐ„์„ ์ ์ ˆํžˆ ์„ค์ •ํ•ด๋‘๋Š” ๊ฒƒ์ด ์ข‹๋‹ค!!

 

  1.  dd ๋ช…๋ น์–ด๋กœ swap ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น

    dd : ๋””์Šคํฌ ๋ณต์‚ฌ ๋„๊ตฌ๋กœ์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ€ํ™˜ํ•˜๊ณ  ๋ณต์‚ฌ
    if=/dev/zero : ์ž…๋ ฅ ํŒŒ์ผ๋กœ /dev/zero๋ฅผ ์‚ฌ์šฉ
    of=/swapfile : ์ถœ๋ ฅ ํŒŒ์ผ๋กœ /swapfile์„ ์ง€์ •
    bs=128M: ๋ธ”๋ก ์‚ฌ์ด์ฆˆ๋กœ 128 ๋ฉ”๊ฐ€ ๋ฐ”์ดํŠธ๋ฅผ ์ง€์ •(ํ•œ๋ฒˆ์— 128MB์˜ ๋ฐ์ดํ„ฐ ๋ธ”๋ก์„ ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ)
    count=16 : ๋ธ”๋ก์„ ์ด 16๋ฒˆ ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ(2GB์˜ ์Šค์™‘ ํŒŒ์ผ์ด ์ƒ์„ฑ๋œ๋‹ค)
sudo dd if=/dew/zero of=/swapfile bs=128M count= 16

 

 2. ์ƒ์„ฑํ•œ swapfile์˜ ๊ถŒํ•œ(์ฝ๊ธฐ, ์“ฐ๊ธฐ)๋ฅผ ์—…๋ฐ์ดํŠธ :๋ณด์•ˆ์ƒ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ ‘๊ทผ ๊ถŒํ•œ์ด ์—†์–ด์•ผ ํ•จ!

sudo chmod 600 /swapfile

 

3. mkswap ๋ช…๋ น์–ด๋กœ swap ๊ณต๊ฐ„์„ ์ƒ์„ฑ : ์Šค์™‘ ๊ณต๊ฐ„์œผ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์Šค์™‘ ํŒŒ์ผ์„ ์„ค์ •

sudo mkswap /swapfile

 

4. ์Šค์™‘ ํ™œ์„ฑํ™” : ์‹œ์Šคํ…œ์— ์Šค์™‘ ํŒŒ์ผ์„ ํ™œ์„ฑํ™”

sudo swapon /swapfile


5. /etc/fstab ํŒŒ์ผ์„ ํŽธ์ง‘ํ•˜์—ฌ ๋ถ€ํŒ… ์‹œ ์Šค์™‘ ํŒŒ์ผ์„ ์‹œ์ž‘ํ•˜๊ฒŒ๋” ํ•จ

sudo vi /etc/fstab

 

6, ์Šค์™‘ ํŒŒ์ผ์„ ์‹œ์Šคํ…œ ๋ถ€ํŒ… ์‹œ ์ž๋™์œผ๋กœ ๋งˆ์šดํŠธ ํ•˜๋„๋ก ์„ค์ •

/swapfile swap swap sw 0 0

 

์ฐธ๊ณ 

 

https://samgyeobsal123.tistory.com/entry/PuTTY-PuTTY-Key-Generator-%EC%82%AC%EC%9A%A9%EB%B2%95

 

[PuTTY] PuTTY Key Generator ์‚ฌ์šฉ๋ฒ•

ํ•„์š”์‹œ aws์—์„œ ์ œ๊ณตํ•œ ํ”„๋ผ์ด๋น— ํ‚ค ํŒŒ์ผ์„ PuTTY์— ๋งž๋Š” ํ™•์žฅ์ž์ธ PPK๋กœ ๋ณ€ํ™˜ํ•ด์•ผ ํ•  ๋•Œ๊ฐ€ ์žˆ๋‹ค. PuTTY๋ฅผ ์„ฑ๊ณต์ ์œผ๋กœ ์„ค์น˜ํ–ˆ์œผ๋ฉด PuTTY Key Generator (์ดํ•˜ ํ‚ค์  )์„ ์‹คํ–‰ํ•˜๋ฉด ์•„๋ž˜ ํ™”๋ฉด์ด ๋œฌ๋‹ค. Load๋ฅผ ๋ˆŒ

samgyeobsal123.tistory.com

puttygen ์‚ฌ์šฉ๋ฒ•...

 

 

https://calvinjmkim.tistory.com/20

 

PEMํŒŒ์ผ์„ PPK๋กœ ๋ณ€๊ฒฝํ•˜๊ธฐ (PEM to PPK)

์œˆ๋„์šฐ์ฆˆ์—์„œ ๊ฐ„๋‹จํ•œ ํ„ฐ๋ฏธ๋„ ํˆด์„ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์„ ๋•Œ ๊ฐ€์žฅ ๋จผ์ € ์ƒ๊ฐ๋‚˜๋Š” ํˆด์ด Putty์ด๋‹ค. ๊ธฐ๋ณธ์ ์ธ ๊ธฐ๋Šฅ๋งŒ ๊ฐ–์ถ”๊ณ  ์žˆ๊ณ , ๊ฐ„๋‹จํ•˜๊ณ , ์„ค์น˜ํ•  ํ•„์š”๋„ ์—†๊ณ , ์šฉ๋Ÿ‰๋งˆ์ € ์ž‘์€ ๊ฒƒ์ด ๊ทธ ๋งค๋ ฅ์ด ์•„๋‹๊นŒ ์‹ถ

calvinjmkim.tistory.com

ppk๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ์ด์œ ..

728x90
๋ฐ˜์‘ํ˜•

+ Recent posts