1) Add “deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main” to “/etc/apt/sources.list”
OR
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list
2) Download Google Chrome Signing Key:
wget https://dl.google.com/linux/linux_signing_key.pub
2) Add the new key to keyring for package manager sudo apt-key add linux_signing_key.pub
3) Update package manager and install chrome
sudo apt updatesudo apt install google-chrome-stable
Install Zip UnZip
1) Update
apt-get update
2) Install Zip UnZip
apt-get install zip unzip
Install Selenium Chrome Driver
https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5
1) Download Chrome Driver
wget -N http://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
2) unzip Chrome Driver
unzip chromedriver_linux64.zip
3) change mode
chmod +x chromedriver
4) move chromedriver and create hardlink, then chromedriver can be found in the ubuntu “PATH”
sudo mv -f chromedriver /usr/local/share/chromedriversudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriversudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
Install .Net Core 2 in Ubuntu 16.04
https://github.com/dotnet/docs/blob/master/docs/core/linux-prerequisites.md
1) Register the Microsoft Product key as trusted.
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpgsudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
2) Set up the desired version host package feed.
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'sudo apt-get update
3) Install .NET Core
sudo apt-get install dotnet-sdk-2.1.4
4) Run the dotnet --version command to prove the installation succeeded
dotnet --version
With the setup above, google-chrome and selenium should work for both python and C# .Net Core 2.1.4. In C#, the --no-sandbox argument must be added as well to run in linux.
Install Selenium for Python3
1) install selenium
pip3 install selenium
Important Tip
1) The following codes are necessary. --no-sandbox is very important for sudo mode of google chrome.
chromeOptions = Options()
chromeOptions.add_argument('--headless')
chromeOptions.add_argument('--disable-gpu')
chromeOptions.add_argument('--no-sandbox')
driver = webdriver.Chrome(chrome_options=chromeOptions)
Install Xvfb (it is found not necessary for linux when with --headless and --disable-gpu)
1) Instal Xvfb
sudo apt-get install xvfb xserver-xephyr vnc4server
2) Install Virtual Display
sudo pip install pyvirtualdisplay
3) Optional:
sudo apt-get install python-pil scrotsudo pip install pyscreenshot
1) Add “deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main” to “/etc/apt/sources.list” OR
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list
2) Download Google Chrome Signing Key:
wget https://dl.google.com/linux/linux_signing_key.pub
2) Add the new key to keyring for package managersudo apt-key add linux_signing_key.pub
3) Update package manager and install chromesudo apt update
sudo apt install google-chrome-stable
Install Zip UnZip 1) Update
apt-get update
2) Install Zip UnZipapt-get install zip unzip
Install Selenium Chrome Driver https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5 1) Download Chrome Driver
wget -N http://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
2) unzip Chrome Driverunzip chromedriver_linux64.zip
3) change modechmod +x chromedriver
4) move chromedriver and create hardlink, then chromedriver can be found in the ubuntu “PATH”sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
Install .Net Core 2 in Ubuntu 16.04 https://github.com/dotnet/docs/blob/master/docs/core/linux-prerequisites.md 1) Register the Microsoft Product key as trusted.
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
2) Set up the desired version host package feed.sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
3) Install .NET Coresudo apt-get install dotnet-sdk-2.1.4
4) Run the dotnet --version command to prove the installation succeededdotnet --version
With the setup above, google-chrome and selenium should work for both python and C# .Net Core 2.1.4. In C#, the --no-sandbox argument must be added as well to run in linux.
Schedule a Task via crontab https://crontab.guru/
----- the following steps are not required
Install Python 0) Test python version
python3 --version
Python 2 and 3 were preinstalled.Install pip 1) Download get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2) Install pippython get-pip.py
python3 get-pip.py
Install Selenium for Python3 1) install selenium
pip3 install selenium
Important Tip 1) The following codes are necessary. --no-sandbox is very important for sudo mode of google chrome. chromeOptions = Options() chromeOptions.add_argument('--headless') chromeOptions.add_argument('--disable-gpu') chromeOptions.add_argument('--no-sandbox') driver = webdriver.Chrome(chrome_options=chromeOptions)
Install Xvfb (it is found not necessary for linux when with --headless and --disable-gpu) 1) Instal Xvfb
sudo apt-get install xvfb xserver-xephyr vnc4server
2) Install Virtual Displaysudo pip install pyvirtualdisplay
3) Optional:sudo apt-get install python-pil scrot
sudo pip install pyscreenshot