🚀 How to Set Up Apache Flink on WSL (Windows Subsystem for Linux)
Apache Flink is a powerful framework for real-time stream processing. If you're using Windows, you can run Flink seamlessly with WSL (Windows Subsystem for Linux). Here’s how to set it up step by step.
1️⃣ Install WSL
Open PowerShell
as Administrator and run:
wsl --install
This installs WSL with Ubuntu as the default distribution. Restart your computer if needed.
2️⃣ Open Ubuntu in WSL
Search for Ubuntu in the Start menu and launch it. On the first run, it will ask you to create a user.
3️⃣ Install Java (Required for Flink)
Run the following commands in the WSL terminal:
sudo apt update sudo apt install openjdk-11-jdk
🔹 Set JAVA_HOME (Optional)
To set the JAVA_HOME
environment variable:
1. Find the Java installation path:
update-alternatives --config java
Copy the path (e.g., /usr/lib/jvm/java-11-openjdk-amd64
).
2. Edit your profile file:
nano ~/.bashrc # Or nano ~/.zshrc for Zsh
Add these lines at the end:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH
3. Apply changes:
source ~/.bashrc # Or source ~/.zshrc for Zsh
4. Verify Java is set correctly:
echo $JAVA_HOME
4️⃣ Install Apache Flink
Download and extract Flink in your home directory:
cd ~ wget https://downloads.apache.org/flink/flink-1.16.0-bin-scala_2.12.tgz tar -xvzf flink-1.16.0-bin-scala_2.12.tgz mv flink-1.16.0 flink
(Replace 1.16.0
with the latest version from Apache Flink’s website.)
5️⃣ Set Up Flink Environment Variables
Edit your shell profile (~/.bashrc
or ~/.zshrc
):
nano ~/.bashrc
Add these lines at the end:
export FLINK_HOME=~/flink export PATH=$FLINK_HOME/bin:$PATH
Apply changes:
source ~/.bashrc
6️⃣ Start Apache Flink 🚀
Run the following to start Flink’s cluster:
cd $FLINK_HOME ./bin/start-cluster.sh
Now, open a browser and visit: 👉 http://localhost:8081
If you see the Flink web interface, your setup is complete! 🎉
---
🔥 Summary
👉 Install WSL and Ubuntu
👉 Install Java and set JAVA_HOME
👉 Download & configure Apache Flink
👉 Start the Flink cluster
Now you’re ready to process big data on Windows like a pro! 🚀
0 comments:
If you have any doubts,please let me know