install linux

essential linux setup

derek preferences

new

# reset to original for debian12
cd ~
mkdir -p ~/bin
cp /etc/skel/.profile .
cp /etc/skel/.bashrc .
cat<<EOT>~/.bash_aliases
force_color_prompt=yes
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
EOT
 
#add ~/bin to path for alien linux
#echo 'if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH"; fi' >> ~/.profile
 
curl -LO http://repo.sxl.net/nix/vimrc.txt
cat vimrc.txt > ~/.vimrc && rm vimrc.txt
#

other preference

sudo chsh -s /bin/bash # use bash shell

authorized keys

mkdir -p ~/.ssh; cd ~ 
curl -LO http://repo.sxl.net/_h/proj/cert/id_ed25519.pub >> ~/.ssh/authorized_keys
cat id_ed25519.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

locale

sudo timedatectl set-timezone Asia/Hong_Kong  # timezone
#sudo timedatectl set-timezone America/Los_Angeles  # timezone (oracle/san jose)
#sudo timedatectl set-timezone America/Chicago      # timezone (google/lowa)
#sudo timedatectl set-timezone Europe/London        # timezone (oracle/london)

debian/ubuntu

locale

## locale
sudo apt -yq install locales
echo 'en_US ISO-8859-1' >> /etc/locale.gen
echo 'en_US.UTF_8 UTF-8' >> /etc/locale.gen
sudo locale-gen
update-locale LANG=en_US.UTF-8
update-locale LANGUAGE=en_US:en
update-locale LC_CTYPE="en_US.UTF-8"
update-locale LC_NUMERIC="en_US.UTF-8"
update-locale LC_TIME="en_US.UTF-8"
update-locale LC_COLLATE="en_US.UTF-8"
update-locale LC_MONETARY="en_US.UTF-8"
update-locale LC_MESSAGES="en_US.UTF-8"
update-locale LC_PAPER="en_US.UTF-8"
update-locale LC_NAME="en_US.UTF-8"
update-locale LC_ADDRESS="en_US.UTF-8"
update-locale LC_TELEPHONE="en_US.UTF-8"
update-locale LC_MEASUREMENT="en_US.UTF-8"
update-locale LC_IDENTIFICATION="en_US.UTF-8"
update-locale LC_ALL

packages

apt-get -y update && apt-get -y upgrade             # system update
apt install -yq openssh-server sudo wget man vim-nox htop iotop curl 
apt install -yq dialog net-tools tmux pgp lsb-release
apt install -y tasksel && tasksel install standard  # install basic utilities
update-alternatives --set editor /usr/bin/vim.nox
apt-get -yq autoclean
apt-get -yq autoremove
#

ssh allow root

tasksel install ssh-server 
apt install openssh-server openssh-client 
echo 'PermitRootLogin yes' > /etc/ssh/sshd_config.d/PermitRootLogin_yes
echo 'HashKnownHosts no' > /etc/ssh/ssh_config.d/HashKnownHosts_no
systemctl restart sshd

ubuntu 22.04 locale

apt -y install language-pack-en
localectl  # see current locale
localectl list-locales # see what locales are available
localectl set-locale LANG=en_US.UTF-8
localectl  # see current locale
pub/essential_linux_setup.txt · Last modified: 2025/06/01 12:19 by derek