Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Distributions»Initial Server Setup with Debian 11

    Initial Server Setup with Debian 11

    By RahulAugust 28, 20214 Mins Read

    Linux distributions are widely used to create servers, and businesses are benefiting from this low-cost and secure solution. Linux distributions including Debian provide tons of utilities to set up, configure, and secure servers.

    Advertisement

    Debian is a stable, secure, and quite popular Linux operating system and ideal for server setup. Many distributions are based on it, especially well-liked Ubuntu, PureOS, SteamOS, etc.

    The newest version of Debian is Debian 11 Bullseye, which comes with thousands of new packages, supports multiple desktop environments, driverless scanning, and an improved manual page.

    This write-up is focusing on how to install, set up a server on Debian 11 Bullseye. When you install or upgrade to Debian 11, there is a configuration you need to perform to make your server secure.
    Steps involve for initial server setup on Debian 11 are mentioned below:

    Step 1 – Update and Upgrade the Debian

    1. The first step is properly upgrading and updating the packages and the distribution. Login to the Debian 11 system and open a shell. To update the packages list use:
      sudo apt update 
      
    2. Upgrade the packages using:
      sudo apt upgrade
      
    3. It is recommended to update your distribution, for that use the below-mentioned command:
      sudo apt dist-upgrade
      
    4. Upon upgrading remove the unwanted file from your system by executing:
      sudo apt autoremove
      

    Step 2 – Creating a Sudo User

    It is recommended to create a new sudo user for your server management instead of the root account. For that run the below-mentioned command to add user:

    sudo adduser tecadmin
    

    Create Sudo Account in Debian 11

    In the command “tecadmin” is the new user. Now, provide sudo privileges to the new user:

    sudo usermod -aG sudo tecadmin
    

    Switch account by executing the command:

    sudo su tecadmin
    

    Switch to Sudo Account in Debian 11

    It can be seen that the user has switched.

    Step 3 – Configuring the System Hostname

    To check the current hostname, use:

    sudo hostnamectl
    

    The hostname is the identity of your system over a network so it is a good practice to properly name your hostname and to change the hostname use the below-mentioned command:

    sudo hostnamectl set-hostname debian11
    

    For the sake of demonstration, I have changed the hostname to “debian11”. Now close the shell instance and open it again a new hostname will appear. To check the hostname use:

    hostname
    

    Check hostname on Debian 11

    The new hostname is “debian11” now.

    Step 4 – Securing SSH Server

    SSH is also known as secure shell is a protocol that is used to connect with remote servers. When configuring the server, it is suggested to change the default port and disable the root SSH login. To perform these operations you need to open the configuration file in any editor:

    sudo nano /etc/ssh/sshd_confiq
    

    Search for the below line, remove “#” from beginning of line and change port 22 to 2284:

    Change SSH Port in Debian 11

    Also set PermitRootLogin to no and remove “#” to uncomment, as demonstrated below:

    Disable Root Login on Debian 11

    Save the file and execute the below-mentioned command:

    sudo systemctl restart ssh
    

    If you are unable to open this file then SSH server would be missing from your system, install SSH using:

    sudo apt install openssh-server
    

    Step 5 – Managing the Firewall (ufw)

    1. Debian does not come with a firewall, so you are supposed to install it. Use the below-given command to install an uncomplicated firewall (ufw) on Debian 11:
      sudo apt install ufw
      
    2. To enable the firewall use:
      sudo ufw enable
      
    3. To allow the port, use:
      sudo ufw allow 2284
      
    4. Though it is depend upon the preferences, to deny the incoming traffic use:
      sudo ufw default deny incoming
      
    5. And to allow outgoing traffic use:
      sudo ufw default allow outgoing
      
    6. And reload ufw:
      sudo ufw reload
      
    7. To check the status:
      sudo ufw status
      

      UFW status on Debian 11

    Step 6 – Rebooting The System

    After making all the changes, reboot your Debian system.

    sudo reboot 
    

    Conclusion

    While setting up a new server on Linux there are a few steps that need to be followed, that include upgrading packages, adding a new user, setting up a firewall, securing SSH.

    This write-up thoroughly explains how to set up a server on the newly released Debian 11 Bullseye. We learned how to create a new user with sudo privileges, how to change the default SSH port, and setting up a firewall for the initial server setup on Debian 11.

    debian Debian 11 Initial Server Setup
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Using the Apt Package Manager on Debian-based Systems

    Apt configuration file options /etc/apt/apt.conf

    The Top 10 Linux Distros for Different Use Cases

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.