=^.^=

Adjust TTY (Text Console/Terminal) Resolution for GRUB and Linux

karma

Most modern linux distributions will attempt to set the text console (for historical reasons also referred to as TTY, for TeleTYpewriter) resolution to the primary display's maximum native resolution. You may find this is not the case on your system, or more commonly these days, that the virtual display resolution of your virtual machine is undesirable. Personally I most commonly find this to be a problem when working on virtual machines through the Citrix Hypervisor XenCenter client software; when using a smaller resolution on the client machine it is necessary to constantly scroll the Console tab/undocked window up and down or scale the display which results in degraded image quality.

In ye olden days one would set the resolution using a code and the vga= kernel command line option. You can still do that however if you are booting with GRUB you can set the gfxpayload environment variable with a human-readable resolution and both grub and the kernel will run a the specified resolution.

The following edits are made to the /etc/default/grub configuration file. GRUB configuration has become complicated over the years so this meta-configuration composed of variables was introduced as an alternative to directly editing the file actually used by the bootloader directly. Among other things it allows one to specify settings that persist and are applied to multiple boot options. Since kernel upgrades and the like may overwrite that file (depending on your distribution) it's best to play ball with this system. After making your edits make sure /boot is mounted read-write if it is on another partition and run your distribution's GRUB update script (common syntax below) as root to effect the changes to the active GRUB configuration file.

If you choose to do it the old way add your vga= line to GRUB_CMDLINE_LINUX_DEFAULT; if there are already options contained in this string append it with a space. The VGA codes are such:

Colour bits Colours 640×480 800×600 1024×768 1280×1024 1400×1050 1600×1200
8 bits 256 colors 769 771 773 775
15 bits 32,768 colors 784 787 790 793
16 bits 65,536 colors 785 788 791 794 834 884
24 bits 16,777,216 colors 786 789 792 795

In my case, I would like the console to be a manageable 800x600 with 24-bit colour. My vga option would look like: vga=789.

We can determine the video modes supported by GRUB by interrupting the boot menu and entering the GRUB command line on startup. Press the c key to enter the command line.

grub> set pager=1 grub> vbeinfo

This will display a table of supported resolutions. Back in /etc/default/grub we want to make sure the linux kernel inherits GRUB's resolution and doesn't try to do its own thing. We're going to add the nomodeset option instead of vga= to the kernel command line and specify GRUB's resolution in GRUB_GFXPAYLOAD_LINUX. Try to find these variables, they should already exist. If they do not, create them:

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" GRUB_GFXPAYLOAD_LINUX="800x600"

Now to update the active configuration file, depending on your system, run:

update-grub grub-update grub-mkconfig -o /boot/grub/grub.cfg grub2-mkconfig -o /boot/grub2/grub.cfg

Favourite Redhat RHEL/CentOS/Fedora Packages

karma

I frequently start a fresh install with the minimal distribution. This makes for a lean, space-efficient virtual machine but leaves a number of tools missing. This page serves as a (living/in progress) quick list of all the software I like to install as soon as a new environment is running so I don't have to reach for it later, in an emergency.

In a similar vein, check out my vastly longer and more detailed Favourite Windows Software page to outfit your fresh Windows installations.

If you choose a different preconfiguration of packages (i.e. Server instead of Minimal) some of these tools will already be available, but it doesn't hurt to bundle them all on the same command line.

Some of these packages will require enabling the Extra Packages for Enterprise Linux repos and you will probably end up needing them anyway:

dnf install epel-release

To install epel-release plus the repository for packages coming in the next minor version you can run:
dnf install \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \ https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

Basic Tools (Headless)

With trailing backslashes so the entire list can be selected, copied and pasted into a terminal:

Notes

  • As of CentOS 8 finger has been deprecated with no replacement.
  • As of CentOS Stream 9 the package containing ifconfig, route, etc. that was formerly named net-misc is now known as net-tools
  • btop is an even prettier enhanced top replacement than htop, however it may pull in innumerable otherwise needless graphical sang GUI dependencies particularly on a headless system where they would otherwise not already be called upon by a full GUI/DE installation.

Graphical Desktop (GUI)

Colour me bloaty, but I like KDE on workstations. Ancillary machines can putter along with xfce or whatever, if they absolutely have to have a desktop environment at all. Which, clearly, I have a strong aversion to. You probably should too.

dnf --enablerepo=epel,epel-next,crb group -y install "KDE Plasma Workspaces"

  • dnf install \
  • tigervnc \
  • remmina \
  • camorana \
  • k3b \
  • amarok \
  • wireshark \
  • audacity \
  • deluge \
  • kleopatra

Personal Indulgences

  • youtube-dl should be installed from Github to ensure proper operation with YouTube's latest DOM:

    To install it right away for all UNIX users (Linux, OS X, etc.), type:
    sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl

    If you do not have curl, you can alternatively use a recent wget:
    sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl

    You can also use pip:
    sudo pip install --upgrade youtube_dl

Text-based browsers elinks, links and lynx now require enabling the PowerTools repository:
dnf --enablerepo=PowerTools install elinks links lynx
NOTE as of RHEL 8 the repo is now called powertools with no capitalization. It has been removed as of CentOS Stream 9.

Installing ifconfig on RedHat Fedora, RHEL, CentOS 7, 8, CentOS Stream 9 and Up

karma

ifconfig has been deprecated in favour of the ip utility for many years and was removed in RHEL/CentOS 7. Being a creature of habit, I choose to install it anyway so when I reach for it I don't waste time realizing and correcting my mistake. It is available in the net-misc package:

dnf install net-misc

As of CentOS Stream 9 the package is now named net-tools:

dnf install net-tools

How to Install screen on RedHat (CentOS/RHEL/Fedora/Rocky Linux)

karma

screen was included in the default repositories distributed with RHEL/CentOS 7 and earlier. Since RHEL/CentOS 8 it is now necessary to configure the Extra Packages for Enterprise Linux (EPEL) repos, which you're probably going to need eventually anyway.

dnf install epel-release

Now you can install screen as usual:

dnf install screen

Basic NFS Server and Client on RHEL/CentOS, Debian/Ubuntu and Derivatives

karma

Server

Install the NFS utilities, start and configure the service to run automatically on boot:

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools systemctl enable nfs-server.service systemctl start nfs-server.service

To configure firewalld to permit network access to the NFS services run:
firewall-cmd --permanent --add-service=nfs firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --reload

Debian/Ubuntu
apt install nfs-kernel-server rpcbind systemctl enable nfs-kernel-server systemctl start nfs-kernel-server

To configure ufw to permit network access to the NFS services run:
ufw allow from 192.168.0.0/24 to any port nfs ufw enable

Configuration files are located at /etc/nfs.conf and /etc/nfsmount.conf.

Create or edit /etc/exports:
/mnt/share1 192.168.0.0/24(ro) /mnt/share2 192.168.0.0/24(rw,async) /mnt/share3 192.168.0.0/24(rw,sync) /mnt/share4 192.168.0.0/24(rw,sync,no_all_squash,root_squash)

Specify the single IP address or range in CIDR notation that a share should be accessible to followed by its options in (brackets).

See man exports for detailed information about per-share configuration options.

To reload the exports configuration live, run:
exportfs -ar

To configure disk quotas please see Mass Virtual Hosting Part Three: Disk Quotas (including NFS).

Client

RHEL/CentOS
dnf install nfs-utils nfs4-acl-tools

Debian/Ubuntu
apt install nfs-common

To view the exported shares on the remote server:
showmount -e 192.168.0.100

To mount a remote share:
mount -t nfs 192.168.0.100:/mnt/share1 /mnt/shared

To add a remote share to fstab (automatically mount at boot, simplified mount /mountpoint):
192.168.0.100:/mnt/share1 /mnt/shared nfs defaults 0 0