Difference between revisions of "Install Pibox V3 on Ubuntu ( 64 bits )"

From Giss
(Start the back-end)
(Epilog : Try it !)
 
(38 intermediate revisions by the same user not shown)
Line 43: Line 43:
 
== Get the App sources ==
 
== Get the App sources ==
  
> cd ~  
+
  cd ~  
 +
  mkdir pibox
 +
  cd pibox
 +
  git clone http://git.rybn.org/rybn/pibox_v3_back.git
 +
  git clone http://git.rybn.org/rybn/pibox_v3_front.git
 +
  cd pibox_v3_back
 +
  git checkout develop
  
> mkdir pibox
+
== Check the sources ==
  
> cd pibox  
+
There was a problem sometimes that GST.init was not called at the right time,
 +
so check that your python main script is correct :
 +
  cd ~/pibox/pibox_v3_back
 +
  vi app/main.py
  
> git clone http://git.rybn.org/rybn/pibox_v3_back.git
+
  change line 57 :
 +
 
 +
  Gst.debug_set_active(True)
 +
  Gst.debug_set_default_threshold(1)
 +
  Gst.debug_set_threshold_for_name("eos", 5)
 +
  Gst.init(None)
  
> git clone http://git.rybn.org/rybn/pibox_v3_front.git
+
  to
  
> cd pibox_v3_back
+
  Gst.init(None)
 +
  Gst.debug_set_active(True)
 +
  Gst.debug_set_default_threshold(1)
 +
  Gst.debug_set_threshold_for_name("eos", 5)
  
> git checkout develop
+
It could be that your version has already the modification, in this case, skip this step.
  
 
== Install dependencies ==
 
== Install dependencies ==
  
> sudo apt-get update
+
  sudo apt-get update
 
+
  sudo apt install python3-pip libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad  
> sudo apt install python3-pip libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-plugins-base-apps libglib2.0-dev libgirepository1.0-dev libcairo2-dev pulseaudio dnsmasq hostapd docker docker-compose
+
  sudo apt install gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x  
 
+
  sudo apt install gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-plugins-base-apps libglib2.0-dev libgirepository1.0-dev
> pip3 install --upgrade setuptools
+
  sudo apt install libcairo2-dev pulseaudio dnsmasq hostapd docker docker-compose
 
+
  pip3 install --upgrade setuptools
> pip3 install --upgrade pip  
+
  pip3 install --upgrade pip  
 
+
  pip3 install -r requirements.txt
> pip3 install -r requirements.txt
 
  
 
== Adjust pulse configuration ==
 
== Adjust pulse configuration ==
  
edit /etc/pulse/client.conf as root
+
edit /etc/pulse/client.conf as root ( sudo vi /etc/pulse/client.conf ) and set :
and set :
 
  
 
+
  enable-shm = yes
enable-shm = yes
+
  shm-size-bytes = 1000000
 
 
shm-size-bytes = 1000000
 
  
 
== Add you user to pulse audio group ==
 
== Add you user to pulse audio group ==
  
 
+
  sudo usermod -a -G pulse chevil
> sudo usermod -a -G pulse chevil
+
  sudo usermod -a -G pulse-access chevil
 
 
> sudo usermod -a -G pulse-access chevil
 
  
 
== Modify paths in app/main.py ==
 
== Modify paths in app/main.py ==
Line 90: Line 101:
 
edit ~/pibox/pibox_v3_back/app/main.py  
 
edit ~/pibox/pibox_v3_back/app/main.py  
  
 +
  change :
 +
  /etc/wpa_supplicant/wpa_supplicant.conf
 +
  to :
 +
  /etc/dbus-1/system.d/wpa_supplicant.conf
  
change :
+
  change :
 +
  /sys/class/ieee80211/phy1/device/net
 +
  to :
 +
  /sys/class/ieee80211/phy0/device/net
  
/etc/wpa_supplicant/wpa_supplicant.conf
+
  * Note : this could be wrong, this depends on how many network cards you have in your system, so check what is in /sys/class/ieee80211
  
to :
+
== Create sound directory ==
  
/etc/dbus-1/system.d/wpa_supplicant.conf
+
  cd ~/pibox/pibox_v3_back
 +
  mkdir sounds
 +
  chmod 777 sounds
  
 +
== Setup the front-end ==
  
change :
+
  cd ~/pibox/pibox_v3_front
 +
  rm package-lock.json
 +
  npm i
  
/sys/class/ieee80211/phy1/device/net
+
== Restart your machine ==
  
to :
+
  reboot
  
/sys/class/ieee80211/phy0/device/net
+
== Start the back-end ==
  
   * this could be wrong, this depends on how many network cards you have in your system, so check what is in /sys/class/ieee80211
+
   cd ~/pibox/pibox_v3_back
 +
  python3 app/main.py
  
== Create sound directory ==
+
* Note : it will ask your password here to execute commands with sudo, it's normal
 +
 
 +
Enter your password for sudo and wait for the message :
  
 +
  INFO:    Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
  
> cd ~/pibox/pibox_v3_back
+
== Start the front-end ==
  
> mkdir sounds
+
  cd ~/pibox/pibox_v3_front
 +
  npm run start
  
> chmod 777 sounds
+
Wait for the message ( it might take a while ) :
  
== Setup the front-end ==
+
  ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
  
> cd ~/pibox/pibox_v3_front
+
== Epilog : Try it ! ==
  
> rm package-lock.json
+
'''That's it !'''
  
> npm i
 
  
== Restart your machine ==
+
Your Pibox V3 UI should be available at :
 +
http://localhost:4200
  
> reboot
+
[[File:Pibox.png|600x400px]]
  
== Start the back-end ==
 
  
> cd ~/pibox/pibox_v3_back
+
'''Err, Wait, no, There is a problem on Ubuntu 20.04 : '''
  
> python3 app/main.py
 
  
* Note : it will ask your password here to execute commands with sudo, it's normal
+
The libshout ( 2.4.3-1 ) has a regression and does not work ( you cannot send stream out ),
  
== Start the front-end ==
+
so you have to use an older version of libshout,
 +
here is how you can install it, overriding the official one :
  
> cd ~/pibox/pibox_v3_front
+
  sudo apt-get install xz-utils wget
 +
  cd /tmp
 +
  wget http://mirrors.kernel.org/ubuntu/pool/main/libs/libshout/libshout3_2.4.1-2build1_amd64.deb
 +
  ar xv libshout3_2.4.1-2build1_amd64.deb
 +
  xz -dc data.tar.xz | tar xv
 +
  sudo cp ./usr/lib/x86_64-linux-gnu/libshout.so.3.2.0 /usr/lib/x86_64-linux-gnu/
 +
  sudo ldconfig -v
  
> npm run start
 
  
 +
'''Now, Restart the App it should be ROLLING !!'''
  
 +
== Addendum : Stop the App ==
  
'''That's it !'''
+
You should have started the back and the front in 2 separate terminal windows,
 +
so use Ctrl-c in these windows to stop both.
  
 +
If it doesn't stop, use the old trick :
  
Your Pibox V3 UI should be available at :
+
  Ctrl-z
http://localhost:4200
+
  kill -9 %1

Latest revision as of 18:43, 25 December 2020

INSTALL for PIBOX V3 on a Ubuntu Laptop/Desktop ( 18.04 or 20.04 )

Pibox V3 app was developped by http://p-node.org and in particular by jack@rybn.org and it is aimed at providing a streaming station/solution on Raspberry PIs.

It can also act as a radio FM transmitter on Pi boxes, but this part will not be available on PCs.

Here are the instructions to install it on a regular Ubuntu system :

PREREQUISITES

  • A ubuntu 18.04 or 20.04
  • Tools : git, python3, node.js, npm
 ** on Ubuntu 18.04, we used :
    git 2.17.1 
    python 3.6.9 
    node.js v12.10.0 
    npm v6.9.0

IMPORTANT !!

You must install and run under the account that started the gnome session to be able to connect to pulse audio.

So, use your normal account and not the pi account like indicated in some p-node manuals.

My user here is chevil, my usual account.

INSTALL

Pibox V3 consists of 2 parts :

* a back-end which is a python app

* a front-end which is an angular/node.js app

Get the App sources

 cd ~ 
 mkdir pibox
 cd pibox 
 git clone http://git.rybn.org/rybn/pibox_v3_back.git
 git clone http://git.rybn.org/rybn/pibox_v3_front.git
 cd pibox_v3_back
 git checkout develop

Check the sources

There was a problem sometimes that GST.init was not called at the right time, so check that your python main script is correct :

 cd ~/pibox/pibox_v3_back
 vi app/main.py
 change line 57 :
 
 Gst.debug_set_active(True)
 Gst.debug_set_default_threshold(1)
 Gst.debug_set_threshold_for_name("eos", 5)
 Gst.init(None)
 to
 Gst.init(None)
 Gst.debug_set_active(True)
 Gst.debug_set_default_threshold(1)
 Gst.debug_set_threshold_for_name("eos", 5)

It could be that your version has already the modification, in this case, skip this step.

Install dependencies

 sudo apt-get update
 sudo apt install python3-pip libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 
 sudo apt install gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x 
 sudo apt install gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-plugins-base-apps libglib2.0-dev libgirepository1.0-dev
 sudo apt install libcairo2-dev pulseaudio dnsmasq hostapd docker docker-compose
 pip3 install --upgrade setuptools
 pip3 install --upgrade pip 
 pip3 install -r requirements.txt

Adjust pulse configuration

edit /etc/pulse/client.conf as root ( sudo vi /etc/pulse/client.conf ) and set :

 enable-shm = yes
 shm-size-bytes = 1000000

Add you user to pulse audio group

 sudo usermod -a -G pulse chevil
 sudo usermod -a -G pulse-access chevil

Modify paths in app/main.py

edit ~/pibox/pibox_v3_back/app/main.py

 change :
 /etc/wpa_supplicant/wpa_supplicant.conf
 to :
 /etc/dbus-1/system.d/wpa_supplicant.conf
 change :
 /sys/class/ieee80211/phy1/device/net
 to :
 /sys/class/ieee80211/phy0/device/net
 * Note : this could be wrong, this depends on how many network cards you have in your system, so check what is in /sys/class/ieee80211

Create sound directory

 cd ~/pibox/pibox_v3_back
 mkdir sounds
 chmod 777 sounds

Setup the front-end

 cd ~/pibox/pibox_v3_front
 rm package-lock.json
 npm i

Restart your machine

 reboot

Start the back-end

 cd ~/pibox/pibox_v3_back
 python3 app/main.py
* Note : it will ask your password here to execute commands with sudo, it's normal

Enter your password for sudo and wait for the message :

 INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

Start the front-end

 cd ~/pibox/pibox_v3_front
 npm run start

Wait for the message ( it might take a while ) :

 ** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **

Epilog : Try it !

That's it !


Your Pibox V3 UI should be available at : http://localhost:4200

Pibox.png


Err, Wait, no, There is a problem on Ubuntu 20.04 :


The libshout ( 2.4.3-1 ) has a regression and does not work ( you cannot send stream out ),

so you have to use an older version of libshout, here is how you can install it, overriding the official one :

 sudo apt-get install xz-utils wget
 cd /tmp 
 wget http://mirrors.kernel.org/ubuntu/pool/main/libs/libshout/libshout3_2.4.1-2build1_amd64.deb
 ar xv libshout3_2.4.1-2build1_amd64.deb
 xz -dc data.tar.xz | tar xv
 sudo cp ./usr/lib/x86_64-linux-gnu/libshout.so.3.2.0 /usr/lib/x86_64-linux-gnu/
 sudo ldconfig -v


Now, Restart the App it should be ROLLING !!

Addendum : Stop the App

You should have started the back and the front in 2 separate terminal windows, so use Ctrl-c in these windows to stop both.

If it doesn't stop, use the old trick :

 Ctrl-z
 kill -9 %1