Creative-Chan

Ubuntu 18.04에서 Chrome Remote Desktop 설정하기 본문

Programming/Linux

Ubuntu 18.04에서 Chrome Remote Desktop 설정하기

Creative.Chan 2022. 3. 23. 16:05

머신러닝 공부를 제대로 해보기 위해서 기존에 꼬여있는 서버 컴퓨터의 Ubuntu 재설치를 하면서 Ubuntu에서 원격 데스크탑을 활용할 수 있는 방법 중 하나인 Google Chrome의 Remote desktop을 설치하며, 설정 방법을 정리하고자 한다.

 

1. 구글 크롬 원격 데스크탑 사이트에서 chrome-remote-desktop_current_amd64.deb 파일을 다운로드 받은 뒤 실행하여 크롬 원격 데스크탑을 설치한다.

2. 크롬 원격 데스크탑을 설치해도 알수 없는 오류로 설정이 되지 않는데 이는 설정파일을 생성해주어야하기 때문이다. 아래 명령어를 통해 크롬 원격 데스크탑의 설정 폴더를 생성한다.

mkdir ~/.config/chrome-remote-desktop

3. 크롬 종료 후 재실행하면 원격 액세스를 설정이 활성화되며 컴퓨터 이름와 PIN 번호를 설정하여 사용한다.


Black screen이 떠서 마우스 커서만 보이면 GPU 호환이 되지 않는 것이므로 크롬의 설정에서 하드웨어 가속(Hardware acceleration)을 사용하지 않도록 한다.

위 방법으로 되지 않는다면 다음 명령을 통해 해결한다.

1. 사용자 계정을 chrome-remote-desktop 그룹에 추가한다. (username은 로그인 계정명)

sudo usermod -a -G chrome-remote-desktop username
  • usermod: group 'chrome-remote-desktop' does not exist
  • 위의 에러가 뜨면 더 이상 진행하지 않아도 무방하다

2. 설정 변경을 위해 크롬 원격 데스크탑을 정지한다.

/opt/google/chrome-remote-desktop/chrome-remote-desktop --stop

3. 문제 발생시 복구를 위해 크롬 원격 데스크탑 설정 파일을 백업한다.

sudo cp /opt/google/chrome-remote-desktop/chrome-remote-desktop /opt/google/chrome-remote-desktop/chrome-remote-desktop.orig

4. 현재 디스플레이의 번호를 확인한다.

echo $DISPLAY

5. 설정파일을 열어 내용을 수정한다.

sudo gedit /opt/google/chrome-remote-desktop/chrome-remote-desktop
FIRST_X_DISPLAY_NUMBER = 0

- echo $DISPLAY 결과로 숫자 변경

def get_unused_display_number():
    display = FIRST_X_DISPLAY_NUMBER
    # while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
    #     display += 1
    return display

- 주석처리

# while os.path.exists(X_LOCK_FILE_TEMPLATE % display):

# display += 1

def launch_session(self, x_args):
    self._init_child_env()
    self._setup_pulseaudio()
    self._setup_gnubby()
    # self._launch_x_server(x_args)
    # if not self._launch_pre_session():
        # If there was no pre-session script, launch the session immediately
        # self.launch_x_session()
    display = self.get_unused_display_number()
    self.child_env["DISPLAY"] = ":%d" % display

- 주석처리

# self._launch_x_server(x_args)

# if not self._launch_pre_session():

# self.launch_x_session()

- 추가 2줄

display = self.get_unused_display_number()

self.child_env["DISPLAY"] = ":%d" % display

6. 크롬 원격 데스크탑을 다시 실행한다.

Comments