====== Ubuntu Tips, Tricks and Notes ====== ===== Mirrors ===== The default mirror is **%%http://us.archive.ubuntu.com/ubuntu/%%** The preferred mirror is **%%http://mirrors.mit.edu/ubuntu/%%** ==== Determine the fastest mirror ==== snap install mirrorselect mirrorselect --country us ===== Post-Installation ===== Make the output of the **df** command more friendly and less cluttered by creating a system-wide alias for it: echo "alias df='df -h -x squashfs -x tmpfs -x devtmpfs'" >> /etc/profile.d/aliases.sh Make sure to set the "always_set_home" variable in the sudoers file (using **visudo**) ==== Disable IPv6 ==== To disable IPv6 on Ubuntu during boot time, open the /etc/default/grub file using your favorite text editor with root privileges and change/add: FROM: GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" TO: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1" Once you have made the above change within the /etc/default/grub file execute the following command to apply the GRUB changes: sudo update-grub Reboot the system afterwards. ==== Enable console screen blanking ==== Edit the /etc/default/grub file using your favorite text editor with root privileges and add the string **consoleblank=600** to the GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX lines for a 10-minute timeout. Once you have made the above change within the /etc/default/grub file execute the following command to apply the GRUB changes: sudo update-grub Reboot the system afterwards. ==== To install Samba: ==== sudo apt-get install samba cifs-utils ==== To install NFS: ==== sudo apt-get install nfs-common nfs-kernel-server ==== To install mysql: ==== sudo apt install mysql-server sudo mysql_secure_installation ==== Customizing the MOTD ==== Put any customization data into /etc/motd ==== Installing apache and php ==== sudo apt update sudo apt install apache2 sudo apt install php libapache2-mod-php sudo apt install php-mysql php-gd php-xml sudo apt install phpmyadmin php-mbstring php-gettext ==== Install phpmyadmin ==== sudo apt update sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl sudo phpenmod mbstring sudo systemctl restart apache2 mysql mysql> SELECT user,authentication_string,plugin,host FROM mysql.user; mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; ==== Installing Portainer to manage Docker containers ==== sudo docker run -d -p 9443:9443 -p 8000:8000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest ==== Disable interactive restart prompt while upgrading packages with apt ==== The trouble in this case is with the ''needrestart'' command, which is part of the apt-get upgrade process in Ubuntu now. By default this is set to “interactive” mode which causes the interruption of scripts. To change this behavior, we can edit the ''/etc/needrestart/needrestart.conf'' file, changing the line: ''#$nrconf{restart} = 'i';'' to ''$nrconf{restart} = 'a';'' (if we want to restart the services automatically) or ''$nrconf{restart} = 'l';'' to simply list the services that need restart. ===== Ubuntu Desktop (Gnome/GUI) Stuff ===== ==== Set login screen default resolution ==== - Login and set the screen resolution as desired. - Once set, copy the file **~/.config/monitors.xml** to **/var/lib/gdm3/.config/monitors.xml**. - Ensure the user/group ownership is set to **gdm.gdm**. - Reboot the system to apply the changes. ==== Eliminating the annoying repeated authentication dialogs when logging in via xrdp ==== Edit the file **/etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla**; paste the following config into it and then save it: [Allow Colord all Users] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile ResultAny=no ResultInactive=no ResultActive=yes If the issue persists afterwards, a reboot of the system should resolve it. ==== Fixing the Low Battery Alert ==== Found on Reddit; will "clean it up" later... cd /etc/UPower\\ sudo nano UPower.conf\\ If you set UsePercentageForPolicy=true then edit the percentage lines to your liking, such as:\\ PercentageLow=50\\ PercentageCritical=35\\ If you prefer a time based approach, then set UsePercentageForPolicy to false and set the time notification options to your liking, such as:\\ TimeLow=1200\\ TimeCritical=300\\ Hit ctrl+X to save the UPower.conf file and close out of nano editor.\\ Reboot computer or sudo systemctl restart upower for changes to take effect.\\