VPS setup terms / Digital Ocean Flashcards
If you don’t already have an SSH key, generate one using the following command:
ssh-keygen
Once generated, SSH keys are stored in the SSH directory at the r.._ of your user account
Once generated, SSH keys are stored in the SSH directory at the root of your user account .~/.ssh
When you generate an SSH key, it creates two files:
- A p____ key, which remains securely stored on your machine.
- A p____ key, which you provide to DigitalOcean or other services. This will have the .p___ file extension.
When you generate an SSH key, it creates two files: - A private key, which remains securely stored on your machine. - A public key, which you provide to DigitalOcean or other services. This will have the .pub file extension.
Use the following command to display your public key:
cat ~/.ssh/id_rsa.pub
Note: The file name id_rsa.pub is a default for many setups, but the actual file name may differ based on how you generated your SSH key. If a different file was created, adjust the cat command accordingly (e.g., cat ~/.ssh/your-key-name.pub)
command to connect to the server:
ssh root@’ip address or domain name’
ssh root@chasephilpot.com
ssh root@123:456:789
Command to give the new user ‘username’ sudo privileges
usermod -aG sudo ‘username’
the -a argument stands for append
The -G argument tells usermod to change a user’s group settings.
A utility to efficiently transfer and synchronize files and directories between two locations. It can operate locally or remotely.
rsync
(part of larger command)
‘–archive A’ is shorthand for -rlptgoD, which means:
-r: recursively copy d_________s
-l: copy symbolic l____s as symbolic l____s
-p: Preserve file p________s
-t: Preserve modifcation ________s
-g: Preserve g________ ownership
-o: Preserve o______
-D: Preserve d__________ and special files
-r: recursively copy directories.
-l: Copy symbolic links as symbolic links.
-p: Preserve file permissions
-t: Preserve modification times
-g: Preserve group ownership
-o: Preserve owner (only if run as a superuser).
-D: Preserve device and special files.
(part of larger command)
Changes the ownership of the files to the specified user (ralph) and group (ralph) after they are transferred to the destination.
–chown=ralph:ralph
command to enable ufw
sudo ufw enable
command for deleting rules in ufw:
sudo ufw delete allow rulename
command to confirm NGINX is running
systemctl status nginx
command to enable the ufw ‘Nginx Full’, which allows HTTP and HTTPS traffic
sudo ufw enable ‘Nginx Full’
command to remove any redundant configuration
sudo ufw delete allow ‘redundant_config’
command to check ufw status
sudo ufw status
To remove any configuration from ufw we can use the command:
sudo ufw delete allow ‘rule_name’
Example:
sudo ufw delete allow ‘Nginx HTTP’
command to initialize certbot:
sudo certbot –nginx -d www.domainname.com -d domainname.com
(optionally you can use the -v command to debug issues if they arise)
NOTE: certbot now upgrades http to https by default (this is the desired behavior)
The a__ command is a package management tool in Ubuntu and other Debian-based Linux distributions
The apt command is a package management tool in Ubuntu and other Debian-based Linux distributions
command to install node:
command to install NPM:
sudo apt install nodejs
sudo apt install npm
command to install PM2
(a Production Process Manager for Node.js applications PM2 is going to make sure that our application is always running)
sudo npm install pm2@latest -g
test the nginx config file for typos with the command:
sudo nginx -t
An _ record maps a domain to the physical IP address of the computer hosting that domain.
An A record maps a domain to the physical IP address of the computer hosting that domain.
Internet traffic uses the _ record to find the computer hosting your domain’s DNS settings.
Internet traffic uses the A record to find the computer hosting your domain’s DNS settings.
The value of an _ record is always an IP address, and multiple _ records can be configured for one domain name.
The value of an A record is always an IP address, and multiple A records can be configured for one domain name.
restart Nginx so that it can pick up the new configuration with the command:
sudo systemctl reload nginx
This will allow us to automate the app process
Pm2 makes it easy to start/stop our app and even restarts it if the server crashes and restarts