Ubuntu
Postinstall
Network Configuration
netplan
Newer Ubuntu distributions use Netplan to create[1] network configurations:
# cat /etc/netplan/01-netcfg.yaml network: ethernets: eth0: dhcp4: true dhcp6: true # netplan apply
interfaces
Example static network configuration:
# cat /etc/network/interfaces auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.0.3 netmask 255.255.255.0 gateway 192.168.0.1 # cat /etc/resolv.conf nameserver 192.168.0.1 domain example.com search example.com
For some reason, Ubuntu introduced DNS information in interfaces(5) - that's what resolv.conf(5)
is for. Let's get rid of those:
sed '/dns/d' -i /etc/network/interfaces
GRUB
$ cat /etc/default/grub GRUB_DEFAULT=0 # GRUB_HIDDEN_TIMEOUT # GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=15 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8 console=tty0 nomodeset gfxpayload=text" GRUB_CMDLINE_LINUX="" GRUB_TERMINAL="console serial" GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1" GRUB_DISABLE_RECOVERY="true"
$ sudo update-grub
sources.list
Be sure to use a near mirror server:
deb http://us.archive.ubuntu.com/ubuntu/ bionic main universe restricted multiverse deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main universe restricted multiverse deb http://security.ubuntu.com/ubuntu/ bionic-security main universe restricted multiverse # deb http://us.archive.ubuntu.com/ubuntu/ bionic-proposed main universe restricted multiverse # deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main universe restricted multiverse # deb http://archive.canonical.com/ubuntu/ bionic partner # deb http://archive.canonical.com/ubuntu/ bionic-proposed partner # deb http://extras.ubuntu.com/ubuntu/ utopic main
Valid repositories are:
- main - Canonical-supported free and open-source software
- universe - Community-maintained free and open-source software
- restricted - Proprietary drivers for devices
- multiverse - Software restricted by copyright or legal issues
- partner - Access to proprietary and closed-source software
- extras - New applications that are not in the repositories at the time of release
There's also the mirror://
URI protocol handler:
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main universe
Note: apt-file
does not understand this, yet![2]
Packages
Install missing packages:
apt-get install acl apt-listchanges atop attr autossh bc bzip2 ca-certificates curl deborphan debsums git haveged s-nail htop iftop iotop irqbalance ksh less libpam-tmpdir lsof mlocate netcat-openbsd openssh-server p7zip-full pbzip2 pigz pv pwgen rsync screen sharutils smartmontools strace sudo sysstat vim vnstat whois zsh
For x86 based systems:
firmware-iwlwifi i7z intel-microcode mcelog memtest86+ msr-tools
For desktop systems:
chromium flashplugin-nonfree gedit gnome-core gnome-themes gnome-tweak-tool icedove enigmail firefox libcanberra-gtk-module xul-ext-https-everywhere xul-ext-noscript xul-ext-refcontrol libreoffice-calc libreoffice-writer pidgin pidgin-otr rdesktop sox xtightvncviewer ekiga
Miscellaneous
Clean up a few things:
rm -rf /initrd.img /vmlinuz /media /srv rm /etc/motd && touch /etc/motd
Tune some defaults:
sed 's/,errors=remount-ro//' -i /etc/fstab tune2fs -e remount-ro /dev/sda1
sed 's/=[Nn][Oo]/=Yes/' -i /etc/default/bootlogd sed 's/VERBOSE=no/VERBOSE=yes/;s/FSCKFIX=no/FSCKFIX=yes/' -i /etc/default/rcS sed 's/^#RUN=/RUN=/;s/OPTS=""/OPTS="-s"/' -i /etc/default/cachefilesd
dpkg-reconfigure -p low debconf # e.g. choose Dialog and low
Install the software-properties-common package to be able to use add-apt-repository:
$ add-apt-repository ppa:foo-team/stable Foo is graphical client to do stuff. This PPA contains stable releases. If you are looking for daily snapshots which may be more recent, see: <https://launchpad.net/~foo-team/+archive/ubuntu/unstable> More info: https://launchpad.net/~foo-team/+archive/ubuntu/stable Press [ENTER] to continue or Ctrl-c to cancel adding it.
Serial Console
Upgrading
Manual
Let's say we want to upgrade from Natty (11.04) to Oneiric (11.10):
sed 's/natty/oneiric/' -i.bak /etc/apt/sources.list apt-get update apt-get -V dist-upgrade apt-get clean deborphan --guess-all
Note: for release upgrades, we might want to use aptitude
instead of apt-get
:
aptitude update aptitude safe-upgrade aptitude full-upgrade # aka dist-upgrade
update-manager
However, Ubuntu recommends to handle release upgrades with update-manager:
$ apt-get install update-manager-core $ grep ^P /etc/update-manager/release-upgrades Prompt=normal # never, normal, lts do-release-upgrade -d