User Configuration
Create a Non-Root User
As the root user, create a non-root user for deployments and add that user to the sudo group using the following commands:
useradd <USERNAME>usermod -aG sudo <USERNAME>The home directory for the non-root user is located at /home/<USERNAME>.
To later connect to the non-root user via SSH, you'll need to add your SSH key to the user. This can be done while logged in as the root user using the following command:
rsync -a --chown=<USERNAME>: ~/.ssh /home/<USERNAME>If necessary, while logged in as the root user, you can switch to the non-root user using the following command:
su - <USERNAME>You can switch back to the root user by typing exit.
Git
Configure Git using the following commands:
git config --global user.name "<NAME>"git config --global user.email "<EMAIL>"Create an SSH key for the non-root user in order to access GitHub, etc.:
ssh-keygenAs mentioned above, you can print out the non-root user's SSH key by using the following command:
cat ~/.ssh/id_rsa.pubRuby and Bundler
Install Ruby 2.6.5 and Bundler using the following commands inside the non-root user's home directory:
git clone https://github.com/rbenv/rbenv.git ~/.rbenvgit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-buildecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrcecho 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrcecho 'eval "$(rbenv init -)"' >> ~/.bashrcexec $SHELLrbenv install 2.6.5rbenv global 2.6.5gem install bundlerrbenv rehashYou can check the current version of Ruby using the following command:
rbenv versionList all installed versions of Ruby:
rbenv versionsChange the version of Ruby:
rbenv global <VERSION>Last updated