en:bpi-r2:ubuntu
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:bpi-r2:ubuntu [2020/11/21 16:07] – [debootstrap] frank | en:bpi-r2:ubuntu [2023/06/08 17:06] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Ubuntu ====== | ||
+ | ===== debootstrap ===== | ||
+ | |||
+ | Steps to get ubuntu-system (use armhf as arch): https:// | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt-get install qemu-user-static debootstrap binfmt-support | ||
+ | |||
+ | distro=bionic | ||
+ | # | ||
+ | arch=armhf | ||
+ | #for bpi-r64 use arch=arm64 | ||
+ | targetdir=$(pwd)/ | ||
+ | |||
+ | |||
+ | sudo debootstrap --arch=$arch --foreign $distro $targetdir | ||
+ | |||
+ | #if you got this error: E: Cannot install into target ' | ||
+ | sudo mount -i -o remount, | ||
+ | |||
+ | sudo cp / | ||
+ | sudo cp / | ||
+ | sudo distro=$distro chroot $targetdir | ||
+ | export LANG=C | ||
+ | / | ||
+ | |||
+ | #echo " | ||
+ | #echo "deb http:// | ||
+ | #echo " | ||
+ | echo "deb http:// | ||
+ | echo " | ||
+ | echo "deb http:// | ||
+ | echo " | ||
+ | echo "deb http:// | ||
+ | echo " | ||
+ | |||
+ | echo " | ||
+ | #set root-password! else you will not be able to login | ||
+ | passwd | ||
+ | </ | ||
+ | configure fstab/... like it's done for [[debian]] | ||
+ | :!: ubuntu 18.4 uses netplan as default network-framework [[https:// | ||
+ | <code bash> | ||
+ | #exit chroot | ||
+ | exit | ||
+ | </ | ||
+ | pack: | ||
+ | <code bash> | ||
+ | cd $targetdir | ||
+ | sudo tar cvpzf ../ | ||
+ | </ | ||
+ | |||
+ | ===== install System to SD-Card ===== | ||
+ | [[storage# | ||
+ | <code bash> | ||
+ | #unpacking in root-partiton with | ||
+ | sudo tar -xpzf / | ||
+ | sudo mkdir lib/ | ||
+ | cd lib/ | ||
+ | #unpack kernel-modules here | ||
+ | </ | ||
+ | |||
+ | temporary configure network: | ||
+ | < | ||
+ | ip a | ||
+ | ip link set eth0 up | ||
+ | ip addr add 192.168.0.11/ | ||
+ | ip link set lan0 up | ||
+ | ip route add default via 192.168.0.10 #ip from your router | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | install “ifupdown” and add “netcfg/ | ||
+ | |||
+ | after reboot the " | ||
+ | |||
+ | < | ||
+ | root@bpi-r2-ubuntu: | ||
+ | lrwxrwxrwx 1 root root 39 Jun 13 10:27 / | ||
+ | #delete symlink and replace it by a static file with your settings | ||
+ | rm / | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | in ubuntu 18.4 there is a own dns-service running, which have to be disabled (followed by a reboot or stop), in order to get e.g. DNSMasq running (like in my wifi.sh-script) | ||
+ | |||
+ | systemctl disable systemd-resolved | ||
+ | systemctl stop systemd-resolved | ||
+ | ===== create the image ===== | ||
+ | <code bash> | ||
+ | imgfile=/ | ||
+ | |||
+ | #create img file from sdcard (optional if no img file available) | ||
+ | sudo dd if=/dev/sdx of=$imgfile | ||
+ | #watch state of dd from another terminal with "sudo kill -SIGUSR1 $(pidof dd)" | ||
+ | |||
+ | #truncate image to last partitions end (mbr only,do not use for gpt)...make sure your path does not contain spaces! | ||
+ | IFS=$' | ||
+ | ENDOFDATA=$(fdisk -l " | ||
+ | echo $ENDOFDATA | ||
+ | truncate --size=$[($ENDOFDATA+1)*512] $imgfile | ||
+ | #check size | ||
+ | ls -lh " | ||
+ | |||
+ | #maybe do some stuff with the img | ||
+ | loopdev=$(losetup -f) | ||
+ | sudo losetup $loopdev $imgfile | ||
+ | sudo partprobe $loopdev | ||
+ | sudo mount ${loopdev}p2 /mnt | ||
+ | ls /mnt | ||
+ | #overwrite free space with zeros for better packing and not leaving possible sensitive data | ||
+ | sudo sh -c 'cat /dev/zero >/ | ||
+ | sudo rm / | ||
+ | sudo umount /mnt | ||
+ | |||
+ | #pack image | ||
+ | gzip $imgfile | ||
+ | md5sum $imgfile.gz > $imgfile.gz.md5 | ||
+ | </ | ||
+ | |||
+ | i have uploaded my image to [[https:// | ||
+ | |||
+ | Lan0-IPv4 is 192.168.0.11 (second port,next to wan) you can change it in / | ||
+ | ===== installation ===== | ||
+ | |||
+ | Sdcard: | ||
+ | |||
+ | dd if=path/ | ||
+ | |||
+ | Emmc: | ||
+ | |||
+ | * dd if=path/ | ||
+ | * maybe you need reboot reading the partitiontable | ||
+ | * First follow steps [[storage# | ||
+ | * in / | ||
+ | * in /etc/fstab: replace / | ||
+ | |||
+ | ===== SSH ===== | ||
+ | ssh-server is installed on my image [[https:// | ||
+ | |||
+ | echo " | ||
+ | service sshd restart | ||
+ | |||
+ | you should create new host-keys for ssh... | ||
+ | |||
+ | #first delete your old keys | ||
+ | rm / | ||
+ | # | ||
+ | dpkg-reconfigure openssh-server |