Skip to content

Latest commit

 

History

History
56 lines (48 loc) · 2.93 KB

SERVER_SETUP.md

File metadata and controls

56 lines (48 loc) · 2.93 KB

VPS SETUP

GET VPS AND SETUP USERS

  1. Buy https://www.ovh.com/world/vps/vps-ssd.xml
  2. Login via SSH using provided password e.g. ssh [email protected]. If password was not provided then change it by rebooting server into 'rescue mode' and reseting the password (url: https://docs.ovh.com/gb/en/vps/root-password/)
  3. Generate SSH key at local machine via ssh-keygen -t rsa -b 4096 (or 8192)
  4. Then copy key to server via ssh-copy-id -i id_rsa_new_key.pub [email protected]
  5. Login to server again via ssh [email protected]
  6. Edit vim /etc/ssh/sshd_config and change set PasswordAuthentication no (change yes to no)
  7. Restart sshd (OpenSSH server) by sudo systemctl restart ssh
  8. Create new user sudo adduser newusername
  9. You may add new user to sudoers list via sudo usermod -aG sudo newusername
  10. Test user by loggin via su - james. Then sudo dpkg-reconfigure tzdata to test if the user is in sudo list.
  11. Set proper permissions to users folders (you should be logged in as root):
    • chown -R mynewuser:mynewuser /home/newusername/
    • chown root:root /home/newusername
    • chmod 700 /home/newusername/.ssh (create if not available)
    • chmod 644 /home/newusername/.ssh/authorized_keys (create if not available)
  12. Generate new key for new user via ssh-keygen -t rsa -b 4096 (or 8192)
  13. Add new public key to /home/newusername/.ssh/authorized_keys via copy-pasting.
  14. On your local machine add ~/Users/user/.ssh/config (command touch ~/Users/user/.ssh/config)
  15. Add something similar to be able to login now you can login using ssh root@somehost:
Host somehost
HostName vps1111111.ovh.net
    Port 22
    User root
    IdentityFile ~/.ssh/id_rsa

SETUP DOCKER

  1. Find the tutorial at https://blog.ssdnodes.com/blog/tutorial-getting-started-with-docker-on-your-vps/
  2. Installing Docker sudo curl -sS https://get.docker.com/ | sh
  3. Test by sudo docker run hello-world
  4. Autostart sudo systemctl enable docker
  5. Ability to control docker by some user: sudo groupadd docker && sudo usermod -aG docker $USER
  6. docker run hello-world
  7. Install LAMP if required sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose
  8. Ability to run chmod +x /usr/local/bin/docker-compose
  9. Create dir mkdir $HOME/apache && cd $HOME/apache
  10. Create file printf '<?php\n phpinfo(); \n?>' > info.php
  11. Run image docker run -d --name=apache -p 8080:80 -v $HOME/apache:/var/www/html php:apache
  12. Test via youraddress:80
  1. $ sudo apt-get update
  2. $ sudo apt-get install software-properties-common
  3. $ sudo add-apt-repository ppa:certbot/certbot
  4. $ sudo apt-get update
  5. $ sudo apt-get install python-certbot-nginx
  6. sudo certbot certonly - follow instructions. After complete check /etc/letsencrypt for results