Skip to content

sahilrajput03/learn-raspberry

Repository files navigation

Learn Raspberry

Some saved info about the device.

TODO:

  • Try out installing debian coz its only 400mb and its base of 90% linux distros. Watch how to install by DistroTube: Click here. Good thing is that I can have my raspbery pi attachd to my tv and I can switch to pc anytime I want, but I need to make room for the harddisk to be attached to the raspi to it all the time for that, so I can use my harddisk as a bit drive with it. Also, another reason to use debian instead of ubuntu server is that ubuntu server size is around 1.2 GB whereas the debian gui os is only 380MB only.

Playing mp3 files?

*FUCK: Use sudo to play files: (wated 4 hours to figure this out).

Play mp3 file with ffmplay utility:

# insatll ffmpeg
sudo apt install ffmpeg
# Play mp3 file:
sudo ffplay -nodisp ./sample-3s.mp3

# With sax:
# Installation: ```
sudo apt-get install sox libsox-fmt-all
# Play mp3 file:
sudo play sample-3s.mp3

Playing files such that they keep playing after logout when ssh?

# 1. download youtube files for audio only via youtube-dl-gui
# 2. convert to mp3 using: https://convertio.co/opus-mp3/
# 3. use `server -l 8080` and download that file to raspberry pi
# 4. run the command `nohup sudo play myfile.mp3 &` to run it in background
# 5. now use `exit` commadn to exit logout and exit ssh session

You can control the sound level via:

sudo alsamixer

Device Details

  • raspberry pi4 model-b

  • Processor: Quad core ARM Cortex-A72 processor from Specification page here.

  • Archlinux supports this platform (source: Click here):

    image

Installation of ubuntu server

  • Install the Ubuntu Server 64 bit using Raspberry Pi Imager tool (you can simply choose from the list and it'll download from internet automatically).
  • Insert memcard to raspberry pi and also plug ethernet cable to it to connect to router.
  • Now see the local ip address from the router's wired devices section.
  • Now you can simply connect to it by ssh ubuntu@IP and use password ubuntu, and then need to set up new password as prompted when you connect to server for the first time.
  • You can copy your private key file by: ssh-copy-id -i ~/.ssh/myKeys/april-2022 pi where pi is my ssh alias(otherwise you can use ip address in its place). Also, you must specify the private key path in IdentityFile key for the ssh alias definition in ~/.ssh/config file so it picks up the private key file auotmatically when you do ssh pi in future.

Connecting wifi

FYI: There is an automated way of making the os connect to wifi automatically on the first start if you put your wifi SSID and password to the network-config file as stated here in docs of mongodb.

# tldr
# UPDATED for ubuntu LTS server 22.04.03 LTS when I installed on raspberry pi on 19 Jan, 2024
# Check if ssh is running on ubuntu
service ssh status

# if ssh is not installed then follow below commands
sudo apt update
sudo apt install openssh-server

systemctl status ssh
# ssh service should be active

# enable the service so it runs on startup
systemctl enable ssh
systemctl status ssh
  1. Connecting to wifi: Install nmtui by command: sudo apt install network-manager.
  2. Now we enter password via the menu we see with nmtui program, its fun though and connect to wifi.
  3. Now we can remove the ethernet cable and just see the ip address the device gets from the same router's device page under Wi-Fi devices this time.
  4. Now we copy that ip address and use username as ubuntu and use that in our ~/.ssh/config file (by replacing old ip address which belonged to wired connnection).
  5. Now when you try to connect say by ssh pi we see some error like:
array@arch-os Downloads$ ssh ubuntu@192.168.18.13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:yF4hSRkQJjPHvVurHTNSonrGGzZMMcchSjO40uxIxgw.
Please contact your system administrator.
Add correct host key in /home/array/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /home/array/.ssh/known_hosts:18
Host key for 192.168.18.13 has changed and you have requested strict checking.
Host key verification failed.

RESULT: So, to fix that we need to run below commands and after that it will work simply. Source: Click here

# src: https://askubuntu.com/a/9804/702911
ssh-keygen -R pi
ssh-keygen -R server.example.com

Install docker

curl -fsSL https://get.docker.com -o get-docker.sh
sudo bash get-docker.sh
sudo usermod -aG docker $(whoami)

Installing nvm on ubuntu server

Src: Click here

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
# or
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash

NOTE: Running react server i.e., react-scripts on raspberry pi is not reliable at all

Becoz its too slow to run and changes made are even hiliariously slow. React server stared in 4 minutes for slasher frontend project. LOL.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages