Debian 初始設定
Basic
- as root via ssh and install sudo.
- #Client side
$ ssh root@hostname or hostip - After loging remote server
$ apt install sudo -y - Set locale config
$ sudo apt install locales -y
then
$ sudo dpkg-reconfigure locales
or
$ sudo vim /etc/locale.gen
then
$ sudo /usr/sbin/locale-gen
then logout and loging back.
- #Client side
- Create new user {user} and config security setting.
- Create new user
$ adduser {user}
$ sudo usermod -aG sudo {user} - Config ssh setting
Do {SSH Related} Section
- Create new user
- Logout from root and loging as new user {user}.
- Logout from root
$ logout - Loging as new user {user}
#Client side
$ ssh {user}@hostname or hostip
- Logout from root
- Install zsh & git & oh-my-zsh and setting theme to Agnoster.
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" $ nano .zshrc change=> ZSH_THEME="robbyrussell" to ZSH_THEME="agnoster" ,and reload zsh. $ source .zshrc
SSH Related
- Update remote server's sshconfig.
$ sudo nano /etc/ssh/sshd_config
change=> PermitRootLogin yes
change=> PasswordAuthentication no
change=> PubkeyAuthentication yes - Add Client ssh key to remote server.
$ ssh-copy-id -i ~/.ssh/id_ed25519.pub
{lsheep}@hostname or hostip - Reloging to remote server from client to test it.
$ sudo /etc/init.d/ssh restart
or
$ sudo service sshd restart
Docker Related
- Install Docker
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $ echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io -y
- Config docker to non root user
$ sudo groupadd docker $ sudo usermod -aG docker $USER $ newgrp docker $ docker run hello-world
- Config portainer
$ sudo systemctl edit docker.service