Raspberry PI Config & Setup - daniel-hong-sicis/streaming GitHub Wiki

USB mount Raspberry PI

ls -l /dev/disk/by-uuid/

blkid
lsblk

Step 3 – Create a Mount Point
sudo mkdir /media/usb
sudo chown -R pi:pi /media/usb

sudo mount -t vfat /dev/sda1 /media/usb

sudo umount /media/usb

Install OpenJDK Java 8 on Raspberry Pi

To install OpenJDK 8, enter the following in a terminal window:

sudo apt update
sudo apt install openjdk-8-jdk
Installing Java 8 on Raspberry Pi from terminal.
The first command updates the list of software packages in your repositories. The second command installs Java OpenJDK 8.

If necessary, type Y and hit Enter to confirm and allow the process to complete.

You can verify the installation with:

java –version
The system will display the software version. It should display something similar to:

How to check installed java version on Raspberry Pi.
Note: If you have installed Java 11 prior to installing Java 8, the system will display the version of your Java 11 instance. That is because the system defaults to using the latest Java version.

Move on to the next section to set the default Java version manually.

Set Default Java Version (Optional)

If you have installed both OpenJDK 8 and 11, your default version will probably be the latest version (OpenJDK 11). You can check your system’s default Java version with:

java –version

To manually set a different Java version, start by running the following command:

sudo update-alternatives --config java

Install Tomcat9 as service

cd /usr/lib/systemd/system

vi tomcat9.service

tomcat9.service

[UNIT]
Description=tomcat9
After=syslog.target network.target

[Service]
Type=forking

Environment="JAVA_HOME=/usr"
Environment="CATALINA_HOME=/usr/tomcat9"
Environment="CATALINA_BASE=/usr/tomcat9"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"

ExecStart=/usr/tomcat9/bin/startup.sh
ExecStop=/usr/tomcat9/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Register as as service

systemctl enable tomcat9.service 

RTP Client Configuration

cd /usr/lib/systemd/system
sudo vi rtc5004.service

rtp5004.service

[UNIT]
Description=rtp5004
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/streaming/720big-5004.sh
WorkDirectory=/streaming

User=pi
Group=sudo
UMask=0007
RestartSec=30
Restart=always

[Install]
WantedBy=multi-user.target

rtp5006.service

[UNIT]
Description=rtp5006
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/streaming/720big-5006.sh
WorkDirectory=/streaming

User=pi
Group=sudo
UMask=0007
RestartSec=30
Restart=always

[Install]
WantedBy=multi-user.target

rtp5008.service

[UNIT]
Description=rtp5008
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/streaming/720big-5008.sh
WorkDirectory=/streaming

User=pi
Group=sudo
UMask=0007
RestartSec=30
Restart=always

[Install]
WantedBy=multi-user.target

rtp5010.service

[UNIT]
Description=rtp5010
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/streaming/720big-5010.sh
WorkDirectory=/streaming

User=pi
Group=sudo
UMask=0007
RestartSec=30
Restart=always

[Install]
WantedBy=multi-user.target

Register rtp client services

sudo systemctl daemon-reload 

sudo systemctl enable rtp5004.service
sudo systemctl enable rtp5006.service
sudo systemctl enable rtp5008.service
sudo systemctl enable rtp5010.service

sudo systemctl start rtp5004.service
sudo systemctl start rtp5006.service
sudo systemctl start rtp5008.service
sudo systemctl start rtp5010.service