Skip to content

Instantly share code, notes, and snippets.

@sahwar
Forked from itsabdelrahman/linux-server-setup.md
Created April 11, 2022 12:02
Show Gist options
  • Save sahwar/8c036d935c506cb4883d3ecf65d27b44 to your computer and use it in GitHub Desktop.
Save sahwar/8c036d935c506cb4883d3ecf65d27b44 to your computer and use it in GitHub Desktop.

Revisions

  1. @itsabdelrahman itsabdelrahman revised this gist Sep 21, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop`, `locate`, `dig`, `tmux` & `tree`
    - `$ sudo apt install nano curl git htop mlocate dnsutils tmux tree`
    - Install tools
    - `$ sudo apt install nano curl git htop mlocate dnsutils tmux tree fzf`
    - Build `locate`'s index
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
  2. @itsabdelrahman itsabdelrahman revised this gist Sep 21, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop`, `locate`, `dig` & `tmux`
    - `$ sudo apt install nano curl git htop mlocate dnsutils tmux`
    - Install `nano`, `curl`, `git`, `htop`, `locate`, `dig`, `tmux` & `tree`
    - `$ sudo apt install nano curl git htop mlocate dnsutils tmux tree`
    - Build `locate`'s index
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
  3. @itsabdelrahman itsabdelrahman revised this gist Sep 11, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop`, `locate` & `dig`
    - `$ sudo apt install nano curl git htop mlocate dnsutils`
    - Install `nano`, `curl`, `git`, `htop`, `locate`, `dig` & `tmux`
    - `$ sudo apt install nano curl git htop mlocate dnsutils tmux`
    - Build `locate`'s index
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
  4. @itsabdelrahman itsabdelrahman revised this gist May 10, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop`, `locate` & `speedtest-cli`
    - `$ sudo apt install nano curl git htop mlocate speedtest-cli`
    - Install `nano`, `curl`, `git`, `htop`, `locate` & `dig`
    - `$ sudo apt install nano curl git htop mlocate dnsutils`
    - Build `locate`'s index
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
  5. @itsabdelrahman itsabdelrahman revised this gist Jan 12, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -62,4 +62,4 @@
    - Create a new cronjob
    - Append: `0 1 * * * sudo docker system prune -af`
    1. Facilitate pushing to ssh git remotes
    - `$ git config --global receive.denyCurrentBranch updateInstead`
    - `$ git config receive.denyCurrentBranch updateInstead`
  6. @itsabdelrahman itsabdelrahman revised this gist Jan 12, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -62,4 +62,4 @@
    - Create a new cronjob
    - Append: `0 1 * * * sudo docker system prune -af`
    1. Facilitate pushing to ssh git remotes
    - `$ git config receive.denyCurrentBranch updateInstead`
    - `$ git config --global receive.denyCurrentBranch updateInstead`
  7. @itsabdelrahman itsabdelrahman revised this gist Jan 12, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -61,4 +61,5 @@
    - `$ crontab -e`
    - Create a new cronjob
    - Append: `0 1 * * * sudo docker system prune -af`

    1. Facilitate pushing to ssh git remotes
    - `$ git config receive.denyCurrentBranch updateInstead`
  8. @itsabdelrahman itsabdelrahman revised this gist Jan 6, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -56,9 +56,9 @@
    - Debian: https://docs.docker.com/engine/install/debian
    1. Install Docker Compose
    - https://docs.docker.com/compose/install
    1. Schedule cleanup of dangling Docker images
    1. Schedule cleanup of unused Docker images
    - Open crontab
    - `$ crontab -e`
    - Create a new cronjob
    - Append: `0 1 * * * sudo docker images --quiet --filter=dangling=true | xargs --no-run-if-empty sudo docker rmi`
    - Append: `0 1 * * * sudo docker system prune -af`

  9. @itsabdelrahman itsabdelrahman revised this gist Jan 6, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -56,3 +56,9 @@
    - Debian: https://docs.docker.com/engine/install/debian
    1. Install Docker Compose
    - https://docs.docker.com/compose/install
    1. Schedule cleanup of dangling Docker images
    - Open crontab
    - `$ crontab -e`
    - Create a new cronjob
    - Append: `0 1 * * * sudo docker images --quiet --filter=dangling=true | xargs --no-run-if-empty sudo docker rmi`

  10. @itsabdelrahman itsabdelrahman revised this gist Dec 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@
    - `$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"`
    1. Configure locale _(if not English)_
    - Ubuntu: https://help.ubuntu.com/community/Locale & https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    - Debian: https://wiki.debian.org/Locale
    - Debian: https://wiki.debian.org/Locale & https://stackoverflow.com/a/7413863/6579787
    1. Install Docker
    - Ubuntu: https://docs.docker.com/engine/install/ubuntu
    - Debian: https://docs.docker.com/engine/install/debian
  11. @itsabdelrahman itsabdelrahman revised this gist Dec 8, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL`

    ### On local machine

  12. @itsabdelrahman itsabdelrahman revised this gist Dec 1, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -45,6 +45,9 @@
    - Disable password authentication
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Set ZSH as default shell
    - `$ sudo apt install zsh`
    - `$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"`
    1. Configure locale _(if not English)_
    - Ubuntu: https://help.ubuntu.com/community/Locale & https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    - Debian: https://wiki.debian.org/Locale
  13. @itsabdelrahman itsabdelrahman revised this gist Nov 15, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,8 @@
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop`, `locate` & `speedtest-cli`
    - `$ sudo apt install nano curl git htop mlocate speedtest-cli`
    - Build `locate`'s index
    - `$ sudo updatedb`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)
  14. @itsabdelrahman itsabdelrahman revised this gist Nov 15, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git`, `htop` & `speedtest-cli`
    - `$ sudo apt install nano curl git htop speedtest-cli`
    - Install `nano`, `curl`, `git`, `htop`, `locate` & `speedtest-cli`
    - `$ sudo apt install nano curl git htop mlocate speedtest-cli`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)
  15. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl`, `git` & `htop`
    - `$ sudo apt install nano curl git htop`
    - Install `nano`, `curl`, `git`, `htop` & `speedtest-cli`
    - `$ sudo apt install nano curl git htop speedtest-cli`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)
  16. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    1. Install essentials
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl` and `git`
    - `$ sudo apt install nano curl git`
    - Install `nano`, `curl`, `git` & `htop`
    - `$ sudo apt install nano curl git htop`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)
  17. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -50,4 +50,4 @@
    - Ubuntu: https://docs.docker.com/engine/install/ubuntu
    - Debian: https://docs.docker.com/engine/install/debian
    1. Install Docker Compose
    - https://docs.docker.com/compose/install/#install-compose-on-linux-systems
    - https://docs.docker.com/compose/install
  18. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -44,9 +44,10 @@
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale _(if not English)_
    - https://help.ubuntu.com/community/Locale
    - https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    - Ubuntu: https://help.ubuntu.com/community/Locale & https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    - Debian: https://wiki.debian.org/Locale
    1. Install Docker
    - https://docs.docker.com/engine/install/ubuntu
    - Ubuntu: https://docs.docker.com/engine/install/ubuntu
    - Debian: https://docs.docker.com/engine/install/debian
    1. Install Docker Compose
    - https://docs.docker.com/compose/install/#install-compose-on-linux-systems
  19. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Linux Ubuntu 18.04 LTS Server Setup
    # Linux Ubuntu/Debian Server Setup

    ### On remote machine

  20. @itsabdelrahman itsabdelrahman revised this gist Oct 31, 2020. No changes.
  21. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@
    - Disable password authentication
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale
    1. Configure locale _(if not English)_
    - https://help.ubuntu.com/community/Locale
    - https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    1. Install Docker
  22. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale
    - https://help.ubuntu.com/community/Locale
    - https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server/1111183#1111183)
    - https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server
    1. Install Docker
    - https://docs.docker.com/engine/install/ubuntu
    1. Install Docker Compose
  23. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,10 @@
    - Disable password authentication
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale (https://help.ubuntu.com/community/Locale & https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server/1111183#1111183)
    1. Install Docker (https://docs.docker.com/engine/install/ubuntu)
    1. Install Docker Compose (https://docs.docker.com/compose/install/#install-compose-on-linux-systems)
    1. Configure locale
    - https://help.ubuntu.com/community/Locale
    - https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server/1111183#1111183)
    1. Install Docker
    - https://docs.docker.com/engine/install/ubuntu
    1. Install Docker Compose
    - https://docs.docker.com/compose/install/#install-compose-on-linux-systems
  24. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,6 @@
    - Disable password authentication
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale (https://help.ubuntu.com/community/Locale)
    1. Configure locale (https://help.ubuntu.com/community/Locale & https://askubuntu.com/questions/89976/how-do-i-change-the-default-locale-in-ubuntu-server/1111183#1111183)
    1. Install Docker (https://docs.docker.com/engine/install/ubuntu)
    1. Install Docker Compose (https://docs.docker.com/compose/install/#install-compose-on-linux-systems)
  25. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -29,13 +29,13 @@

    ### On local machine

    #### As `<username>`

    1. Copy SSH public key to remote machine's authorized keys
    - `$ ssh-copy-id -i <public-key-path> <username>@<remote-machine-ip-address>`

    ### On remote machine

    #### As `<username>`

    1. Edit SSH daemon configuration
    - `$ sudo nano /etc/ssh/sshd_config`
    - Disable root access
  26. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,8 @@

    ### On local machine

    #### As `<username>`

    1. Copy SSH public key to remote machine's authorized keys
    - `$ ssh-copy-id -i <public-key-path> <username>@<remote-machine-ip-address>`

  27. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -19,9 +19,11 @@
    #### As `<username>`

    1. Install essentials
    - Update & upgrade: `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl` and `git`: `$ sudo apt install nano curl git`
    1. Enable passwordless sudo for user:
    - Update & upgrade
    - `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl` and `git`
    - `$ sudo apt install nano curl git`
    1. Enable passwordless sudo for user
    - `$ sudo nano /etc/sudoers`
    - Add: `<username> ALL=(ALL) NOPASSWD: ALL` (after `includedir /etc/sudoers.d`)

    @@ -32,11 +34,11 @@

    ### On remote machine

    1. Edit SSH daemon configuration:
    1. Edit SSH daemon configuration
    - `$ sudo nano /etc/ssh/sshd_config`
    - Disable root access:
    - Disable root access
    - Edit: `PermitRootLogin no`
    - Disable password authentication:
    - Disable password authentication
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale (https://help.ubuntu.com/community/Locale)
  28. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ### On remote machine

    #### As `root` user
    #### As `root`

    1. Change root password
    - `$ passwd`
  29. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    ### On remote machine

    #### As `root` user

    1. Change root password
    - `$ passwd`
    1. Create user & their home directory
    @@ -12,7 +14,10 @@
    - `$ usermod -aG sudo <username>`
    1. Set user's shell as bash
    - `$ chsh -s /bin/bash <username>`
    1. Disconnect SSH session, and reconnect as `<username>`
    1. Disconnect SSH session

    #### As `<username>`

    1. Install essentials
    - Update & upgrade: `$ sudo apt update && sudo apt upgrade`
    - Install `nano`, `curl` and `git`: `$ sudo apt install nano curl git`
  30. @itsabdelrahman itsabdelrahman revised this gist Oct 1, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions linux-server-setup.md
    Original file line number Diff line number Diff line change
    @@ -30,9 +30,9 @@
    1. Edit SSH daemon configuration:
    - `$ sudo nano /etc/ssh/sshd_config`
    - Disable root access:
    - Edit: `PermitRootLogin no`
    - Edit: `PermitRootLogin no`
    - Disable password authentication:
    - Edit: `PasswordAuthentication no`
    - Edit: `PasswordAuthentication no`
    - Restart ssh service: `$ sudo /etc/init.d/ssh restart`
    1. Configure locale (https://help.ubuntu.com/community/Locale)
    1. Install Docker (https://docs.docker.com/engine/install/ubuntu)