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

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

Apache용 Certbot 설치

Ubuntu Server 20.04, Ubuntu Server 22.04

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
snap install core
snap refresh core
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
snap install core snap refresh core snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot
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"
  • 와일드 카드 인증서 발급. DNS에 레코드를 추가하는 과정이 있다.
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 Server / 22.04 / 네트워크 세팅에 이더넷(Wired) 보이지 않을 때 해결 방법

Ubuntu Server / 22.04 / 네트워크 세팅에 이더넷(Wired) 보이지 않을 때 해결 방법

우분투 설정의 네트워크에 Wired가 보이지 않는다. 그것이 보여야 GUI로 IP 설정이 가능한데 말이다. 이를 보이게 하는 방법이 여러 가지가 있는 거 같은데, 내가 성공한 방법은... /etc/netplan/00-installer-config.yaml의 내용은 다음처럼 생겼을 것이다. # This is the network config written by 'subiquity' network: ethernets: eth0: dhcp4: true ...

Ubuntu 18.04 Server / 설치하기

Ubuntu 18.04 Server / 설치하기

다운로드 Ubuntu Server 다운로드 페이지는 다음과 같다. https://ubuntu.com/download/server 최신 버전에 대한 안내가 주로 있으므로, 구버전을 다운로드하고 싶다면 아래 링크가 편하다. https://mirror.kakao.com/ubuntu-releases/ 가상 머신에 설치한다면 다운로드한 ISO 파일을 그대로 사용하면 되고, 물리 서버에 설치한다면 Rufus 같은 툴을 이용하여 부팅 USB를 만든다. 설치 설치 미디어로 부탕하고 잠시 기다리면 언어를 선택하는 화면이 나온다. 원하는 언어를 선택하고 엔터키를 누른다. 키보드 레이아웃을 정하고 ...

Ubuntu 18.04 Server / Nginx, PHP, MariaDB 설치하고 설정하기

Ubuntu 18.04 Server / Nginx, PHP, MariaDB 설치하고 설정하기

Nginx 설치 Nginx를 설치합니다. # apt install nginx 만약 방화벽을 사용하고 있다면 포트를 열어줍니다. # ufw allow 'Nginx Full' 서버 주소로 접속했을 때 다음과 같이 나오면 제대로 된 것입니다. 시작, 정지 등 Nginx를 시작합니다. # systemctl start nginx Nginx를 멈춥니다. # systemctl stop nginx Nginx를 재시작합니다. # systemctl restart nginx Nginx를 다시 로드합니다. # systemctl reload nginx Nginx를 설치하면 부팅 시 자동으로 시작하게 설정됩니다. 만약 자동 ...

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 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 14.04 / LESS 설치하는 방법

우분투 14.04에 LESS를 설치하는 방법을 메모합니다. Node.js 설치 apt-get install nodejs NPM 설치 apt-get install npm LESS 설치 npm install -g less less-plugin-clean-css /usr/local/bin/lessc 파일 첫 줄에 다음과 같은 코드가 있습니다. #!/usr/bin/env node 다음처럼 바꿉니다. #!/usr/bin/env nodejs

Ubuntu Server 22.04 / vsftpd로 FTP 서버 구축하기

vsftpd vsftpd(Very Secure FTP Daemon)는 유닉스와 리눅스에서 사용할 수 있는 가벼운 FTP 서버입니다. 주요 특징은 다음과 같습니다. Virtual IP configurations Virtual users Standalone or inetd operation Powerful per-user configurability Bandwidth throttling Per-source-IP configurability Per-source-IP limits IPv6 Encryption support through SSL integration 설치 vsftpd는 우분투 패키지에 포함되어 있으므로 다음과 같이 명령하여 설치할 수 있습니다. # apt install vsftpd 방화벽을 사용 중이라면 다음과 같이 명령하여 포트를 ...

Ubuntu 20.24 Server / Apache, PHP, MariaDB 설치하는 방법

Ubuntu 20.24 Server / Apache, PHP, MariaDB 설치하는 방법

Ubuntu Server에 웹서버 Apache, 웹프로그래밍 언어 PHP, 데이터베이스 MariaDB를 설치하는 방법입니다. 웹서버 운영을 위한 최소한의 설치로, 실제로 서비스할 때는 더 많은 패키지가 필요할 수 있습니다. 설치 Apache, PHP, MariaDB를 설치합니다. php-mysql은 PHP와 MariaDB 연동을 위한 패키지입니다. # apt install apache2 mariadb-server php php-mysql MariaDB 설정 다음과 같이 명령하여 몇 가지 설정을 합니다. # mysql_secure_installation MariaDB의 root 계정 ...

Ubuntu 20.04 Desktop / 설치하기

Ubuntu 20.04 Desktop / 설치하기

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

Ubuntu 20.04 Server / 설치하기

Ubuntu 20.04 Server / 설치하기

다운로드 Ubuntu Server 다운로드 페이지는 다음과 같다. https://ubuntu.com/download/server 최신 버전에 대한 안내가 주로 있으므로, 구버전을 다운로드하고 싶다면 아래 링크가 편하다. https://mirror.kakao.com/ubuntu-releases/ 가상 머신에 설치한다면 다운로드한 ISO 파일을 그대로 사용하면 되고, 물리 서버에 설치한다면 Rufus 같은 툴을 이용하여 부팅 USB를 만든다. 설치 설치 미디어로 부탕하고 잠시 기다리면 언어를 선택하는 화면이 나온다. 원하는 언어를 선택하고 엔터키를 누른다. 키보드 레이아웃을 선택한다. 네트워크 ...