This is an old revision of the document!
Setting Up Ubuntu Server (우분투 서버 설정하기)
Ubuntu Server 설치 후 필요한 기본 설정
패키지 업데이트 및 업그레이드
- 패키지 설치 시 반드시 먼저 실행
sudo apt update && sudo apt upgrade -y- 업데이트 실패 시 dns 확인 및 설정 1)
sudo vi /etc/network/interfaces- 내용 추가
dns-nameservers 8.8.8.8 8.8.4.4 1.1.1.1
sudo vi /ect/resolv.conf- 내용 추가
nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 1.1.1.1
/ect/resolv.conf파일 수정이 안될 경우 2)sudo rm /etc/resolv.conf ;# to remove the symlink sudo vi /etc/resolv.conf ;# to create a regular file
Set Timezone (타임 존 세팅)
sudo dpkg-reconfigure tzdata
net-tools, openssh server 설치
sudo apt install net-tools openssh-server -y
firewall 설치 및 설정
- ufw 패키지 설치 (설치 전 패키지 업데이트)
sudo apt install ufw -y - ufw 사용 설정
sudo ufw enable - ufw 상태 확인
sudo ufw status - ssh 허용 설정
sudo ufw allow ssh- 예제) 3389 포트 허용 설정
sudo ufw allow from any to any port 3389
- ufw 설정 적용
sudo ufw reload
rsync 서버 설정
cron 설정
- cron 설정 실행
crontab -e - 내용 편집
- 예제1) rsync 매일 오전 3시에 실행
0 3 * * * rsync -avrzp --delete {user}@{url}::{rsync section name} {destination directory} - 예제2) ddns 업데이트 실행
*/5 * * * * /usr/local/bin/curl -s 'https://ddns.dnszi.com/set.html?user={user id}&auth={auth key}&domain={domain}&record='
- sudo 없이 cron 실행 설정
sudo ALL=NOPASSWD: /usr/sbin/service cron start sudo systmctl daemon-reload
네트워크 드라이브 연결 및 설정
- 네트워크 드라이브 연결에 필요한 패키지 설치 (설치 전 패키지 업데이트)
sudo apt install nfs-common cifs-utils -y - 마운트할 디렉토리 생성
sudo mkdir -p /mnt/{name to mount} - 디렉토리 권한 설정
sudo chmod 777 /mnt/{name to mount} - 드라이브 마운트
- samba
mount -t cifs -o rw,vers=3.0,credentials=/etc/samba/.smbcreds {source url} {destination directory} - nfs
mount -t nfs {source url} {destination directory}
- 부팅시 자동 마운트 설정
- 인증 정보 파일 생성
sudo vi /etc/samba/.smbcreds- 내용 편집
username={user id} password={passwrod}
- file system table 편집
sudo vi /etc/fstab//{source ip}/{directory} {destination directory} cifs credentials=/etc/samba/.smbcred,uid=34,gid=34,defaults 0 0
rdp(xrdp) 설치
- xrdp 상태 확인
sudo systemctl status xrdp - xrdp 패키지 설치 (설치 전 패키지 업데이트)
sudo apt install xrdp - xrdp 데몬 실행
sudo systemctl enable --now xrdp - xrdp 사용자 추가
sudo adduser xrdp ssl-cert