Add 02-enable_hotspot
This commit is contained in:
parent
6a48ab73a4
commit
7813d27945
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Turn Raspberry Pi into Wi-Fi Hotspot for Jellyfin
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== Installing dependencies ==="
|
||||
sudo apt update
|
||||
sudo apt install -y hostapd dnsmasq
|
||||
|
||||
echo "=== Stopping services to configure ==="
|
||||
sudo systemctl stop hostapd
|
||||
sudo systemctl stop dnsmasq
|
||||
|
||||
echo "=== Configuring static IP for wlan0 ==="
|
||||
sudo bash -c 'cat >> /etc/dhcpcd.conf <<EOF
|
||||
|
||||
interface wlan0
|
||||
static ip_address=192.168.4.1/24
|
||||
nohook wpa_supplicant
|
||||
EOF'
|
||||
|
||||
sudo service dhcpcd restart
|
||||
|
||||
echo "=== Configuring dnsmasq ==="
|
||||
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig 2>/dev/null || true
|
||||
|
||||
sudo bash -c 'cat > /etc/dnsmasq.conf <<EOF
|
||||
interface=wlan0
|
||||
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
|
||||
EOF'
|
||||
|
||||
echo "=== Configuring hostapd ==="
|
||||
sudo bash -c 'cat > /etc/hostapd/hostapd.conf <<EOF
|
||||
interface=wlan0
|
||||
driver=nl80211
|
||||
ssid=RaspberryPiMedia
|
||||
hw_mode=g
|
||||
channel=7
|
||||
wmm_enabled=0
|
||||
macaddr_acl=0
|
||||
auth_algs=1
|
||||
ignore_broadcast_ssid=0
|
||||
wpa=2
|
||||
wpa_passphrase=raspberrymedia
|
||||
wpa_key_mgmt=WPA-PSK
|
||||
rsn_pairwise=CCMP
|
||||
EOF'
|
||||
|
||||
sudo sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|' /etc/default/hostapd
|
||||
|
||||
echo "=== Enabling services ==="
|
||||
sudo systemctl unmask hostapd
|
||||
sudo systemctl enable hostapd
|
||||
sudo systemctl enable dnsmasq
|
||||
|
||||
echo "=== Starting services ==="
|
||||
sudo systemctl start hostapd
|
||||
sudo systemctl start dnsmasq
|
||||
|
||||
echo "=== Done ==="
|
||||
echo "Connect to the Wi-Fi network: RaspberryPiMedia"
|
||||
echo "Use password: raspberrymedia"
|
||||
echo "Access Jellyfin at: http://192.168.4.1:8096"
|
Loading…
Reference in New Issue