- Shell 99.3%
- JavaScript 0.7%
| .husky | ||
| .vscode | ||
| scripts | ||
| tools | ||
| .editorconfig | ||
| .gitignore | ||
| .markdownlint.json | ||
| .markdownlintignore | ||
| .shellcheckrc | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
Server setup instructions
Table of contents
Prerequisites
Point your domain names to your machine IP address
Before continuing, your machine needs to have a dedicated domain name that will be its hostname.
You also need to point your app domain names to your machine IP address if you want to host an app for them. See with your domain name registrar to set up A (IPV4) or AAAA (IPV6) records to perform this operation.
A minimal DNS zone typically looks like this:
For example, after that, you will be able to login with:
ssh johndoe@mymachine.example.com
Instead of:
ssh johndoe@50.70.150.30
Configure an SSH key
Before going any further, you need to generate an SSH key.
ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519
Then add it to your server by using:
hostname=mymachine.example.com
userName="johndoe"
ssh "${userName}"@"${hostname}" "echo '$(cat ~/.ssh/id_ed25519.pub)' | tee -a ~/.ssh/authorized_keys > /dev/null"
You can also add it to the root account:
ssh -t "${userName}"@"${hostname}" "echo '$(cat ~/.ssh/id_ed25519.pub)' | sudo tee -a /root/.ssh/authorized_keys > /dev/null"
Create a user account with sudo privileges
By default, Ubuntu comes preinstalled with a non-root sudo user named "ubuntu". The "root" user exists but is not accessible. This is how you are supposed to use your machine, because part of the power inherent with the root account is the ability to make very destructive changes, even by accident.
But you will probably want something more meaningful than "ubuntu" as a username, so you can rename it by using the "root" account (because you can't rename the user you currently logged in).
# Login to your machine's root account
ssh root@"${hostname}"
userName="johndoe"
# Rename user
usermod -l "${userName}" ubuntu
# Rename user group
groupmod -n "${userName}" ubuntu
# Rename home directory
usermod -d /home/"${userName}" -m "${userName}"
# Change password
passwd "${userName}"
# Disconnect from your machine
exit
After that, you will be able to login with:
ssh johndoe@mymachine.example.com
Installation
Clone this repository:
git clone https://git.fallet.net/romain.fallet/server-setup ~/.server-setup
Run install script:
bash ~/.server-setup/scripts/install.sh
Reload your .bashrc to make aliases available:
. ~/.bashrc
Update
ss:self-update
Recipes
Web machine
ss:recipes:web-machine
Mail machine
ss:recipes:mail-machine
Application machine
ss:recipes:application-machine
CI machine
ss:recipes:ci-machine
CI runner machine
ss:recipes:ci-runner-machine
File machine
ss:recipes:file-machine
Daily backup machine
ss:recipes:daily-backup-machine
Contributing
Development installation
Clone this repository:
git clone https://github.com/RomainFallet/server-setup
Install dependencies:
npm ci
Project commands
Lint markdown and bash files:
npm run lint
Format markdown files!
npm run format
Check dependencies vulnerabilities:
npm audit
Install latest dependencies patches:
npm update
