Install brave browser

How can I install brave or chrome browser on clear linux?

I have not gotten Brave done in a simple manner yet. For Chrome you can crack open the rpm and install it manually or you can build it from source. I haven’t personally done either of these yet but I believe people here have gotten Chrome working.

Brave browser installation

  1. Open a terminal

  2. Run the following command to obtain root privileges

    sudo -s
    

    and type your admin password.

  3. Run the following commands, one by one:

    swupd bundle-add package-utils
    dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/x86_64/
    rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
    dnf download brave-keyring brave-browser
    rpm2cpio brave-keyring*.rpm | ( cd /; cpio -idv)
    rpm2cpio brave-browser*.rpm | ( cd /; cpio -idv)
    
  4. Now you can delete the .rpm packages and, if you don’t need it, the package-utils bundle. To do this run the following commands, one by one:

    rm -f brave-*.rpm
    swupd bundle-remove package-utils
    
  5. Now we can fix the missing menu icon (thanks to @mattyjones):

    sed -i 's/Icon=brave-browser/Icon=brave/g' /usr/share/applications/brave-browser.desktop 
    
  6. And the following command will fix the font loading (thanks to @TomL):

    f=/etc/environment; s='export FONTCONFIG_PATH=/usr/share/defaults/fonts'; touch $f; if ! grep -q "$s" $f; then echo $s >> $f; fi
    
  7. Reboot your system.

Done! :smile:

Uninstalling Brave browser

  1. Open a terminal

  2. Run the following command to obtain root privileges

    sudo -s
    

    and type your admin password.

  3. Run the following commands, one by one:

    f=brave*; rm -f /etc/cron.daily/$f /usr/bin/$f /usr/share/appdata/$f /usr/share/applications/$f /usr/share/gnome-control-center/default-apps/$f /usr/share/man/man1/$f /etc/pki/rpm-gpg/*brave
    rm -rf /opt/brave.com
    

Done!

Google Chrome installation

  1. Open a terminal

  2. Run the following command to obtain root privileges

    sudo -s
    

    and type your admin password.

  3. Run the following commands, one by one:

    swupd bundle-add package-utils
    curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
    rpm2cpio google-chrome*.rpm | ( cd /; cpio -idv)
    
  4. Now you can delete the .rpm package and, if you don’t need it, the package-utils bundle. To do this run the following commands, one by one:

    rm -f google-chrome*.rpm
    swupd bundle-remove package-utils
    
  5. And the following command will fix the font loading (thanks to @TomL):

    f=/etc/environment; s='export FONTCONFIG_PATH=/usr/share/defaults/fonts'; touch $f; if ! grep -q "$s" $f; then echo $s >> $f; fi
    
  6. Reboot your system.

Done! :smile:

Uninstalling Google Chrome

  1. Open a terminal

  2. Run the following command to obtain root privileges

    sudo -s
    

    and type your admin password.

  3. Run the following commands, one by one:

    f=google-chrome*; rm -f /etc/cron.daily/$f /usr/bin/$f /usr/share/appdata/$f /usr/share/applications/$f /usr/share/gnome-control-center/default-apps/$f /usr/share/man/man1/$f
    rm -rf /opt/google
    

Done!

8 Likes

Mattia, thanks for this. Just an FYI for Chrome, there is an issue reported for the fonts, installing chrome · Issue #422 · clearlinux/distribution · GitHub, once I applied the workaround my fonts were fine.

Edit the file /etc/environment with root privileges:
$ sudo vi /etc/environment

Add the following:
export FONTCONFIG_PATH=/usr/share/defaults/fonts

and save the file and reboot to the system.

I also added chrome to my favorites since I use it all the time. Right-click the chrome icon and select add to favorites.

Your fonts should behave

1 Like

No icon though, will need to fix that but having Brave brings me almost to a full setup.

1 Like

@TomL thanks for the info, I didn’t know that. I used to edit Chrome font settings, now I just updated the tutorial with your workaround. It works with Brave browser too, since it’s Chrome-based.

@mattyjones I also fixed the missing icon issue with Brave.

1 Like

How do we update the Brave, if any new version released, once installed?

As far as I understand it, running cpio with a new archive will replace the older files with the new ones. Re-following the procedure should work for updating the browsers.

1 Like

Goto installing chrome · Issue #422 · clearlinux/distribution · GitHub and look for Danyer’ comment, I use his script regularly to update Chrome browser.

Below is the script to install Brave browser. I modified base on Danyer’s Chrome script.

#!/bin/bash

#PS4='$LINENO: '
#set -x

#DEST=~/brave-${1}
#VERSION_FILE=${DEST}/.version
DEST=
VERSION_FILE=

usage()
{
    echo "usage: install-brave-target [target]"
    echo "          [target] - Only 'stable', 'beta', 'nightly' or 'dev'"
}

if [ "$1"  == "dev" ]; then
  DEST=~/brave-${1}
  VERSION_FILE=${DEST}/.version
elif [ "$1"  == "nightly" ]; then
  DEST=~/brave-${1}
  VERSION_FILE=${DEST}/.version
elif [ "$1"  == "beta" ]; then
  DEST=~/brave-${1}
  VERSION_FILE=${DEST}/.version  
elif [ "$1"  == "stable" ]; then
  DEST=~/brave-${1}
  VERSION_FILE=${DEST}/.version
else
  usage
  exit 1
fi  

echo Brave browser ${1} build updater


LOCAL_VERSION="none" && [ -f $VERSION_FILE ] && LOCAL_VERSION=$(cat $VERSION_FILE)
echo -e "Local version\t: $LOCAL_VERSION"

#Check version on remote
#REMOTE_VERSION=$(wget -q https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages.gz -O-| gunzip|sed -n '/Package: google-chrome-stable/ {n;p}'|cut -f2 -d\ )
REMOTE_VERSION=$(curl -s   https://github.com/brave/brave-browser/releases/latest | grep -Po '(?<=/tag/v)[0-9]+.[0-9]+.[0-9]+')
echo -e "Remote version\t: $REMOTE_VERSION"

if [ "$REMOTE_VERSION" == "$LOCAL_VERSION" ]; then
  echo "No update available"
  exit
fi

read -sp "Enter to update, Ctrl-C to abort... " && echo

echo Downloading ...
TMPWORK=$(mktemp -d)
cd $TMPWORK
#wget -q --show-progress https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${REMOTE_VERSION}_amd64.deb -O google-chrome-stable_current_amd64.deb
#nightly wget -q --show-progress https://github.com/brave/brave-browser/releases/download/v${REMOTE_VERSION}/brave-browser-nightly_${REMOTE_VERSION}_amd64.deb -O brave-browser-nightly_amd64.deb
#wget -q --show-progress https://github.com/brave/brave-browser/releases/download/v${REMOTE_VERSION}/brave-browser-beta_${REMOTE_VERSION}_amd64.deb -O brave-browser-beta_amd64.deb
if [ "$1"  == "stable" ]; then
  wget -q --show-progress https://github.com/brave/brave-browser/releases/download/v${REMOTE_VERSION}/brave-browser_${REMOTE_VERSION}_amd64.deb -O brave-browser-${1}_amd64.deb
else	
  wget -q --show-progress https://github.com/brave/brave-browser/releases/download/v${REMOTE_VERSION}/brave-browser-${1}_${REMOTE_VERSION}_amd64.deb -O brave-browser-${1}_amd64.deb
fi  

if [ $? != 0 ]; then
  echo "Targte to download not exist !"
  echo "Please try 'stable', 'beta', 'nightly' or 'dev'"
  exit
fi

echo Extracting ...
#ar x google-chrome-stable_current_amd64.deb data.tar.xz
#nightly ar x brave-browser-nightly_amd64.deb data.tar.xz
#ar x brave-browser-beta_amd64.deb data.tar.xz
ar x brave-browser-${1}_amd64.deb data.tar.xz

rm -rf $DEST
mkdir $DEST
bsdtar -xf data.tar.xz -C $DEST

#adjust path
#sed -e "s%/usr/bin/brave-browser-nightly%/home/hphang/brave/opt/brave.com/brave-nightly/brave-browser-nightly%" -e "s%Icon=brave-browser-nightly%Icon=/home/hphang/brave/opt/brave.com/brave-nightly/product_logo_128_nightly.png%"  /home/hphang/brave/usr/share/applications/brave-browser-nightly.desktop > ~/.local/share/applications/brave-browser-nightly.desktop
#nightly sed -e "s%/usr/bin/brave-browser-nightly%${DEST}/opt/brave.com/brave-nightly/brave-browser-nightly%" -e "s%Icon=brave-browser-nightly%Icon=${DEST}/opt/brave.com/brave-nightly/product_logo_128_nightly.png%" ${DEST}/usr/share/applications/brave-browser-nightly.desktop > ~/.local/share/applications/brave-browser-nightly.desktop
#sed -e "s%/usr/bin/brave-browser-beta%${DEST}/opt/brave.com/brave-beta/brave-browser-beta%" -e "s%Icon=brave-browser-beta%Icon=${DEST}/opt/brave.com/brave-beta/product_logo_128_beta.png%" ${DEST}/usr/share/applications/brave-browser-beta.desktop > ~/.local/share/applications/brave-browser-beta.desktop
if [ "$1"  == "stable" ]; then
  sed -e "s%/usr/bin/brave-browser%${DEST}/opt/brave.com/brave/brave-browser%" -e "s%Icon=brave-browser%Icon=${DEST}/opt/brave.com/brave/product_logo_128.png%" ${DEST}/usr/share/applications/brave-browser.desktop > ~/.local/share/applications/brave-browser.desktop
else
  sed -e "s%/usr/bin/brave-browser-${1}%${DEST}/opt/brave.com/brave-${1}/brave-browser-${1}%" -e "s%Icon=brave-browser-${1}%Icon=${DEST}/opt/brave.com/brave-${1}/product_logo_128_${1}.png%" ${DEST}/usr/share/applications/brave-browser-${1}.desktop > ~/.local/share/applications/brave-browser-${1}.desktop
fi  

#create a link at Desktop for easy access
if [ "$1"  == "stable" ]; then
  ln -sf ~/.local/share/applications/brave-browser.desktop ~/Desktop/brave-browser-${1}.desktop
else
  ln -sf ~/.local/share/applications/brave-browser-${1}.desktop ~/Desktop/brave-browser-${1}.desktop 
fi

#Store version
echo $REMOTE_VERSION > $VERSION_FILE

cd
rm -rf $TMPWORK
echo Done.

#[ $(pgrep -c -f ${DEST}/opt/google/chrome/chrome) -gt 0 ] && echo "Restart Google Chrome to use the latest version."
#nightly [ $(pgrep -c -f ${DEST}/opt/brave.com/brave-nightly/brave) -gt 0 ] && echo "Restart Brave browser to use the latest nightly version."
#[ $(pgrep -c -f ${DEST}/opt/brave.com/brave-beta/brave) -gt 0 ] && echo "Restart Brave browser to use the latest beta version."
if [ "$1"  == "stable" ]; then
  [ $(pgrep -c -f ${DEST}/opt/brave.com/brave/brave) -gt 0 ] && echo "Restart Brave browser to use the latest stable version."
else
  [ $(pgrep -c -f ${DEST}/opt/brave.com/brave-${1}/brave) -gt 0 ] && echo "Restart Brave browser to use the latest ${1} version."
fi

What about synced bookmarks, saved passwords and history?

1 Like

What about synced bookmarks, saved passwords and history?

they should work as normal as they are saved in you $HOME/.config directory.

2 Likes

Good to know. I will add a script for auto update.

The script doesn’t work at all. I tried for stable and dev releases. No luck.

erase the last ) int the curl line

I tried that. But REMOTE_VERSION will get the latest release version number (it can be dev, release, stable or beta), not the stable release version number. :slight_smile:. And wget command fails for at least 3 versions.

The script will refer to this link Release Release v1.47.171 (Chromium 109.0.5414.87) · brave/brave-browser · GitHub to pick which release to install.
E.g.

  1. if the link point to Dev Channel, then “./install-brave-target.sh dev” will install development edition.
  2. if the link point to Nightly Channel, then “./install-brave-target.sh nightly” will install nightly edition.
  3. if the link point to Beta Channel, then “./install-brave-target.sh beta” will install beta edition.
  4. if the link point to Stable Channel, then “./install-brave-target.sh stable” will install stable edition.

In short, you need to goto Releases · brave/brave-browser · GitHub, verify the green “Latest release” label point to and install accordingly.

As of writing this, the latest release is v0.66.75. And it is the dev channel release. No way /install-brave-target.sh beta, /install-brave-target.sh nightly and /install-brave-target.sh stable commands work.

Correct me if I am wrong… :wink:

Yup. only ./install-brave-target.sh dev works. :slight_smile:

@MattiaVerticchio

So, How do we uninstall the Brave browser?:sweat_smile:

1 Like

You need to delete all entries where is make with rmp2cpio because brave-browser is not installed,we use the binaries.