====== Ubuntu Tips, Tricks and Notes ====== ---- ==== 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 mysql 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.