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 Server / GUI 설치하는 방법

Ubuntu Server / GUI 설치하는 방법

Ubuntu Server는 CLI(Command Line Interface) 환경으로 설치된다. 그런데 어떤 작업은 GUI(Graphical Uer Interface) 환경에서 하는 것이 편하다. 만약 GUI 환경이 필요하다면 설치하여 사용할 수 있다. GUI 패키지에는 kubuntu-desktop lubuntu-desktop ubuntu-desktop ubuntu-desktop-minimal xubuntu-desktop 등이 있다. 주로 ubuntu-desktop 또는 ubuntu-desktop-minimal을 사용하는 듯 하다. 예를 들어 ubuntu-desktop-minimal을 설치한다면, 다음과 같이 명령하면 된다. apt install ubuntu-desktop-minimal Minimal임에도 불구하고 꽤 많은 저장소 공간이 필요하다. After this ...

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

Ubuntu 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 Server / vsftpd로 FTP 서버 구축하기

Ubuntu Server / 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 방화벽을 사용 중이라면 다음과 같이 명령하여 포트를 열어줍니다. ufw ...

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

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 18.04 / 빠르게 다운로드하는 방법

Ubuntu 18.04 / 빠르게 다운로드하는 방법

우분투 다운로드 우분투 다운로드는 보통 우분투 홈페이지에서 합니다. 상단의 Downloads 메뉴를 클릭하고 안내를 따라가면 됩니다. 그런데, 우분투 홈페이지를 통해 다운로드를 받으면 전송 속도가 느릴 수 있습니다. 만약 너무 느리다면 가까운 미러 사이트에 직접 접속하여 다운로드해보세요. 빠르게 다운로드를 할 수 있습니다. 카카오 서버 한국이라면 카카오 서버가 빠릅니다. 우분투 페이지로 간 다음 원하는 버전을 선택합니다. 데스크톱 이미지와 ...

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

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

네트워크 설정 파일은 /etc/network/interfaces이다. 우분투를 DHCP로 설치했다면 설정 파일의 내용은 다음과 비슷하게 되어 있다. # The primary network interface auto enp0s3 iface enp0s3 inet dhcp 이를 다음처럼 변경하고 저장한다. xxx.xxx.xxx.xxx는 네트워크 환경에 맞게 수정한다. # The primary network interface auto enp0s3 iface enp0s3 inet static address xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx dns-nameservers xxx.xxx.xxx.xxx 다음과 같이 명령하여 네트워크를 재시작한다. systemctl restart networking.service 만약 위와 같이 해도 ...

Ubuntu Server / Apache / 사용자 인증 만드는 방법

Ubuntu Server / Apache / 사용자 인증 만드는 방법

웹사이트의 콘텐츠를 특정 사용자만 볼 수 있게 하는 방법은 여러 가지가 있습니다. 만약 웹서버에 대한 충분한 권한이 있다면, Apache를 이용하여 구현할 수 있습니다. 비밀번호 파일 만들기 비밀번호 파일은 htpasswd 명령어로 만듭니다. /home/auth/ 디렉토리에 passwords라는 이름의 파일을 만들고, 사용자 user1의 비밀번호를 정하고 싶다면 다음과 같이 명령합니다. htpasswd -c /home/auth/passwords user1 .htaccess 파일 만들기 웹사이트의 루트 디렉토리에 ...

Ubuntu Server / apt / 패키지 설치, 삭제, 업그레이드하는 명령어

Ubuntu Server / apt / 패키지 설치, 삭제, 업그레이드하는 명령어

Ubuntu에서 패키지를 관리하는 명령어는 여러 가지가 있습니다. 그 중 널리 사용되는 것은 apt-get과 apt입니다. 아래는 apt를 이용하여 패키지를 설치하고 삭제하고 업그레이드하는 방법입니다. 대부분의 경우 apt-get을 사용해도 작동합니다. APT 사용법 패키지 목록을 갱신합니다 apt update 모든 패키지를 최신 버전으로 업그레이드합니다. apt upgrade abc 패키지를 설치합니다. 의존성있는 패키지도 함께 설치합니다. apt install abc abc 패키지를 삭제합니다. 설정 파일 등은 삭제하지 ...

Ubuntu 18.04 / 백신 프로그램 ClamAV 설치 및 사용법

Ubuntu 18.04 / 백신 프로그램 ClamAV 설치 및 사용법

ClamAV ClamAV는 우분투에 사용할 수 있는 백신 프로그램입니다. 패키지에 포함되어 있으므로 쉽게 설치하고 사용할 수 있습니다. 설치 apt install clamav 사용법 데이터베이스 업데이트 데이터베이스 업데이트는 자동으로 됩니다. 만약 수동으로 업데이트를 해야한다면 freshclam 와 같이 명령합니다. 만약 Can't find or parse configuration file /etc/clamav/clamd.conf와 같은 에러가 난다면 대몬을 설치해야 한다고 합니다. apt install clamav-daemon 에러가 나도 바이러스 정의는 업데이트되는 거 같습니다. 꼭 설치해야 ...

Ubuntu Server / 업그레이드 하는 방법

Ubuntu Server / 업그레이드 하는 방법

Ubuntu 새 버전이 나오면 어떻게 업그레이드를 할까? 새로 설치하고 다시 설정하는 게 제일 좋지만, 설정할 게 많다면 바로 업그레이드를 할 수도 있다. 업그레이드는 do-release-upgrade 명령어로 한다. do-release-upgrade -h Usage: do-release-upgrade Options: -h, --help show this help message and exit -V, ...