Linux

[Ubuntu] 우분투 자바 크롬/크롬드라이버/셀레니움 설치

dev_haha 2024. 1. 12. 18:02

3시간 걸린 개짱나는 설치과정 대략 정리.

Ubuntu Java Chrome chromedriver selenium 순서

wls2 설치 

참고
https://velog.io/@gidskql6671/WSL-WSL2-%EC%84%A4%EC%B9%98-VSCode-%EC%97%B0%EB%8F%99

 

WSL & WSL2 설치와 VSCode 연동하기

WSL과 WSL2 설치 및 Remote - WSL을 통한 VSCode와의 연동

velog.io

우분투 설치

vscode와 연동(remote)

>> 우분투에 셀레니움 설치  <<

 

우분투에 자바가 설치되어 있다는 가정 하에

버전확인

크롬설치 → 크롬드라이버 설치 → 셀레니움 설치

 

명령어 이력

history
    1  ls
    2  ls -a
    3  code .
    4  sudo apt-get update
    5  sudo apt-get install openjdk-8-jdk
    6  java -version
    7  readlink -f $(which java)
    8  sudo vi /etc/profile
    9  code .
   10  LS
   11  ls
   12  sudo curl -sS -o - https:
   13  java -version
   14  sudo apt update
   15  sudo apt install wget -y
   16  wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
   17  sudo dpkg -i ./google-chrome-stable_current_amd.deb
   18  sudo dpkg -i ./google-chrome-stable_current_amd64.deb
   19  google-chrome --version
   20  google-chrome-stable --version
   21  sudo dpkg -i
   22  sudo apt-get install -f
   23  sudo dpkg -i ./google-chrome-stable_current_amd64.deb
   24  google-chrome --version
   25  wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.109/linux64/chromedriver-linux64.zip
   26  unzip chromedriver-linux64.zip
   27  sudo apt-get install unzip
   28  unzip chromedriver-linux64.zip
   29  chromedriver --version
   30  ls
   31  sudo mv chromedriver /usr/bin/chromedriver
   32  ls
   33  chromedriver --version
   34  sudo apt install chromium-chromedriver
   35  chromedriver --version
   36  snap install chromium
   37  sudo apt install chromium-broswer
   38  sudo apt install chromium-browser
   39  chromedriver --version
   40  sudo mv chormedriver /usr/bin/chromedriver
   41  ls
   42  chromedriver
   43  sudo apt snap install chromium
   44  chromedriver-linux64 --version
   45  chromedriver_linux64 --version
   46  google-chrome --version
   47  chrome --version
   48  chormedriver --version
   49  sudo apt install <deb name>
   50  sudo apt install <https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb>
   51  sudo apt install https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
   52  sudo mv chromedriver /usr/bin/chromedriver
   53  sudo mv chromedriver /usr/bin
   54  cd chromedriver-linux64
   55  sudo mv chromedriver /usr/bin
   56  ..
   57  cd..
   58  cd ..
   59  cd -
   60  ls
   61  cd ..
   62  ls
   63  cd gkrud
   64  ls
   65  cd usr
   66  cd /usr/bin
   67  ls
   68  mkdir chromedriver
   69  sudo mv chromedriver gkrud/chromedriver-linux64
   70  sudo mv chromedriver /home/gkrud/chromedriver-linux64
   71  cd ..
   72  ls
   73  cd usr
   74  ls
   75  cd bin
   76  mkdir chromedriver
   77  sudo mkdir chromedriver
   78  cd ..
   79  ls
   80  cd home
   81  cd gkrud
   82  ls
   83  cd chromedriver-linux64
   84  ls
   85  sudo mv chromedriver /usr/bin/chromedriver
   86  ls
   87  cd ..
   88  ls
   89  cd ..
   90  ls
   91  cd usr
   92  cd bin
   93  ls
   94  cd ..
   95  cd home
   96  cd gkrud
   97  sudo chown root:root /usr/bin/chromedriver
   98  sudo chmod +x /usr/bin/chromedriver
   99  ll /usr/bin/chromedriver
  100  wget fine / -name chromedriver
  101  find chromedriver
  102  find -name chromedriver
  103  sudo pip install xlrd
  104  chromedriver --version
  105  cd ..
  106  ls
  107  cd ..
  108  ls
  109  cd usr
  110  ls
  111  cd bin
  112  cd chromedriver
  113  ls
  114  mv chromedriver /usr
  115  sudo mv chromedriver /usr
  116  ls
  117  cd ..
  118  ls
  119  rm -rf chromedriver
  120  sudo rm -rf chromedriver
  121  ls
  122  cd ..
  123  ls
  124  sudo mv chromedriver /usr/bin
  125  cd bin
  126  ls
  127  cd ..
  128  ls
  129  cd ..
  130  ls
  131  cd home
  132  cd gkrud
  133  ls
  134  cd ..
  135  ls
  136  cd ..
  137  ls
  138  cd usr
  139  cd bin
  140  chromedriver --version
  141  sodu mv chromedriver /usr/bin/chromedriver
  142  sudo mv chromedriver /usr/bin/chromedriver
  143  sudo chown root:root /usr/bin/chromedriver
  144  sudo chmod +x /usr/bin/chromedriver
  145  wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.0.jar
  146  wget https://selenium-release.storage.googleapis.com/3.13/selenium-server-standalone-3.13.0.jar
  147  cd ..
  148  cd.. 
  149  cd ..
  150  ls
  151  cd home
  152  ls
  153  cd gkrud
  154  wget https://selenium-release.storage.googleapis.com/3.13/selenium-server-standalone-3.13.0.jar
  155  xvfb-fun java -Dwebdriver.chrome.driver=usr/bin/chromedriver -jar selenium-server-standalone-3.414.0.jar
  156  xvfb-run java -Dwebdriver.chrome.driver=usr/bin/chromedriver -jar selenium-server-standalone-3.414.0.jar
  157  sudo apt install xvfb
  158* xvfb-run java -Dwebdriver.chrome.driver=usr/bin/chromedriver -jar selenium-server-standalone-3
  159  ls
  160  rm -rf selenium-server-standalone-3.13.0.jar
  161  ls
  162  $ wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.0.jar
  163  wget https://selenium-release.storage.googleapis.com/4.16/selenium-server-standalone-4.16.0.jar
  164  wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.0.jar
  165  ls
  166  xvfb-run java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.141.0.jar
  167  history

 

Ubuntu 설치 버전 2.22.04.1

chrome 설치 버전 120
chromedriver 설치 버전 120

chromedriver를 mv할 때는 chromedriver가 있는 디렉토리에 가서 명령어를 사용해야 한다. (sudo 붙이고)

selenium 설치 버전은

최신 버전은 도저히 설치가 안되어서

wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.0.jar 으로 설치함. 

그리고 나서 
xvfb-run java -Dwebdriver.chrome.driver=/url/bin/chromedriver -jar selenium-server-standalone-3.141.0.jar 실행

참고 사이트

https://googlechromelabs.github.io/chrome-for-testing/#stable

 

Chrome for Testing availability

chrome-headless-shellmac-arm64https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.109/mac-arm64/chrome-headless-shell-mac-arm64.zip200

googlechromelabs.github.io

크롬드라이버 120버전 다운 (linux64)

https://yoshikixdrum.tistory.com/228

 

[Selenium] Ubuntu 20.04 에 셀레니움(셀레늄) 서버 설치 및 사용하기

윈도우에 이어서 실제 서버인 Ubuntu 20.04에서 돌리기 위해서 Selenium 서버를 설치를 진행했습니다. 1. 기본 패치키 및 자바 설치 먼저 시스템에 필요한 패키지를 설치해야 합니다. 여기서 Xvfb(X virtua

yoshikixdrum.tistory.com

https://somjang.tistory.com/entry/Ubuntu-Ubuntu-%EC%84%9C%EB%B2%84%EC%97%90-Selenium-%EC%84%A4%EC%B9%98%ED%95%98%EA%B3%A0-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0

 

[Ubuntu] Ubuntu 서버에 Selenium 설치하고 사용하기

Mac에서 Selenium을 활용하여 열심히 크롤링 코드를 작성하여 제대로 동작하는지 확인한 후 호기롭게 Ubuntu 서버에 그대로 파일을 옮긴 뒤 selenium 라이브러리를 설치하고 Linux용 chromedriver를 다운받

somjang.tistory.com