Notes and tips in regard to Linux installation, configuration and maintenance.
- Ubuntu 22.04 LTS
- Install Zsh
sudo apt install zsh
chsh
/bin/zsh- Install Oh My Zsh via Gitee Mirror
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
REMOTE=https://gitee.com/mirrors/oh-my-zsh.git BRANCH=master sh install.sh- Edit
~/.zshrcto enable common plugins (such as docker) and include any startup scripts
-
Install Docker Engine on Ubuntu
- Use a mirror
- After installation, edit
/etc/docker/daemon.jsonto use a Docker Registry Mirror, which is usually vendor-specific, such ashttps://mirror.ccs.tencentyun.comprovided by Tencent Cloud.
-
Post-installation steps for Linux, e.g., run docker commands as a non-root user
- Configure Git
git config --global credential.helper 'store'
git config --global user.name "octopusthu"
git config --global user.email octopusthu@gmail.com- Set timezone
mv /etc/localtime /etc/localtime.backup
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# Change to 24hr format (need re-login)
localectl set-locale LC_TIME=en_GB.UTF-8- Set hostname (For packages like
sendmailto function)hostnamectl set-hostname example.com- In /etc/hosts, assign the just updated hostname
example.comto127.0.0.1
- Basic config
sudo vim /etc/ssh/sshd_config
Port xxxxx
PasswordAuthentication no
sudo systemctl restart sshd- Login using a non-root user with an RSA key via a customized port
client
ssh-keygen -t rsaserver
su - zy
mkdir ~/.ssh
vim ~/.ssh/authorized_keys
pub key content
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
vim /etc/ssh/sshd_config
Port xxxxx
PasswordAuthentication no
PermitRootLogin no
systemctl restart sshd- UnattendedUpgrades
- Need the
sendmailpackage to send notifications via email
- Need the
- CentOS 7
- CentOS 8
- Ubuntu 20.04 LTS
- Ubuntu 21.10