Portable Ubuntu Server
Network
I applied the method by N0rbert to Ubuntu Server installed from the file
ubuntu-20.04.3-live-server-amd64.iso
The following method makes the installed server's network portable between computers. I installed it in a Toshiba laptop and tested it in a Dell Latitude E7240 and a Lenovo V130.
The main difference compared to the method by N0rbert is that the package network-manager
must be installed (before tampering with the network system).
sudo apt install network-manager
Restore Network Manager renderer:
cat <<EOF | sudo tee /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
EOF
Apply netplan configuration with:
sudo netplan apply
Restart NetworkManager
sudo service network-manager restart
sudo service NetworkManager restart
I ran also the following command to restore contents of /etc/network/interfaces
(without checking if it was necessary)
cat <<EOF | sudo tee /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
EOF
More details in order to make the installation portable
It is a good idea to unplug, disconnect or otherwise disable the internal drive when the Ubuntu Server is installed. Otherwise it can easily happen that part of the boot system will be written to the internal drive, and the system will not be portable. (It is very easy to unplug the internal drive of the Toshiba where I installed the system.)
I installed the system in UEFI mode, and in order to make it portable also to computers running in BIOS mode alias CSM alias legacy mode, booting via grub-pc must also be implemented.
See the detailed tips in the following links,
Custom Portable Ubuntu system
This method can also be used to create a custom portable Ubuntu system, not only a server, but also a custom desktop system for example with a simple window manager (like fluxbox
).