Ubuntu Server / Let’s Encrypt 무료 SSL 인증서 발급 받기

Ubuntu Server에서 Apache Web Server를 사용하는 경우 Let’s Encrypt 인증서 발급 받는 방법이다.

Apache용 Certbot 설치

Ubuntu Server 20.04, Ubuntu Server 22.04

snap install core
snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot

Ubuntu Server 18.04

apt install software-properties-common
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt update
apt upgrade
apt install certbot python3-certbot-apache

Ubuntu Server 16.04

add-apt-repository ppa:certbot/certbot
apt update
apt upgrade
apt install python-certbot-apache

인증서 발급

  • abc.com 인증서 발급하고 설정 파일 생성
certbot --apache -d abc.com
  • abc.com과 www.abc.com 인증서 동시 발급하고 설정 파일 생성
certbot --apache -d abc.com -d www.abc.com
  • abc.com 인증서만 발급
certbot certonly --apache -d abc.com
  • DNS 레코드 인증으로 abc.com 와일드카드 인증서 발급
certbot certonly --manual --preferred-challenges dns -d "*.abc.com" -d "abc.com"

인증서 갱신

Let’s Encrypt 인증서 유효 기간은 90일이고, 만료일 30일 전부터 갱신이 가능하다.

  • 갱신 가능한 인증서 갱신
certbot renew

인증서 삭제

  • abc.com 인증서 삭제
certbot delete --cert-name abc.com

Cron으로 자동 갱신

  • crontab에 다음을 추가하면 매일 새벽 4시에 갱신을 시도한다.
0 4 * * * certbot renew --post-hook "service apache2 reload"
같은 카테고리의 다른 글

Ubuntu 20.04 Server / 고정 IP 설정하는 방법

네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일이다. DHCP로 설치했다면, 설정 파일 내용은 다음과 비슷하게 되어 있다. # This is the network config written by 'subiquity' network: ethernets: enp0s3: dhcp4: true version: 2 다음과 같이 수정하고 저장한다. IP 등은 네트워크 환경에 맞게 적절히 ...

Ubuntu Server / Let’s Encrypt 무료 SSL 인증서 발급 받기

Ubuntu Server에서 Apache Web Server를 사용하는 경우 Let’s Encrypt 인증서 발급 받는 방법이다. Apache용 Certbot 설치 Ubuntu Server 20.04, Ubuntu Server 22.04 snap install core snap refresh core snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot Ubuntu Server 18.04 apt install software-properties-common add-apt-repository universe add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install certbot python3-certbot-apache Ubuntu Server 16.04 add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install python-certbot-apache 인증서 발급 abc.com 인증서 ...

Ubuntu 20.04 Server / hostname 확인하는 방법, 변경하는 방법

Ubuntu 20.04 Server / hostname 확인하는 방법, 변경하는 방법

hostname 확인하는 방법 방법 1 - 명령어로 확인하기 다음과 같이 명령하면 hostname을 출력한다. hostname 방법 2 - 설정 파일 열어서 확인하기 /etc/hostname 파일에 hostname이 있다. cat /etc/hostname hostname 변경하는 방법 방법 1 - 명령어로 변경하기 다음과 같이 명령하면 hostname이 abc로 바뀐다. hostnamectl set-hostname abc 방법 2 - 설정 파일 열어서 변경하기 텍스트 에디터로 /etc/hostname 파일을 열어서 내용을 abc로 바꾸면 hostname이 abc로 바뀐다. 재부팅 재부팅을 하면 변경사항이 ...

Ubuntu 22.04 Server / 고정 IP 설정하는 방법

Ubuntu 22.04 Server / 고정 IP 설정하는 방법

설정 파일 수정하기 네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일이다. DHCP로 설치했다면, 설정 파일 내용은 다음과 비슷하게 되어 있다. # This is the network config written by 'subiquity' network: ethernets: eth0: dhcp4: true version: 2 다음과 같이 수정하고 저장한다. IP 등은 네트워크 환경에 ...

Ubuntu 18.04 Server / phpMyAdmin 설치하는 방법

Ubuntu 18.04 Server / phpMyAdmin 설치하는 방법

phpMyAdmin은 MySQL, MariaDB를 웹브라우저에서 관리할 수 있게 해주는 소프트웨어입니다. Ubuntu 18.04에 phpMyAdmin을 설치하고 설정하는 방법을 알아보겠습니다. 설치 apt install phpmyadmin 설치하는 과정에서 몇 가지 질문을 합니다. 사용하는 웹서버를 선택합니다. 비밀번호를 정하고... 다시 한 번 입력합니다. Yes를 선택하고 진행하면 설치가 끝납니다. 접속 웹브라우저로 서버 주소에 phpmyadmin을 붙여서 접속합니다. MySQL 또는 MariaDB의 사용자명과 암호를 입력해서 로그인하는데... root 계정으로 접속이 불가능할 수도 있습니다. 만약 root으로 ...

Ubuntu 20.04 Desktop / 설치하기

Ubuntu 20.04 Desktop / 설치하기

다음은 Ubuntu 20.04 Desktop을 설치하는 과정입니다. Windows를 설치하는 것만큼 쉽고, 시간도 오래 걸리지 않습니다. Ubuntu Desktop을 다운로드하고 설치용 CD 또는 USB를 만듭니다. Rufus를 사용하면 편합니다. 컴퓨터에 설치용 미디어를 장착하고 부팅합니다. 잠시 기다리면... GUI로 설치를 시작합니다. 언어를 한국어로 정하고 를 클릭합니다. 키보드 레이아웃을 정하고 를 클릭합니다. 일반 설치와 최소 설치 중 하나를 선택합니다. 최소 설치를 하고 나중에 ...

Ubuntu 16.04 / 메모

PHP intl 설치 apt install php-intl service apache2 reoad APCu 설치 apt install php-apcu service apache2 reload

Ubuntu 24.04 Server / 고정 IP 설정하는 방법

네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일이다. # ll /etc/netplan total 12 drwxr-xr-x 2 root root 4096 Apr 27 23:00 ./ drwxr-xr-x 108 root root 4096 Apr 27 23:06 ../ -rw------- 1 root root 389 Apr 27 23:00 50-cloud-init.yaml DHCP라면 설정 파일이 다음과 비슷하게 되어 있다. # This file is ...

Ubuntu 22.04 Server / SSH / 포트 변경하는 방법

보안 상의 이유로 SSH 포트는 변경하는 것이 좋다. Ubuntu 22.04 Server에서 SSH 포트 변경하는 방법은 다음과 같다. 1980으로 변경한다고 가정한다. /etc/ssh/sshd_config에서 다음의 코드를... #Port 22 다음으로 변경한다. Port 1980 방화벽이 활성화되어 있다면 1980 포트를 열어준다. ufw allow 1980/tcp SSH 서비스를 다시 시작한다. systemctl restart ssh SSH 서비스를 다시 시작해도 적용되지 않으면, 컴퓨터를 다시 시작한다.

Ubuntu 24.04 Server / root 계정으로 로그인할 수 있게, ssh 접속할 수 있게 설정하는 방법

Ubuntu는 설치할 때 일반 사용자 계정만 만들고, 관리자 권한이 필요할 때는 sudo를 이용한다. 만약 보안에 문제가 없는 경우라면 root 계정으로 로그인하는 게 작업하는 게 편하다. root 계정으로 로그인할 수 있게 설정하는 방법 일반 사용자 계정으로 로그인한다. 다음과 같이 명령하여 root 계정의 비밀번호를 만들면 root 계정으로 로그인할 수 있다. # sudo passwd root root 계정으로 ssh ...