- A working Debian/Ubuntu Linux instance
Preparing the deployment server
After creating a VPS drop/node, login as
root and update a newly installed system:
$ ssh firstname.lastname@example.org # Pasword: ... # > Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-101-generic x86_64). # > ... $ apt-get update $ apt-get upgrade $ apt-get dist-upgrade $ reboot
Wait a minute while system is rebooting, then login again.
Creating a deployer user
First of all, you’d like to add the
admin group if it not exists:
$ addgroup admin
You can check
admin group privileges using
There should be something like:
# Members of the admin group may gain root privileges %admin ALL=(ALL) ALL
Now you can create the
$ adduser deployer
And add him to the
$ adduser deployer admin
deployer user is successfully created, you can logout
Connecting through the SSH without a password
The next step is optional, but it really helps you to save quite some time. I’m talking about SSH auto-logins, these will prevent the server from asking you for a password every time you’d like to connect.
On your local machine
cd into the
~/.ssh directory and generate an RSA key-pair:
$ cd ~/.ssh $ ssh-keygen -t rsa -C "email@example.com" # Generating public/private rsa key pair...
To keep things secure, you may want to have a separate key-pair for each server, to make it possible you need to have an ssh configuration file. If you haven‘t created it before, you can do it right now:
$ touch config
Add a new host/rsa entry to your config file:
$ vi config $ cat config # ... # Host yourhost # HostName 184.108.40.206 # IdentityFile ~/.ssh/yourfile_rsa # ...
Now let’s see the contents of the public key, it should looks like the following:
$ cat yourfile_rsa.pub # ssh-rsa AAAAb4kzaC1 (text omitted) 86n3iEEQ78cPVazr firstname.lastname@example.org
Now what you have to do is to copy the contents of the created file to your clipboard, we’ll have to write it to a file on our remote server. Start by logging on to the server as
deployer, proceed to the user’s
.ssh directory and paste your public key into a file called
authorized_keys (create it if it doesn’t exist). Save the file and close it, check that the contents have been written to the file and finally disconnect from the server:
$ ssh email@example.com # Password: ... $ cd ~/.ssh $ vi authorized_keys $ cat authorized_keys # ssh-rsa AAAAb4kzaC1 (text omitted) 86n3iEEQ78cPVazr firstname.lastname@example.org $ exit
If you’ve done everything right, you should now be able to log on to the remote server from your computer without having to input a password:
$ ssh deployer@yourhost # > Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-101-generic x86_64). # > ...