Debian Server Setup

For linux common commands, see 开发技巧收藏

  1. Update Source

    apt update --yes && apt upgrade --yes
    
  2. Install sudo package

    apt install -y sudo
    
  3. Open BBR: Open BBR for Debian

  4. Use ssh key login instead of password, for more details see How To Configure SSH Key-Based Authentication on a Linux Server

  5. In your local machine:

ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host

This will copy your id_rsa.pub to remote machine ~/.ssh/authorized_keys

  1. Change the default password

    1. passwd
  2. Create an admin group

    1. groupadd admin
    2. Give admin group root access, and no password sudo
      1. Backup sudo files cp /etc/sudoers /root/sudoers.bak
      2. Edit the /etc/sudoers file by typing the command: visudo
      3. Add %admin ALL=(ALL:ALL) NOPASSWD:ALL after sudo group
  3. Create a admin group user

    1. useradd username -g admin
  4. Use ssh key login instead of password for normal user

    1. ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host
  5. Login with new normal user ssh username@ip

  6. Install common utils:

    1. sudo apt install build-essential software-properties-common curl vim unzip git pkg-config libssl-dev --yes
  7. Create /data for store data files with 777 permissions, avoid to use /home directory

You might want to read also:

Category: Dev 
TagsDebian
Published:  · Updated:   📝 Edit this page

Response🔗

Have you written a response to this? Let me know the article or tweet URL (Article or tweet content needs to include the URL of this article, learn more about webmention here).

The response will be automatically collected by webmention.io bot, and another bot will automatically post it here within 24 hours, I wrote an article about how to achieve this. You can also send your response via mail owen@owenyoung.com or Twitter DM