The below guide allows one to install latest Ubuntu MATE into disk image and then optionally copy this image file to the external drive.
This method maybe used for testing purposes or as alternative for the installation from now obsolete netboot/mini.iso.
Prepare Ubuntu MATE disk file
Install necessary tools:
sudo apt-get install debootstrap kpartx qemu-kvm
Allocate 16 Gb of space for virtual disk file:
fallocate -l 16G ~/mate-debootstrap.raw
Create partitions on this disk file with any software. Below is fdisk
method:
(
echo n # new partition
echo p # it is primary
echo # and first
echo # starts at default
echo # ends at end
echo w # write changes
) | fdisk ~/mate-debootstrap.raw
Create loop-devices for ~/mate-debootstrap.raw
file using kpartx
:
sudo kpartx -a -v ~/mate-debootstrap.raw
and format its first partition (check exact device name with losetup
) with label:
sudo mkfs.ext4 /dev/mapper/loop11p1 -L MATE
then mount it
sudo mkdir /mnt/dbs-target
sudo mount /dev/mapper/loop11p1 /mnt/dbs-target
Run debootrap
inside the newly created file-system
-
without proxy
sudo debootstrap --variant=minbase --arch=amd64 hirsute /mnt/dbs-target
-
with specified proxy
sudo env http_proxy=http://192.168.3.222:8000 debootstrap --variant=minbase --arch=amd64 hirsute /mnt/dbs-target
Mount necessary file-systems:
sudo mount --bind /dev /mnt/dbs-target/dev
sudo mount --bind /proc /mnt/dbs-target/proc
sudo mount --bind /sys /mnt/dbs-target/sys
Chroot to the target file-system
Chroot to the target file-system:
sudo chroot /mnt/dbs-target
export PS1="(debootstrap) $PS1"
export DEBIAN_FRONTEND=noninteractive
Create neccessary list of repositories:
cat << EOF > /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse
EOF
Optionally specify proxy for the APT:
echo 'Acquire::http::Proxy "http://192.168.3.222:8000";' > /etc/apt/apt.conf.d/99proxy
Update package lists and install upgrades:
apt-get update
apt-get dist-upgrade
Create fstab file with declaration of file-systems:
echo "LABEL=MATE / ext4 noatime 0 1" > /etc/fstab
Install kernel and bootloader packages:
apt-get install linux-image-generic grub2
Place bootloader to the disk (consult about exact name using findmnt /
):
grub-install /dev/loop11
update-grub
Install useful software:
apt-get install bash-completion htop mc
Install Ubuntu MATE desktop as task:
apt-get install ubuntu-mate-desktop^
Configure Network Manager to manage all devices:
cat << EOF > /etc/NetworkManager/conf.d/01-nm-manage.conf
[keyfile]
unmanaged-devices=none
EOF
Final steps
Create user named user (rename to needed):
useradd -m -G adm,cdrom,sudo,dip,plugdev,lpadmin -s /bin/bash user
passwd user
Set hostname:
echo ubuntu > /etc/hostname
Optionally remove proxy configuration file:
rm /etc/apt/apt.conf.d/99proxy
Exit from chroot and umount file-systems:
exit
sudo umount /mnt/dbs-target/{dev,proc,sys,}
sudo kpartx -d -v ~/mate-debootstrap.raw
Boot freshly installed system
Here we have three options to boot:
-
using QEMU-KVM:
kvm -m 2048 -drive file=~/mate-debootstrap.raw,format=raw
-
using VirtualBox
VBoxManage internalcommands createrawvmdk -filename ~/mate-debootstrap.vmdk -rawdisk ~/mate-debootstrap.raw
and then attach this disk to the virtual machine.
-
by copying to physical drive to boot using legacy BIOS mode.
Sources and references: