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 22.04 Server / 백신 프로그램 ClamAV 설치 및 사용법

ClamAV ClamAV는 리눅스에서 사용할 수 있는 백신 프로그램이다. 우분투 패키지에 포함되어 있으므로 apt 명령으로 쉽게 설치하고 사용할 수 있다. 설치 # apt install clamav 사용법 데이터베이스 업데이트 clamav-freshclam 서비스를 중지한다. # systemctl stop clamav-freshclam freshclam 명령으로 업데이트한다. # freshclam clamav-freshclam 서비스를 시작한다. # systemctl start clamav-freshclam 검사 home 디렉토리와 그 하위 디렉토리를 검사한다. # clamscan -r /home 검사 결과는 다음처럼 나온다. ----------- SCAN SUMMARY ----------- Known viruses: ...

Ubuntu 18.04 Server / 시간대(time zone) 설정하는 방법

Ubuntu 18.04 Server / 시간대(time zone) 설정하는 방법

현재 서버의 시간대 확인 현재 서버에 설정된 시간대는 date 명령어로 확인할 수 있다. # date 시간대 설정 방법 1 - dpkg-reconfigure tzdata 시간대를 설정하고 싶다면 다음과 같이 명령한다. # dpkg-reconfigure tzdata 한국이라면 Asia를 선택하고 Seoul을 선택합니다. 시간대 설정 방법 2 - tzselect tzselect 명령으로 설정할 수 있다. 번호를 입력하여 시간대를 정한다. # tzselect Please identify a location so that time ...

Ubuntu 20.04 Server / GUI 설치하는 방법

Ubuntu 20.04 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 ...

Ubuntu 24.04 / 언어 변경하는 방법

현재 언어 확인하기 locale 명령어로 현재 언어를 확인할 수 있다. # locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= 언어 추가하기 사용 가능한 언어는 locale -a로 확인할 수 있다. # locale -a C C.utf8 en_US.utf8 POSIX 예를 들어 한국어를 추가하고 싶다면 아래와 같이 명령한다. # apt install language-pack-ko locale -a로 설치 확인을 한다. # locale -a C C.utf8 en_US.utf8 ko_KR.utf8 POSIX 언어 변경하기 다음과 같이 명령하면 사용하는 언어가 한국어로 바뀐다. update-locale LANG=ko_KR.utf8 로그아웃 후 다시 로그인하거나, 컴퓨터를 다시 시작하면 ...

Ubuntu 16.04 Server / PHP / 메모리 늘리는 방법

PHP 설정은 php.ini에서 한다. Ubuntu 16.04에서 php.ini의 위치는 /etc/php/7.0/apache2/php.ini 이다. PHP 버전에 따라 7.0은 다른 숫자일 수 있다. 메모리를 늘리기 위해 수정해야 할 것은 memory_limit이다. 기본값은 128M이다. 128을 적절히 변경한다. memory_limit = 128M 변경한 설정이 적용되도록 하려면 웹서버를 다시 시작하거나 다시 로드한다. Apache 웹서버라면 다음과 같이 명령하여 다시 시작할 수 있고, # service apache2 restart 다음과 같이 ...

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 24.04 Server / root 계정으로 로그인할 수 있게, ssh 접속할 수 있게 설정하는 방법

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

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 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 방화벽을 사용 중이라면 다음과 같이 명령하여 포트를 ...