All reference steps for setting up VPS in Azure

0. Keep system updated

landscape-sysinfo
sudo apt-get update        # Fetches the list of available updates
sudo apt-get upgrade       # Strictly upgrades the current packages
sudo apt-get dist-upgrade  # Installs updates (new ones)
sudo apt-get autoremove
sudo reboot

1. How to enable root?


sudo passwd root

2. Enable SSH for root?

sudo nano /etc/ssh/sshd_config

Add a line in the Authentication section of the file that says PermitRootLogin yes.

# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

Save the updated /etc/ssh/sshd_config file.

Restart the SSH server

service sshd restart

3. Install Nginx.

sudo apt update
sudo apt install nginx

4. Create a link site

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Restart nginx

service nginx restart

4. Install .Net Core Runtime

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update

sudo apt-get install -y apt-transport-https

sudo apt-get update

sudo apt-get install -y aspnetcore-runtime-3.1

5. Install Certbot

sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d numerology.hintdesk.com

6. Install supervisor

sudo apt-get install supervisor
sudo nano /etc/supervisor/conf.d/hwapp.conf
[program:numerologyapi]
command=/usr/bin/dotnet /var/www/api.thanso.net/Numerology.dll
directory=/var/www/api.thanso.net/
autostart=true
autorestart=true
stderr_logfile=/var/log/numerology.err.log
stdout_logfile=/var/log/numerology.out.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=www-data
stopsignal=INT

Restart supervisor

sudo service supervisor restart
sudo tail -f /var/log/supervisor/supervisord.log

10. Install unzip

sudo apt-get install -y unzip

11. Change owner of a folder

sudo chown -R www-data:www-data api.thanso.net

Leave a Reply

Your email address will not be published. Required fields are marked *