2 min read

OCI 에서 우분투 생성직후에 해줘야 하는거(feat. ubuntu 24.04)

OCI 에서 우분투 생성직후에 해줘야 하는거(feat. ubuntu 24.04)
Photo by C Dustin / Unsplash

미니멀 버전을 설치했다.
풀버전 보다는 서버에 부하가 덜 가지 않을까 하는 막연한 생각에 ,.....

1. 업데이트, 업그레이드
- 이걸 해줘야 미니멀 버저는 레포설치가 가능해진다.


2. apt-get install -y vim net-tools tcpdump firewalld
- 기본 패키지


3. timedatectl set-timezone Asia/Seoul
- 서울 시간으로 바꿔주고
- timedatectl로 ntp 확인


4. ssh 22번이 아닌 포트 열기
- lastb로 보면 수많은 22번 포트 공격이 brute force로 들어오는걸 알수 있다.
대부분 중국 아니면 러시아 인듯
systemctl daemon-reload
systemctl enable --now ssh
- 24버전부터는 요렇게 해줘야 22번이 아닌 포트가 열린다.
vi /etc/ssh/sshd_config
- permit root login yes
- PasswordAuthentication yes

5. 확인
netstat -nltp


6. firewall 스크립트
매번 vm 생성할때마다 귀찮아서 하나 만들었다.


7. cp ~ubuntu/.ssh/authorized_keys ~/.ssh/authorized_keys
이걸 안해주면 root로 ppk파일로 접속이 안된다.

  1. 크론탭 설치, 자동업데이트 크론탭 설치
    apt install -y cron
    systemctl enable --now cron
    apt-get install cron-apt
    vi /etc/cron.d/cron-apt
    crontab -e
    00 04 * * 0 reboot - 일요일 새벽4시마다 재부팅
  2. 도커설치
    https://docs.docker.com/engine/install/ubuntu/


OCI에서 vm생성할때
puttygen으로 기존 ppk파일 가져와서 rsa키 복붙
생성하고 반드시 putty가 아닌 mobaterms로 접속하자
putty로 ppk가 잘 인식이 안되는 듯