Ubuntu/Raspberry Pi

From Chorke Wiki
Revision as of 17:17, 12 December 2024 by Shahed (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Network Config:

ls -lah /Volumes/system-boot/|grep network-config
cat <<EOF > /Volumes/system-boot/network-config
version: 2
ethernets:
  eth0:
    dhcp4: true
    optional: true
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "ChorkeOrg_2.4GHz":
        password: "sadaqah!"
      "ChorkeOrg":
        password: "sadaqah!"
EOF

User Data:

ls -lah /Volumes/system-boot/|grep user-data
cat << \EOF > /Volumes/system-boot/user-data
#cloud-config
system_info:
  default_user:
    name: pi
chpasswd:
  expire: true
  list:
  - pi:ubuntu
ssh_pwauth: true
runcmd:
- [ df, -h, / ]
- [ sh, -xc, "echo $(date) ': hello academian!'" ]
power_state:
  mode: reboot
EOF

ls -lah /Volumes/system-boot/{.fseventsd,.Spotlight-V100}
rm -rf /Volumes/system-boot/{.fseventsd,.Spotlight-V100}

ssh [email protected]
:<<EOF
The authenticity of host '10.19.83.111 (10.19.83.111)' can't be established.
ECDSA key fingerprint is SHA256:9Lgs5Xxsypm4s/3F87TU2EMh6vUz6pjAMaNHXUDImVs.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.19.83.111' (ECDSA) to the list of known hosts.
[email protected]'s password: 
You are required to change your password immediately (administrator enforced)
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-1042-raspi aarch64)

WARNING: Your password has expired.
You must change your password now and login again!
Changing password for pi.
Current password: 
New password: 
Retype new password: 
passwd: password updated successfully
Connection to 10.19.83.111 closed.
EOF

ssh [email protected]
:<<EOF
[email protected]'s password: 
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-1042-raspi aarch64)
EOF

Network Config

dpkg --list|grep network-manager
dpkg --list|grep wpasupplicant
dpkg --list|grep iw
apt -qq list network-manager
apt -qq list wpasupplicant
apt -qq list iwd
sudo apt install network-manager
sudo apt install wpasupplicant
sudo apt install iwd

sudo apt install net-tools
sudo nmcli radio all
sudo nmcli con help
sudo nmcli device wifi list
sudo nmcli device
sudo nmcli con
sudo nmcli dev wifi con 'ChorkeOrg_2.4GHz' password 'sadaqah!'
sudo nmcli dev wifi con 'ChorkeInc' password 'sadaqah!'
sudo nmcli dev wifi con 'ChorkeOrg' password 'sadaqah!'

Server Config

sudo apt install postgresql-12
sudo apt install mariadb-server-10.3
sudo apt install apache2
sudo systemctl enable apache2.service
sudo systemctl start apache2.service
ls -lah /usr/lib/systemd/system/
sudo ufw status verbose
sudo ufw allow ssh
sudo ufw enable

sudo groupadd --system lxd
sudo usermod -G lxd -a pi
sudo newgrp lxd
sudo lxd init
:'
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: 
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]: 
Create a new ZFS pool? (yes/no) [default=yes]: 
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: 
Size in GB of the new loop device (1GB minimum) [default=5GB]: 15GB
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the LXD server to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
'

Desktop Config

sudo apt install tasksel
sudo tasksel install kubuntu-full
sudo tasksel install kubuntu-desktop
sudo apt install sddm
sudo dpkg-reconfigure sddm

sudo apt install kde-plasma-desktop -y
sudo apt purge kde-plasma-desktop -y
sudo apt install kde-standard -y
sudo apt purge kde-standard -y
sudo apt install kde-full -y
sudo apt purge kde-full -y

Device Status

sudo nmcli dev
:'
DEVICE  TYPE      STATE        CONNECTION 
wlan0   wifi      unavailable  --         
eth0    ethernet  unmanaged    --         
lo      loopback  unmanaged    --  
'

lsblk
:'
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  48.9M  1 loop /snap/core18/2127
loop1         7:1    0  57.4M  1 loop /snap/core20/1171
loop2         7:2    0    62M  1 loop /snap/lxd/21032
loop3         7:3    0    49M  1 loop /snap/core18/2248
loop4         7:4    0  28.1M  1 loop /snap/snapd/12707
loop5         7:5    0  60.7M  1 loop /snap/lxd/21843
loop6         7:6    0  28.2M  1 loop /snap/snapd/13643
mmcblk0     179:0    0 119.3G  0 disk 
├─mmcblk0p1 179:1    0   256M  0 part /boot/firmware
└─mmcblk0p2 179:2    0   119G  0 part /
'

df -h
:'
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           782M  4.0M  778M   1% /run
/dev/mmcblk0p2  118G  2.8G  110G   3% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0       49M   49M     0 100% /snap/core18/2127
/dev/loop1       58M   58M     0 100% /snap/core20/1171
/dev/loop3       49M   49M     0 100% /snap/core18/2248
/dev/loop2       62M   62M     0 100% /snap/lxd/21032
/dev/loop4       29M   29M     0 100% /snap/snapd/12707
/dev/loop5       61M   61M     0 100% /snap/lxd/21843
/dev/loop6       29M   29M     0 100% /snap/snapd/13643
/dev/mmcblk0p1  253M  120M  133M  48% /boot/firmware
tmpfs           782M     0  782M   0% /run/user/1000
'

sudo fdisk /dev/mmcblk0 -l
:'
Disk /dev/mmcblk0: 119.26 GiB, 128043712512 bytes, 250085376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf66f0719

Device         Boot  Start       End   Sectors  Size Id Type
/dev/mmcblk0p1 *      2048    526335    524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      526336 250085342 249559007  119G 83 Linux
'
sudo fdisk -l
:'
Disk /dev/loop0: 48.92 MiB, 51277824 bytes, 100152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 57.42 MiB, 60198912 bytes, 117576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 61.98 MiB, 64962560 bytes, 126880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 48.98 MiB, 51335168 bytes, 100264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 28.7 MiB, 29433856 bytes, 57488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 60.68 MiB, 63610880 bytes, 124240 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop6: 28.22 MiB, 29581312 bytes, 57776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0: 119.26 GiB, 128043712512 bytes, 250085376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf66f0719

Device         Boot  Start       End   Sectors  Size Id Type
/dev/mmcblk0p1 *      2048    526335    524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      526336 250085342 249559007  119G 83 Linux

'

Knowledge

dpkg --list|grep network-manager
dpkg --list|grep wpasupplicant
dpkg --list|grep iw
apt -qq list network-manager
apt -qq list wpasupplicant
apt -qq list iwd
sudo apt update
sudo apt upgrade
sudo apt autoremove

physical volume
sudo pvdisplay -m
sudo pvdisplay
sudo pvs
logical volume
sudo lvdisplay -m
sudo lvdisplay
sudo lvs
volume group
sudo vgdisplay -s
sudo vgdisplay
sudo vgs

lsblk
df -h
ll /dev/mm*

sudo pvscan
sudo fdisk -l
sudo fdisk /dev/mmcblk0
sudo parted /dev/mmcblk0
sudo resize2fs /dev/mmcblk0p3
sudo e2fsck -f /dev/mmcblk0p3
sudo xfs_growfs /dev/ubuntu_ubuntu/root
sudo vgdisplay -v ubuntu_ubuntu|grep -i 'Free PE'

$GRAALVM_HOME/bin/gu install native-image
sudo apt install icedtea-netx openjdk-8-jre
sudo update-alternatives --config java
sudo apt install openjdk-8-jre
sudo apt install openjdk-11-jre
sudo apt install openjdk-17-jre
sudo apt install openjdk-8-jdk
sudo apt install openjdk-11-jdk
sudo apt install openjdk-17-jdk

sudo apt install build-essential libz-dev zlib1g-dev
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.fc35.aarch64
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export ACADEMIA_HOME="$HOME/.chorke/academia"
mkdir -p $ACADEMIA_HOME/var/download
cd $ACADEMIA_HOME/var/download

wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz
wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz

tar -xvzf /home/pi/.chorke/academia/var/download/graalvm-ce-java17-linux-aarch64-21.3.0.tar.gz
tar -xvzf /home/pi/.chorke/academia/var/download/graalvm-ce-java11-linux-aarch64-21.3.0.tar.gz

ln -s /opt/cli/graalvm-ce-java11-21.3.0 /usr/lib/jvm/graalvm-ce-java11-21.3.0
ln -s /opt/cli/graalvm-ce-java17-21.3.0 /usr/lib/jvm/graalvm-ce-java17-21.3.0

update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm-ce-java11-21.3.0/bin/java 4
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm-ce-java17-21.3.0/bin/java 5
mkdir -p /opt/cli
cd /opt/cli

ls -lah /usr/lib/jvm
ls -lah /usr/lib/jvm

sudo update-alternatives --config java
sudo update-alternatives --config java

apt -qq list network-manager
apt -qq list wpasupplicant
apt -qq list iwd
sudo apt install network-manager
sudo apt install wpasupplicant
sudo apt install iwd
sudo systemctl status NetworkManager.service
sudo systemctl status wpa_supplicant.service
sudo systemctl status iwd.service

ssh-keygen -f "/home/chorke/.ssh/known_hosts" -R "10.19.83.111"
ssh-keygen -f ~/.ssh/known_hosts -R 10.19.83.111

References