Linux PC and Samsung Galaxy A34 Setup for Screen Mirroring


Part I — Linux PC Setup (User-Isolated)

Objective

Install ADB and scrcpy locally under the user account without system-wide installation, enabling screen mirroring and control over USB or wireless.

Prerequisites

Step 1 — Create Local Installation Folder

mkdir -p ~/opt
cd ~/opt

Step 2 — Install ADB Locally

wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip -O platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip
rm platform-tools-latest-linux.zip
export PATH="$HOME/opt/platform-tools:$PATH"
export ADB=$HOME/opt/platform-tools/adb
echo 'export PATH="$HOME/opt/platform-tools:$PATH"' >> ~/.bashrc
echo 'export ADB="$HOME/opt/platform-tools/adb"' >> ~/.bashrc
source ~/.bashrc
which adb
adb version

Step 3 — Install scrcpy Locally

wget https://sourceforge.net/projects/scrcpy/files/v3.3.4/scrcpy-linux-x86_64-v3.3.4.tar.gz/download -O scrcpy-linux-x86_64-v3.3.4.tar.gz
tar xvf scrcpy-linux-x86_64-v3.3.4.tar.gz
mv scrcpy-linux-x86_64-v3.3.4/scrcpy ~/.local/bin/
mv scrcpy-linux-x86_64-v3.3.4/scrcpy-server ~/.local/bin/
chmod +x ~/.local/bin/scrcpy ~/.local/bin/scrcpy-server
rm -rf scrcpy-linux-x86_64-v3.3.4
rm scrcpy-linux-x86_64-v3.3.4.tar.gz
scrcpy --version

Step 4 — Verify ADB

adb devices
Tip: The list may be empty if no device is connected yet.

Step 5 — Optional Launcher Script (use nano, xed, mousepad, gedit, or any text editor)

nano ~/.local/bin/scrcpy-launch
Paste:
#!/bin/bash
export PATH="$HOME/opt/platform-tools:$PATH"
scrcpy "$@"
chmod +x ~/.local/bin/scrcpy-launch
scrcpy-launch
---

Part II — Smartphone Setup (Samsung Galaxy A34)

Objective

Prepare the smartphone for screen mirroring via scrcpy using USB or wireless debugging.

Step 1 — Enable Developer Options

Step 2 — Enable USB Debugging

Step 3 — Optional: Enable Wireless Debugging

Step 4 — Connect Phone to Linux PC

USB:

Wireless:


adb pair <IP>:<PORT>   # Enter code from phone
adb connect <IP>:<PORT>

Example:

adb pair 192.168.1.7:41121

Step 5 — Verify Connection

adb devices

Step 6 — Quick Launcher

scrcpy-launch

Step 6 — Launch scrcpy with parameters


# Optional flags:
scrcpy-launch --video-bit-rate 4M --audio-bit-rate 128K
scrcpy-launch --turn-screen-off
# One-liner command:
scrcpy-launch --video-bit-rate 4M --audio-bit-rate 128K --turn-screen-off
Note: This setup ensures full functionality for both USB and wireless mirroring without requiring root or system-wide installs.