Skip to content

Commit

Permalink
docs: Chrome Fix for ubuntu (#338)
Browse files Browse the repository at this point in the history
Co-authored-by: Jisan <66010486+Jisan09@users.noreply.github.com>
  • Loading branch information
LinuxGuy312 and Jisan09 authored May 15, 2023
1 parent 270b11f commit 053c8ad
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
47 changes: 38 additions & 9 deletions docs/installation/guide/chromium-and-chrome-driver-setup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 📕 Chromium and Chrome driver Setup
# 📕 Chromium/Chrome and Chrome driver Setup

{% hint style="info" %}
This setup is only required for the users who followed the SELF-HOST method for deploying Cat Userbot.
Expand All @@ -8,15 +8,15 @@ This is not required for Docker or Docker-Compose (recommended method) methods.

**Why should you do this setup?**

Chromium binary and Chrome-driver is a mandatory requirement for many awesome plugins and commands like <mark style="color:green;">AI tools</mark>, <mark style="color:green;">Screenshot</mark>, <mark style="color:green;">Rayso</mark>, <mark style="color:green;">Rayso based logs</mark>, <mark style="color:green;">Carbon</mark>, etc.
Chromium/Chrome binary and Chrome-driver is a mandatory requirement for many awesome plugins and commands like <mark style="color:green;">AI tools</mark>, <mark style="color:green;">Screenshot</mark>, <mark style="color:green;">Rayso</mark>, <mark style="color:green;">Rayso based logs</mark>, <mark style="color:green;">Carbon</mark>, etc.

Here we will show how to setup this in 2 popular and widely used distros only (<mark style="color:red;">Ubuntu</mark> and <mark style="color:red;">Debian</mark>). Other distro users have to install and setup the Vars accordingly.

{% tabs %}
{% tab title="Ubuntu" %}
{% tab title="Debian" %}
{% code title="Install chromium and chromium based chrome driver" overflow="wrap" %}
```batch
sudo apt install chromium-browser chromium-chromedriver
sudo apt install chromium chromium-driver
```
{% endcode %}

Expand All @@ -28,21 +28,50 @@ nano config.py

{% code title="Add these two vars in your config" overflow="wrap" %}
```batch
CHROME_BIN = "/usr/bin/chromium-browser"
CHROME_BIN = "/usr/bin/chromium"
CHROME_DRIVER = "/usr/bin/chromedriver"
```
{% endcode %}

Now to save use <mark style="color:red;">Ctrl+O</mark> and press <mark style="color:red;">Enter</mark> , then use <mark style="color:red;">Ctrl+X</mark> to exit.
{% endtab %}

{% tab title="Debian" %}
{% code title="Install chromium and chromium based chrome driver" overflow="wrap" %}
{% tab title="Ubuntu" %}
{% code title="Install Google Chrome & Chromedriver" %}
```batch
sudo apt install chromium chromium-driver
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list && \
sudo apt-get update -y && \
sudo apt-get install -y google-chrome-stable xvfb libxi6 libgconf-2-4 default-jdk && \
CHROMEVER=$(sudo google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*") && \
DRIVERVER=$(sudo curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER") && \
sudo wget -q --continue -P /tmp "http://chromedriver.storage.googleapis.com/$DRIVERVER/chromedriver_linux64.zip" && \
sudo unzip -q /tmp/chromedriver_linux64.zip -d /usr/bin && \
sudo chmod +x /usr/bin/chromedriver && \
sudo chown root:root /usr/bin/chromedriver && \
sudo chmod +x /usr/bin/google-chrome && \
sudo rm /tmp/chromedriver_linux64.zip /usr/bin/LICENSE.chromedriver
```
{% endcode %}

{% code title="Download Required Jar Files" overflow="wrap" %}
```batch
wget https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar
mv selenium-server-standalone-3.9.1.jar selenium-server-standalone.jar
```
{% endcode %}

{% code title="Start Chrome via Selenium Server" overflow="wrap" %}
```batch
screen -S chrome
xvfb-run java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone.jar
```
{% endcode %}

After this, do <mark style="color:red;">Ctrl+O</mark> and press <mark style="color:red;">Enter</mark> , then use <mark style="color:red;">Ctrl+X</mark> to exit screen.

{% code title="Go to catuserbot directory and open the config.py " overflow="wrap" %}
```batch
nano config.py
Expand All @@ -51,7 +80,7 @@ nano config.py

{% code title="Add these two vars in your config" overflow="wrap" %}
```batch
CHROME_BIN = "/usr/bin/chromium"
CHROME_BIN = "/usr/bin/google-chrome"
CHROME_DRIVER = "/usr/bin/chromedriver"
```
{% endcode %}
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/hosting/self-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pip install virtualenv && virtualenv venv && source venv/bin/activate && pip3 in

* _**Run:**_ `python3 -m userbot`
* _**Close Screen:**_ Press <mark style="color:red;">CTRL+A</mark> and after that <mark style="color:red;">CTRL+D</mark>
* _**Reattach Screen:**_ `screen -r catuserbot`
* _**Check:**_ `screen -ls`
* _**Reattach Screen:**_ `screen -r <some_id>.catuserbot`

## _Video Tutorial_

Expand Down

0 comments on commit 053c8ad

Please sign in to comment.