dnf-makecache disable

CentOS 8.x 에서는 주기적으로 dnf-makecache.service 가 실행되어 dnf 의 최신 메타데이터를 유지한다.

최신 메타테이터가 갱신될때 /var/log/message 에 아래와 같은 로그가 기록된다.

Aug 10 13:07:37 hostname systemd[1]: Starting dnf makecache...
Aug 10 13:07:39 hostname dnf[1222]: CentOS-8 - AppStream                            5.7 kB/s | 4.3 kB     00:00
Aug 10 13:07:39 hostname dnf[1222]: CentOS-8 - Base                                 7.3 kB/s | 3.9 kB     00:00
Aug 10 13:07:40 hostname dnf[1222]: CentOS-8 - Extras                               4.6 kB/s | 1.5 kB     00:00
Aug 10 13:07:41 hostname dnf[1222]: Extra Packages for Enterprise Linux Modular 8 -  10 kB/s | 9.1 kB     00:00
Aug 10 13:07:41 hostname dnf[1222]: Extra Packages for Enterprise Linux 8 - x86_64   14 kB/s | 9.0 kB     00:00
Aug 10 13:07:42 hostname dnf[1222]: Metadata cache created.
Aug 10 13:07:42 hostname systemd[1]: Started dnf makecache.

최신 메타데이터 유지를 중지하기 위해서는 systemd timer으로 등록되어 있는 dnf-makecache.timer를 중지하면된다.

systemctl disable --now dnf-makecache.timer

Docker install for CentOS 8.x

Docker-ce 는 아직 CentOS 8.x 버전을 정식 지원하지 않아(2020/03/23 기준) Docker.com CentOS 설치가이드 에 설명된 절차로 설치시 containerd.io 패키지 호환성 에러가 발생한다.

docker-ce 패키지 설치 전 최신 containerd.io 패키지를 수동으로 설치 후 docker-ce 설치를 진행하면 에러없이 최신 docker-ce 를 설치할 수 있다.

$ dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

참고 : https://medium.com/@sindepal/docker-sertting-for-centos-8-f1ecae57a98c

tmpfs /run/user/???


OS : CentOS 7.x

실제 메모리의 10%(기본값)가 사용자 tmpfs 으로 잡혀 있다.

>$ df -h | grep tmpfs
tmpfs           794M     0  794M   0% /run/user/501

문제는 없지만 사용하지도 않고 보기 싫으니 용량을 줄여보자.

>$ /etc/systemd/logind.conf
#RuntimeDirectorySize=10%
RuntimeDirectorySize=32M

아래 명령어를 시작 하였지만 적용이 되지 않았다.

>$ systemctl daemon-reexec
>$ systemctl daemon-reload

할수 없이 리부팅 해본다. 적용 되었다.

>$ df -h | grep tmpfs
tmpfs            32M     0   32M   0% /run/user/501

참고 : https://www.freedesktop.org/software/systemd/man/logind.conf.html

ssh 접속 지연

원격으로 ssh 접속시 접속지연 현상
sshdconfig 설정 파일의 UseDNS 옵션을 no 으로 수정 *(기본값 : yes)_*

] vi /etc/ssh/sshd_config
# ... 이전 생략 ...
UseDNS no
# ... 이후 생략 ...

] service sshd restart 
# or 
] systemctl restart sshd

참고 자료
http://develop.sunshiny.co.kr/988

letsencrypt – certbot(python) ssl 적용 (1부)

  • 환경
    CentOS 7 / Python 2.7
  • 시작하기전에
    환경이나 조건별로 설치 방법이 다른 부분이 있으니 certbot 을 참고 하기 바랍니다.
    본 글은 python pip 를 사용하여 certbot 을 설치 하는 방법으로 certbot 내용과 다른점이 있으니 참고 사항으로만 확인 부탁드립니다.
  • python pip 를 이용한 certbot 설치
    ] pip install certbot

letsencrypt SSL 신규 발행

] certbot certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log
#
How would you like to authenticate with the ACME CA?
--------------------------------------------------
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
--------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
##
# 1 : 임시 웹서버를 구동하여 진행
# 2 : 사용중인 웹서버를 이요하여 진행 
##
Plugins selected: Authenticator webroot, Installer None
Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c'
to cancel): test.com
##
# 인증서를 발급받을 도메인 주소
##
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for test.com
#
Select the webroot for test.com:
--------------------------
1: Enter a new webroot
--------------------------
Press 1 [enter] to confirm the selection (press 'c' to cancel): 1
Input the webroot for pic.huubro.com: (Enter 'c' to cancel): /tmp/www
Waiting for verification...
Cleaning up challenges
#
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/test.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/test.com/privkey.pem
Your cert will expire on 2018-02-04. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by: 
Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
Donating to EFF:                    https://eff.org/donate-le

인증서 발급 완료
/etc/letsencrypt/live/{도메인} 디렉토리에 아래 (인증서)파일이 생성됨을 확인

] ls /etc/letsencrypt/liv/test.com
privkey.pem  
fullchain.pem  
chain.pem  
cert.pem  
  • 웹서버 SSL 설정
    생락
  • letsencrypt SSL 갱신
    ] certbot renew

2부에서 계속