Skip to content

Instantly share code, notes, and snippets.

@naala89
Last active February 9, 2023 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naala89/f4fea4cd474d3f8040f3c29f7fddde12 to your computer and use it in GitHub Desktop.
Save naala89/f4fea4cd474d3f8040f3c29f7fddde12 to your computer and use it in GitHub Desktop.

Notes for setting up a new server

Add new user for general use

sudo su
useradd -m -d /home/<username> <username>
passwd <username>
visudo
  <username> ALL=(ALL) NOPASSWD:ALL
<edit /etc/passwd so default shell for <username> is /bin/bash>
su <username>
cd
ssh-keygen -t rsa -b 4096

Allow passwordless SSH

vim .ssh/authorized_keys
<add ~/.ssh/id_rsa.pub from remote comp>
chmod 600 .ssh/authorized_keys
ssh ...

Mount RDS on boot

sudo su
blkid
mkdir -p /data
vim /etc/fstab
  UUID=...       /data/disk1     xfs     defaults,noatime
mount -a

Install nginx

apt-get install nginx
ufw app list
ufw allow 'Nginx HTTP'
ufw allow 'Nginx HTTPS'
ufw allow 'OpenSSH'
ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment