방법 1
1. 크롬 패키지 설치에 필요한 인증 키 등록
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
🔺 apt-key Deprecated
apt-key가 Deprecated가 되면서 gpg 키를 /etc/apt/trusted.gpg.d 디렉토리에서 직접 관리해줘야 한다. 아래 코드로 실행하도록 하자. 위 코드는 Deprecated되어 정상적으로 실행되지 않는다.
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/linux_signing_key.gpg
2. 개인 패키지 저장소 (RPA) 추가
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list.d/google.list'
3. 저장소 업데이트
sudo apt-get update -y
4. 크롬 설치
apt-get install google-chrome-stable
5. 버전 확인
google-chrome --version
6. 크롬 설치를 위해 추가한 저장소 삭제
find /etc -name "google.list" 2>/dev/null | xargs -I / sudo rm -rf /
방법 2
- https://stackoverflow.com/questions/75155063/selenium-use-chrome-on-colab-got-unexpectedly-exited
- https://colab.research.google.com/drive/1cbEvuZOhkouYLda3RqiwtbM-o9hxGLyC
최근 우분투 업데이트에서 크롬 드라이버 설치를 snap을 이용하여 설치하도록 바뀌었음.
방법 2는 우분투 환경에서 snap 없이 크롬을 설치하는 우회 코드를 작성 해볼 것임.
# Add debian buster
cat > /etc/apt/sources.list.d/debian.list << EOF
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster.gpg] http://deb.debian.org/debian buster main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster-updates.gpg] http://deb.debian.org/debian buster-updates main
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-security-buster.gpg] http://deb.debian.org/debian-security buster/updates main
EOF
# Add keys
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCC9EFBF77E11517
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A
apt-key export 77E11517 | gpg --dearmour -o /usr/share/keyrings/debian-buster.gpg
apt-key export 22F3D138 | gpg --dearmour -o /usr/share/keyrings/debian-buster-updates.gpg
apt-key export E562B32A | gpg --dearmour -o /usr/share/keyrings/debian-security-buster.gpg
# Prefer debian repo for chromium* packages only
# Note the double-blank lines between entries
cat > /etc/apt/preferences.d/chromium.pref << EOF
Package: *
Pin: release a=eoan
Pin-Priority: 500
Package: *
Pin: origin "deb.debian.org"
Pin-Priority: 300
Package: chromium*
Pin: origin "deb.debian.org"
Pin-Priority: 700
EOF
# Install chronium and chromium-driver
apt-get update -y
apt-get install -y chromium chromium-driver