Make Debian/Ubuntu LXC containers more comfortable to use

I’ve been playing around with Proxmox and LXC containers lately and this is something I do with every container I create for it to be more user friendly.

First enable colors in the terminal.

echo "PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '" >> ~/.bashrc
Code language: PHP (php)

Then we enable completions using tab.

echo "source /etc/profile.d/" >> ~/.bashrc
Code language: PHP (php)

I usually also get locale problems which are fixed with the following.

echo "LC_ALL=en_US.UTF-8" >> /etc/environment echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "LANG=en_US.UTF-8" > /etc/locale.conf locale-gen en_US.UTF-8
Code language: JavaScript (javascript)

Finally, install cron-apt so that the container downloads updates at 04:00 every day. Also set it to email the results of the nightly download no matter what.

apt install cron-apt echo 'MAILON="always"' >> /etc/cron-apt/config
Code language: JavaScript (javascript)