Skip to content

Instantly share code, notes, and snippets.

@mmtrt
Last active August 30, 2023 09:33
Show Gist options
  • Save mmtrt/e0245f85c1f58727fb6b5c22db4ce591 to your computer and use it in GitHub Desktop.
Save mmtrt/e0245f85c1f58727fb6b5c22db4ce591 to your computer and use it in GitHub Desktop.
Deploy Ubuntu Core Image.

Note

This guide installs KDE Neon like minimal setup with custom stuff on Ubuntu 23.10 (mantic) Dev rootfs tarball with Grub bootloader as MBR partition install which can be changed by user.

Requirements

For this guide you will need to livebooted debain based linux.
Ubuntu Core rootfs tarball file.
Some patience.

Download rootfs tar of your choice version from here

https://partner-images.canonical.com/core

Format your parition.

This can be skiped if already done it from gui.
sudo mkfs.ext4 /dev/sdc2

Mount root partition on which you want to install rootfs

sudo mount /dev/sdc2 /mnt

cd to mounted partition path.

cd /mnt

Unpack rootfs tarball file to mounted partition.

sudo tar -xf ~/Downloads/*.tar.gz

Install grub in harddisk not on single partition

sudo grub-install --target=i386-pc --root-directory=/mnt /dev/sdc

Mounting home partition. [optional]

sudo mount /dev/sdb1 /mnt/home

Rsync var to /home/var [optional]

sudo rsync -va /mnt/var /mnt/home/

Renaming root var that will save original copy will be usefull incase of disaster. [optional]

sudo mv var notvar && sudo mkdir var

Binding var from home partition to root. [optional]

sudo mount --bind /mnt/home/var /mnt/var

Install arch-linux-scripts

sudo apt install arch-install-scripts

Genrate fstab

sudo su
genfstab -U /mnt >> /mnt/etc/fstab ; exit

Checking & changing fstab. [optional]

sudo nano /mnt/etc/fstab

Copy resolv file from liveboot linux to root path.

sudo cp /etc/resolv.conf /mnt/etc/resolv.conf

Mount paths to mounted root for chrooting

for f in /sys /proc /dev ; do sudo mount --rbind $f /mnt/$f ; done ; sudo chroot /mnt

Disable ipv6 for apt [optional]

echo -e "net.ipv6.conf.all.disable_ipv6 = 1\n
net.ipv6.conf.default.disable_ipv6 = 1\n
net.ipv6.conf.lo.disable_ipv6 = 1\n
net.ipv6.conf.wlan0.disable_ipv6 = 1
" > /etc/sysctl.d/60-apt-ipv6-d.conf

Install basic pkgs

apt update && apt install apt-utils bash-completion curl desktop-file-utils dialog file gpg grub2 imagemagick nano sudo wget initramfs-tools ubuntu-drivers-common -y

Don't install snapd tilix. [optional]

apt-mark hold snapd tilix

Don't install generic kernel. [optional]

Use this only when installing xanmod kernel.
apt-mark hold linux-*-generic linux-*-*-generic linux-*-5.17* linux-*-5.19*

Install generic kernel & firmware in installed root

You can skip this step if you are installing xanmod kernel.
apt update && apt install linux-{headers,image}-generic -y

Install xanmod kernel. [optional]

In this command x64v3 is used you can change it to the following.
x64v1 --- baseline All x86-64 CPUs CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2
x64v2 --- circa 2009 Nehalem / Jaguar CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3
x64v3 --- circa 2015 Haswell / Excavator AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE
echo 'deb http://deb.xanmod.org releases main' | tee /etc/apt/sources.list.d/xanmod-kernel.list && wget -qO - https://dl.xanmod.org/gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/xanmod-kernel.gpg && chown root:root /etc/apt/trusted.gpg.d/xanmod-kernel.gpg && chmod ugo+r /etc/apt/trusted.gpg.d/xanmod-kernel.gpg && chmod go-w /etc/apt/trusted.gpg.d/xanmod-kernel.gpg && apt update && apt install intel-microcode iucode-tool linux-xanmod-x64v3 -y

Add user account here

adduser mmtrt

Adding user to sudo.

Change %admin to your username then save it.
EDITOR=nano visudo

Update hostname

echo kubuntu &> /etc/hostname

Install Desktop Environment

Choices are following,
ubuntu-desktop | kubuntu-desktop | xubuntu-desktop | mate-desktop-environment | lubuntu-desktop | plasma-desktop
apt install plasma-desktop plasma-workspace-wayland

Install KDE basic apps. [optional]

Use this only when installing plasma-desktop.
apt install ark dolphin gwenview kate kde-spectacle konsole ksystemlog kcalc okular -y

Install sddm. [optional]

Use this only when installing plasma-desktop.
apt install --no-install-recommends sddm -y

Install ksysguard. [optional]

wget http://ubuntu.mirrors.tds.net/ubuntu/pool/universe/k/ksysguard/ksysguard_5.22.0-0ubuntu1_amd64.deb http://ubuntu.mirrors.tds.net/ubuntu/pool/universe/k/ksysguard/ksysguard-data_5.22.0-0ubuntu1_all.deb http://ubuntu.mirrors.tds.net/ubuntu/pool/universe/k/ksysguard/ksysguardd_5.22.0-0ubuntu1_amd64.deb && apt install ./ksysguard-data_5.22.0-0ubuntu1_all.deb ./ksysguardd_5.22.0-0ubuntu1_amd64.deb ./ksysguard_5.22.0-0ubuntu1_amd64.deb -y && rm *.deb

Install wireplumber

Use this only when installing plasma-desktop.
apt install wireplumber -y

Install netplan io

apt install netplan.io
echo -e "# Let NetworkManager manage all devices on this system\n \
network:\n \
  version: 2\n \
  renderer: NetworkManager" > /etc/netplan/01-network-manager-all.yaml
netplan generate && netplan apply

Install firefox deb version & add ppa. [optional]

echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | tee /etc/apt/preferences.d/mozilla-firefox
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | tee /etc/apt/apt.conf.d/51-unattended-upgrades-firefox && echo 'deb https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu mantic main' | tee /etc/apt/sources.list.d/ppa-mozillateam.list && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0ab215679c571d1c8325275b9bdb3d89ce49ec21" | gpg --dearmor > /etc/apt/trusted.gpg.d/ppa-mozillateam.gpg && chown root:root /etc/apt/trusted.gpg.d/ppa-mozillateam.gpg && chmod ugo+r /etc/apt/trusted.gpg.d/ppa-mozillateam.gpg && chmod go-w /etc/apt/trusted.gpg.d/ppa-mozillateam.gpg && apt update && apt install firefox -y

Install nvidia drivers 535 & add ppa. [optional]

echo 'deb https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu mantic main' | tee /etc/apt/sources.list.d/ppa-graphics-drivers.list && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2388ff3be10a76f638f80723fcae110b1118213c" | gpg --dearmor > /etc/apt/trusted.gpg.d/ppa-graphics-drivers.gpg && chown root:root /etc/apt/trusted.gpg.d/ppa-graphics-drivers.gpg && chmod ugo+r /etc/apt/trusted.gpg.d/ppa-graphics-drivers.gpg && chmod go-w /etc/apt/trusted.gpg.d/ppa-graphics-drivers.gpg && apt update && apt install nvidia-dkms-535 nvidia-driver-535 libnvidia-egl-wayland1 -y

Install user apps

Beyond Compare

wget -q "https://www.scootersoftware.com/$(wget https://www.scootersoftware.com/download.php -q -S -O - 2>&1 | grep -Eo bcompare.*amd64.deb)" -O bcompare.deb && apt install ./bcompare.deb -y && apt install -f -y && rm bcompare.deb

GitKracken

wget -q "https://release.gitkraken.com/linux/gitkraken-amd64.deb" && apt install ./gitkraken-amd64.deb -y && apt install -f -y && rm gitkraken-amd64.deb

VSCodium

wget -q "https://github.com/VSCodium/vscodium/releases/download/$(wget "https://github.com/VSCodium/vscodium/tags" -q -S -O - 2>&1 | grep -Eo "/tag/.*" | cut -d'"' -f1 | sed -r 's|/| |g' | awk '{print $2}' | head -1)/codium_$(wget "https://github.com/VSCodium/vscodium/tags" -q -S -O - 2>&1 | grep -Eo "/tag/.*" | cut -d'"' -f1 | sed -r 's|/| |g' | awk '{print $2}' | head -1)_amd64.deb" -O vscode.deb && apt install ./vscode.deb -y && apt install -f -y && rm vscode.deb

Set CPU governor Performance at system boot. [optional]

{
echo "[Unit]
Description=Set CPU Performance Governor
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'

[Install]
WantedBy=multi-user.target"
} > /lib/systemd/system/cpu-perf-governor.service
systemctl enable cpu-perf-governor

Update initramfs

update-initramfs -c -k all

Install grub & fix os-prober & Update grub

grub-install --target=i386-pc /dev/sdc && sed -i 's|#GRUB_DISABLE_OS_PROBER=false|GRUB_DISABLE_OS_PROBER=false|' /etc/default/grub && update-grub

Disable kernel mitigations. [optional]

Warning this is highly not recommended to use, otherwise your system is open to attacks.
sed -i 's/GRUB_CMDLINE_LINUX=*"/GRUB_CMDLINE_LINUX="mitigations=off/' /etc/default/grub && update-grub

Close chroot

exit

Reboot from liveboot

reboot

References

https://askubuntu.com/questions/67001/what-commands-are-needed-to-install-ubuntu-core

https://askubuntu.com/questions/1362467/cant-enable-enp3s0-ethernet-interface-and-ethernet-wired-simply-does-not-work

https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment