Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Distributions»Ubuntu»Initial Server Setup for Beginners (Ubuntu 18.04 and 16.04 LTS)

    Initial Server Setup for Beginners (Ubuntu 18.04 and 16.04 LTS)

    RahulBy RahulNovember 6, 20153 Mins ReadUpdated:April 24, 2018

    In this tutorial, we are assuming that you already have fresh installed Ubuntu Server. We recommend using LTS version of Ubuntu for your servers like Ubuntu 18.04 LTS, 16.04 LTS. Now after installing Ubuntu server 18.04, 16.04 proceed for post-installation setup of your server. This guide includes steps which are useful for configuring for a server, increase the security of the server.

    1. Upgrade Your System

    First login to your Ubuntu server with root access and execute the following command to upgrade all packages.

    sudo apt-get update
    sudo apt-get upgrade
    

    2. Create Admin Account

    Create a user account for system administration and configure it with sudo access. From now you will use this account to log in to the server and perform an operation. We don’t recommend to use root user for each time login.

    sudo adduser sysadmin
    

    Now add this user to sudo group, So that it can get all sudo privileges.

    ssudo usermod -aG sudo sysadmin
    

    3. Secure SSH Server

    Now edit OpenSSH configuration file /etc/ssh/sshd_config and do the following changes.

    • Change Default Port – It will be good to change default ssh port as default ports are always on attackers.
       Port 2222
      
    • Disable Root SSH Login – Also you would like to disable root login via ssh.
       PermitRootLogin no
      

    4. Setup Key-Based SSH

    This is good to configure your server to login with key based only and disable password login. Generate a key pair on your client system.

    ssh-keygen 
    
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/sysadmin/.ssh/id_rsa): /home/sysadmin/.ssh/id_rsa_10
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/sysadmin/.ssh/id_rsa_10.
    Your public key has been saved in /home/sysadmin/.ssh/id_rsa_10.pub.
    The key fingerprint is:
    b8:78:02:69:a7:4a:92:e8:97:35:02:7e:ce:02:28:fc [email protected]
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |                 |
    |                 |
    | . .   .         |
    |+ = . . S        |
    |== * + .         |
    |*.* * +          |
    |+o E o           |
    |..o              |
    +-----------------+
    

    Now copy generated public key .ssh/id_rsa.pub file content on servers ~/.ssh/authorized_keys directory. You can copy content directory on servers file or use the following command.

    ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
    

    Now login to the server with SSH, It will not prompt for the password again.

    ssh [email protected]
    

    5. Setup CSF Firewall (Optional)

    Now if you want, you can use CSF for managing your firewall. Follow the below steps to install it.

    Download CSF latest source code using following commands on your system

    sudo cd /opt
    sudo wget https://download.configserver.com/csf.tgz
    sudo tar xzf csf.tgz
    

    Install CSF firewall using given install.sh script in the source code. it will automatically do everything.

    sudo cd /opt/csf
    sudo sh install.sh
    

    Enable CSF to work as production. By default, it installed in test mode.

    sudo vim /etc/csf/csf.conf
    
    TESTING=0
    

    Finally restart CSF service using following command.

    sudo cd /etc/csf
    sudo csf -r
    
    server setup Ubuntu
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Mod_Pagespeed with Apache on Ubuntu
    Next Article How to Remove Array Element by Value in JavaScript

    Related Posts

    Changing the Login Screen Background in Ubuntu 22.04 & 20.04

    Updated:May 9, 20222 Mins Read

    (Resolved) Please install all available updates for your release before upgrading

    2 Mins Read

    How to Install LightDM Display Manager on Ubuntu

    Updated:May 10, 20222 Mins Read

    Change Screen Resolution of An Ubuntu VM in Hyper-V

    Updated:May 2, 20222 Mins Read

    How to Check IPv4 Address on Ubuntu 22.04

    2 Mins Read

    How to Configure Static IP Address on Ubuntu 22.04

    Updated:May 4, 20223 Mins Read

    Comments are closed.

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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