Skip to content

Instantly share code, notes, and snippets.

@anhphamt
Last active October 30, 2021 06:25
Show Gist options
  • Save anhphamt/d5f87d1520aa23742781a48606aad967 to your computer and use it in GitHub Desktop.
Save anhphamt/d5f87d1520aa23742781a48606aad967 to your computer and use it in GitHub Desktop.
Setup Caspitrano deployment Ubuntu

Setup DEPLOY Account

Login as root account and create new deploy user

sudo adduser deploy

Enter password and other information.

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04

Set root previlege

sudo gpasswd -a deploy sudo

Generate a Key Pair

These commands are run on your local machine

ssh-keygen

Finish your creating public key process. Normally it will be located at: ~/.ssh/id_rsa.pub

Add this public key to server

cat ~/.ssh/id_rsa.pub

It will show somethings like below id_rsa.pub contents ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBGTO0tsVejssuaYR5R3Y/i73SppJAhme1dH7W2c47d4gOqB4izP0+fRLfvbz/tnXFz4iOP/H6eCV05hqUhF+KYRxt9Y8tVMrpDZR2l75o6+xSbUOMu6xN+uVF0T9XzKcxmzTmnV7Na5up3QM3DoSRYX/EP3utr2+zAqpJIfKPLdA74w7g56oYWI9blpnpzxkEd3edVJOivUkpZ4JoenWManvIaSdMTJXMy3MtlQhva+j9CgguyVbUkdzK9KKEuah+pFZvaugtebsU+bllPTB0nlXGIJk98Ie9ZtxuY3nCKneB+KjKiXrAvXUPCI9mWkYS/1rggpFmu3HbXBnWSUdf [email protected]

Add Public Key to New Remote User To enable the use of SSH key to authenticate as the new remote user, you must add the public key to a special file in the user's home directory.

Back to your server

Now you're login as root. Switch to deploy user

su - deploy
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys

Paste the content of your public key here then save it.

chmod 600 .ssh/authorized_keys

Then use this tutorial to setup deployment

https://gorails.com/deploy/ubuntu/16.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment