Lastcast on Raspberry Pi
lastcast_noobInstall Raspbian
Download Raspbian Lite: https://www.raspberrypi.org/downloads/raspbian/
Install Operating System Image: https://www.raspberrypi.org/documentation/installation/installing-images/README.md
Setup
Once booted run:
sudo raspi-config
- Change password
- Set to autologin
- Tell boot to wait for network
- Change hostname
Connect to network
Source: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
Edit the configuration file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
The file should look like this:
Ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
Update_config=1
network={
ssid="YOUR_SSID"
psk="YOUR_PASSWORD"
}
Update YOUR_SSID and YOUR_PASSWORD with correct details
Update system with following command:
sudo wpa_cli reconfigure
Check its working with following command:
ifconfig wlan0
Static IP Address
Source: https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update
Start by editing the dhcpcd.conf file
sudo nano /etc/dhcpcd.conf
Scroll all the way to the bottom of the file and add the following code (include the /24 after the static ip):
interface wlan0
static ip_address=192.168.0.9/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4
Test with:
ifconfig wlan0
Install lastcast
Install pyton3 and python3-pip:
sudo apt-get install python3 python3-pip
Install netifaces
sudo pip3 install netifaces==0.10.4
Install lastcast (https://github.com/erik/lastcast):
sudo pip3 install lastcast
Configure lastcast
lastcast --wizard
Run lastcast
lastcast
Automatically run at startup
Source: http://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/
Create service file:
sudo touch /etc/systemd/system/lastcast.service
Update permissions:
sudo chmod 664 /etc/systemd/system/lastcast.service
Edit service file:
sudo nano /etc/systemd/system/lastcast.service
Add the following to the empty file:
[Unit]
Description=Lastcast Server
After=multi-user.target
[Service]
Type=simple
User=pi
ExecStart=/usr/local/bin/lastcast
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
Notify systemd that a new lastcast.service file exists and tell it to start it during the boot sequence:
sudo systemctl daemon-reload
sudo systemctl enable lastcast.service
You can start the service manually:
sudo systemctl start lastcast.service
Restart the system:
sudo reboot
Check the status of the service:
sudo systemctl status lastcast.service