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:
Instead of:
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"
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:
Clone this repository:
git clone https://github.com/RomainFallet/server-setup ~/.server-setup
Run install script:
bash ~/.server-setup/scripts/install.sh
Reload your .bashrc
to make aliases available:
. ~/.bashrc
ss:self-update
ss:recipes:mail-machine
ss:recipes:application-machine
ss:recipes:web-machine
ss:recipes:ci-machine
ss:recipes:ci-runner-machine
ss:recipes:file-machine
ss:recipes:daily-backup-machine
Clone this repository:
git clone https://github.com/RomainFallet/server-setup
Install dependencies:
npm ci
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