시도 배경
VPN을 사용해서 출발지 국가를 변경하고 싶어졌다. 무료 VPN은 위험하다는 얘기도 많고, 상용 VPN을 쓰자니 월 구독료가 아쉬워서 'aws Cloud를 활용하여 해당 Region에 VDI를 구성하고 사용할 때만 쓰고 Off하면 어떨까?' 라는 생각을 하게 됐다.
방안1.
aws에서 제공하는 VDI 서비스 Amazon Workspace의 비용계산을 돌려보니 월 고정 비용 같은 것이 붙는 것이 확인된다. 패스~
(1 instance(s) x 10 USD monthly) + (1 instance(s) x 0.42 USD hourly x 8 시간 in a month) = 13.3600 USD
WorkSpaces 비용 (월별): 13.36 USD
방안2.
서비스 사용에 따른 월 고정비용이 발생하다보니 배보다 배꼽이 큰 경우가 되버리고, 그냥 원하는 Region에 EC2를 직접 구성하여 VPN 역할을 수행할 수 있는지 확인해보기로 했다.
우선 AMI는 Ubuntu Desktop이 있었으나, 별도 사용료가 발생해서 Ubuntu Server로 생성하고 GUI를 별도 설치 진행하기로 했다. 상세 Spec은 아래 링크를 참조하여 생성하였고, ARM도 지원하는 것 같아 Graviton으로 Instance Type을 지정했다.
Ubuntu Desktop System Require
[참고] https://ubuntu.com/download/desktop#system-requirements
https://ubuntu.com/download/desktop#system-requirements
ubuntu.com
우선 공식 홈페이지에서 요구하는 조건으로 EC2 설정한 요약은 아래 이미지와 같다.
생성된 EC2에 ssh로 접근을 하니 정상적으로 접근이 되었다.
➜ mango ssh -i "mango-vdi-key.pem" ubuntu@ec2-13-232-235-72.ap-south-1.compute.amazonaws.com
Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-1008-aws aarch64)
..생략..
상세 설정
이제 GUI 세팅을 해보자. 주의사항으로는 TightVNC 설치시 EC2를 재기동 필요했다는 점 정도이다.
[참고] https://ubuntu.com/tutorials/ubuntu-desktop-aws#2-setting-up-tightvnc-on-aws
https://ubuntu.com/tutorials/ubuntu-desktop-aws#2-setting-up-tightvnc-on-aws
ubuntu.com
ubuntu@ip-10-0-0-9:~$ sudo apt update
Get:1 http://ap-south-1a.clouds.ports.ubuntu.com/ubuntu-ports noble InRelease [256 kB]
..생략..
Reading state information... Done
32 packages can be upgraded. Run 'apt list --upgradable' to see them.
ubuntu@ip-10-0-0-9:~$ sudo apt install ubuntu-desktop
Reading package lists... Done
..생략..
No VM guests are running outdated hypervisor (qemu) binaries on this host.
ubuntu@ip-10-0-0-9:~$ sudo apt install tightvncserver
Reading package lists... Done
..생략..
No VM guests are running outdated hypervisor (qemu) binaries on this host.
ubuntu@ip-10-0-0-9:~$ sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
Reading package lists... Done
..생략..
No VM guests are running outdated hypervisor (qemu) binaries on this host.
VNC server 패스워드를 설정한다.
ubuntu@ip-10-0-0-9:~$ vncserver :1
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
xauth: file /home/ubuntu/.Xauthority does not exist
New 'X' desktop is ip-10-0-0-9:1
Creating default startup script /home/ubuntu/.vnc/xstartup
Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ip-10-0-0-9:1.log
~/.vnc/xstartup 파일을 가이드에 맞춰 수정하고 재기동을 수행한다.
ubuntu@ip-10-0-0-9:~$ vi ~/.vnc/xstartup
ubuntu@ip-10-0-0-9:~$ vncserver -kill :1
Killing Xtightvnc process ID 2913
ubuntu@ip-10-0-0-9:~$ vncserver :1
New 'X' desktop is ip-10-0-0-9:1
Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ip-10-0-0-9:1.log
Security Group에 VNC port가 허용된 것을 확인하고 사용하는 브라우저에서 5901 포트로 접근을 하면 VNC Server 설정한 패스워드를 요청한다.
드디어 Ubuntu Desktop 확인이 가능하다.
점검
설치되어있는 브라우저(Firefox)를 이용하여 IP 확인을 한 결과, EC2가 있는 Region으로 확인된다. 이래저래 저렴하게 이용하려다보니 복잡해졌는데, 아무튼 성공.
Trouble shooting
Ubuntu Desktop Grey Screen 이슈로 한참 헤맸다. 그런데 막상 CLI로 Firefox 실행할 때 나오는 에러를 구글링하니 아래와 같이 간단한 조치 방법이 있었다.
ubuntu@ip-10-0-0-9:~/.vnc$ XAUTHORITY=$HOME/.Xauthority
ubuntu@ip-10-0-0-9:~/.vnc$ export XAUTHORITY
ubuntu@ip-10-0-0-9:~/.vnc$ vncserver -kill :1
Killing Xtightvnc process ID 12814
ubuntu@ip-10-0-0-9:~/.vnc$ vncserver :1
New 'X' desktop is ip-10-0-0-9:1
Starting applications specified in /home/ubuntu/.vnc/xstartup
Log file is /home/ubuntu/.vnc/ip-10-0-0-9:1.log
'Engineering' 카테고리의 다른 글
ssh-keygen을 활용한 AWS Transfer Family(sftp) 연동 (0) | 2023.08.21 |
---|