{"id":12354,"date":"2018-11-06T10:24:54","date_gmt":"2018-11-06T10:24:54","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=12354"},"modified":"2026-05-22T07:33:50","modified_gmt":"2026-05-22T07:33:50","slug":"how-to-set-up-vps","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-set-up-vps","title":{"rendered":"How to set up a VPS in 6 steps"},"content":{"rendered":"<p>Setting up a VPS means preparing your server, connecting to it via SSH, updating the system, creating a safer user account, securing remote access, and configuring a firewall.<\/p><p>You don&rsquo;t need to be a sysadmin to handle it. With the right plan, a terminal, and a bit of focused time, you can get a clean, secure server ready for hosting a website, app, or game server.<\/p><p>If you&rsquo;re a beginner who has just bought a VPS and needs to configure it, here are the steps:<\/p><ol class=\"wp-block-list\">\n<li>Choosing and provisioning a VPS plan.<\/li>\n\n\n\n<li>Connecting to your VPS using SSH.<\/li>\n\n\n\n<li>Updating your server.<\/li>\n\n\n\n<li>Creating a new non-root user.<\/li>\n\n\n\n<li>Securing SSH access.<\/li>\n\n\n\n<li>Configuring a firewall.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-what-do-you-need-before-setting-up-a-vps\">What do you need before setting up a VPS?<\/h2><p>Before you start, gather a few things so you&rsquo;re not hunting for them mid-setup. Most of these come from your hosting provider once you&rsquo;ve purchased a plan.<\/p><p>Here&rsquo;s what you&rsquo;ll need:<\/p><ul class=\"wp-block-list\">\n<li>Your VPS IP address.<\/li>\n\n\n\n<li>The root username, or the default user your provider set up.<\/li>\n\n\n\n<li>The root password or your SSH credentials.<\/li>\n\n\n\n<li>An SSH client or terminal app on your local computer.<\/li>\n\n\n\n<li>The operating system you chose during provisioning.<\/li>\n\n\n\n<li>Basic command-line access, or willingness to copy and paste.<\/li>\n<\/ul><p>If you&rsquo;re use Hostinger&rsquo;s <a href=\"\/ca\/vps-hosting\">VPS hosting services<\/a>, you&rsquo;ll find your VPS IP, hostname, and password inside hPanel under your VPS dashboard. We also recommend that you understand some <a href=\"\/ca\/tutorials\/linux-commands\">basic Linux commands<\/a> before you start, since you&rsquo;ll be typing a lot of them shortly.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a1d5d83d4139\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a1d5d83d4139\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/11\/image2-1-1024x685.png\" alt=\"Hostinger VPS hPanel Panel access\" class=\"wp-image-149329\" title=\"hpanel-vps-overview-panelaccess\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-1-choose-a-vps-hosting-plan\">1. Choose a VPS hosting plan<\/h2><p>Choosing a VPS means selecting the plan, server location, operating system, and server resources before deployment. The right setup depends on whether you&rsquo;re hosting a small blog, a game server, a SaaS app, or something else entirely.<\/p><p>Here&rsquo;s what&rsquo;s worth thinking about before you click &ldquo;buy&rdquo;:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Factor<\/strong><\/td><td><strong>Recommendation<\/strong><\/td><\/tr><tr><td>CPU and RAM<\/td><td>A basic blog or static site runs on 1 vCPU and 1-2 GB RAM. Apps with heavier traffic or databases benefit from 2+ vCPU and 4 GB RAM or more.<\/td><\/tr><tr><td>Storage<\/td><td>NVMe SSD is faster than a regular SSD. Check how much space your project actually needs.<\/td><\/tr><tr><td>Data center location<\/td><td>Pick one close to your audience for lower latency.<\/td><\/tr><tr><td>Operating system<\/td><td>Ubuntu and Debian are the friendliest for beginners. AlmaLinux, Rocky Linux, and CentOS are solid alternatives if you&rsquo;ve used them before.<\/td><\/tr><tr><td>Backups or snapshots<\/td><td>Look for plans that include automatic backups so you can roll back if something breaks.<\/td><\/tr><tr><td>Security features<\/td><td>A built-in firewall, DDoS protection, and malware scanning save you setup time.<\/td><\/tr><\/tbody><\/table><\/figure><p>If you&rsquo;re not sure which operating system to pick, go with Ubuntu or Debian. Both have huge communities, clear documentation, and beginner-friendly package managers, so you&rsquo;ll find a fix fast when something doesn&rsquo;t work.<\/p><p>AlmaLinux and Rocky Linux are solid picks too, but they make more sense in specific cases. Go with them if your team already runs Red Hat systems, or if you need long-term enterprise-style stability for a business workload.<\/p><p><span style=\"margin: 0px;padding: 0px\">With&nbsp;Hostinger<\/span><a href=\"\/ca\/vps-hosting\"> VPS hosting<\/a>, you choose your OS at checkout and can swap it later in the dashboard if you change your mind. Just keep in mind that switching the operating system wipes all data on the server, so back up anything important first.<\/p><p>Once you complete the purchase, you&rsquo;ll get an email with your VPS dashboard link, where you&rsquo;ll find the IP address, root password, and other connection details you need for the next step.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ca\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-2-connect-to-your-vps-using-ssh\">2. Connect to your VPS using SSH<\/h2><p>SSH lets you remotely log into your VPS and manage it from your own computer, the same way you&rsquo;d open a terminal locally. You&rsquo;ll use it for almost every step that follows, so getting comfortable with it now pays off.<\/p><p>Your provider gives you an IP address, a username like <strong>root<\/strong>, and a password. How you connect depends on your operating system.<\/p><h3 class=\"wp-block-heading\">Connecting from macOS or Linux<\/h3><p>Open the Terminal app and type:<\/p><pre class=\"wp-block-code\"><code><code>ssh root@your_server_ip<\/code><\/code><\/pre><p>Replace <strong>your_server_ip<\/strong> with an actual IP address you got after buying a VPS plan. The first time you connect, you&rsquo;ll see a message asking you to verify the server&rsquo;s fingerprint. Type <strong>yes<\/strong> and press Enter.<\/p><p>Then enter your root password. Heads up: nothing will appear on screen while you type the password, not even asterisks. That&rsquo;s normal. Press <strong>Enter<\/strong> when you&rsquo;re done.<\/p><h3 class=\"wp-block-heading\">Connecting from Windows<\/h3><p>Windows users have two easy options. You can <a href=\"\/ca\/tutorials\/how-to-use-putty-ssh\">use PuTTY to connect through SSH<\/a>, a free SSH client with a simple interface. Or you can use Windows Terminal, which supports SSH directly, using the same <strong>ssh root@your_server_ip<\/strong> command syntax as on macOS and Linux.<\/p><p>For PuTTY, paste your <strong>VPS IP<\/strong> into the Host Name field, <span style=\"margin: 0px;padding: 0px\">keep<strong>&nbsp;port 22<\/strong><\/span> selected, and click <strong>Open<\/strong>. Log in as root and enter your password when prompted.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a1d5d83d8ca3\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a1d5d83d8ca3\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/11\/image1-1.png\" alt=\"PuTTY Configuration on Windows\" class=\"wp-image-149330\" title=\"putty-config-windows\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\">Using the Hostinger Browser Terminal<\/h3><p>If you don&rsquo;t want to install anything, Hostinger users can open a terminal straight from hPanel. Go to your VPS dashboard and click <strong>Terminal<\/strong>. It opens an SSH session in a new browser tab, already logged in as root.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a1d5d83daf6c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a1d5d83daf6c\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/11\/image5-1-1024x429.png\" alt=\"An SSH session in a new browser tab, already logged in as root.\" class=\"wp-image-149331\" title=\"hostinger-browser-terminal\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>This is the easiest option for beginners because there&rsquo;s nothing to configure. Once you&rsquo;re in, you can start running <a href=\"\/ca\/tutorials\/basic-ssh-commands\">basic SSH commands<\/a> like <strong>ls<\/strong>, <strong>cd<\/strong>, and <strong>pwd<\/strong> to find your way around.<\/p><h2 class=\"wp-block-heading\" id=\"h-3-update-your-vps\">3. Update your VPS<\/h2><p>Updating your VPS installs security patches and refreshes the package list, so you&rsquo;re not running outdated software. Always do this before installing anything else or changing settings.<\/p><p>On Ubuntu or Debian, run:<\/p><pre class=\"wp-block-code\"><code>apt update\napt upgrade<\/code><\/pre><p>The first command refreshes the list of available packages, and the second installs the updates. Press <strong>Y<\/strong> when prompted to confirm.<\/p><p>On AlmaLinux, Rocky Linux, or CentOS, use:<\/p><pre class=\"wp-block-code\"><code>dnf update -y<\/code><\/pre><p>If the update installs a new kernel or major system component, you&rsquo;ll need to reboot. Just type <strong>reboot<\/strong> and press Enter. Your SSH session will disconnect, and you can reconnect after a minute or two.<\/p><p>Hostinger VPS customers can reboot their server directly from hPanel&rsquo;s VPS dashboard.<\/p><figure data-wp-context='{\"imageId\":\"6a1d5d83dc8dd\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a1d5d83dc8dd\" class=\"wp-block-image size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/11\/image3-1-1024x388.png\" alt=\"Hostinger VPS hPanel access\" class=\"wp-image-149332\" title=\"hpanel-reboot-vps\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><h2 class=\"wp-block-heading\" id=\"h-4-create-a-new-non-root-user\">4. Create a new non-root user<\/h2><p>Running everything as root is risky because root has unrestricted access to your server. One typo in a command can wipe critical files, and a compromised root password gives an attacker full control of the server.<\/p><p>The fix is to create a new user with administrator rights using <a href=\"\/ca\/tutorials\/sudo-and-the-sudoers-file\">sudo privileges<\/a>. You&rsquo;ll do daily work as that user and only switch to root when you genuinely need to.<\/p><p>On Ubuntu or Debian, create the user and add them to the sudo group:<\/p><pre class=\"wp-block-code\"><code>adduser your name\nusermod -aG sudo yourname<\/code><\/pre><p>Replace <strong>yourname<\/strong> with whatever username you want. You&rsquo;ll be asked to set a password and fill in a few optional details.<\/p><p>On AlmaLinux, Rocky Linux, or CentOS, the equivalent group is <strong>wheel<\/strong>:<\/p><pre class=\"wp-block-code\"><code>adduser yourname\npasswd yourname\nusermod -aG wheel yourname<\/code><\/pre><p>Before you log out of root, open a second terminal window and test the new user with <strong>ssh yourname@your_server_ip<\/strong>. If you can log in and run <strong>sudo whoami<\/strong>, which should return <strong>root<\/strong>, you&rsquo;re set.<\/p><p>Testing first prevents you from locking yourself out after you change root login settings in the next step.<\/p><h2 class=\"wp-block-heading\" id=\"h-5-secure-ssh-access\">5. Secure SSH access<\/h2><p>Securing SSH means making it harder for attackers to break in, even if they figure out your IP. The three biggest wins are switching to key-based authentication, disabling root login, and optionally changing the SSH port.<\/p><h3 class=\"wp-block-heading\">Set up SSH key authentication<\/h3><p>SSH keys are far safer than password-only login because they&rsquo;re long, random, and can&rsquo;t be guessed by brute force. The setup takes a few minutes, and you&rsquo;ll log in faster afterward since you skip the password prompt. See how to <a href=\"\/ca\/tutorials\/how-to-set-up-ssh-keys\">set up SSH keys<\/a> on your VPS.<\/p><p>On your local computer (macOS\/Linux), generate a key pair:<\/p><pre class=\"wp-block-code\"><code>ssh-keygen<\/code><\/pre><p>Press Enter to accept the default location. You&rsquo;ll then be asked to set a passphrase. Enter a strong passphrase for extra security, or press Enter twice to skip it. Then copy the public key to your VPS:<\/p><pre class=\"wp-block-code\"><code>ssh-copy-id yourname@your_server_ip<\/code><\/pre><p>Windows doesn&rsquo;t include <strong>ssh-copy-id<\/strong>, so you&rsquo;ll need to copy the key manually:<\/p><ol class=\"wp-block-list\">\n<li>Generate a key with <strong>ssh-keygen<\/strong> in Windows Terminal (or use PuTTYgen for PuTTY).<\/li>\n\n\n\n<li>Display your public key: <strong>cat ~\/.ssh\/id_rsa.pub<\/strong> (or copy from PuTTYgen).<\/li>\n\n\n\n<li>Log in to your VPS as the new user you created earlier. If you&rsquo;re currently in a root session, switch to: <strong>su &ndash; yourname.<\/strong><\/li>\n\n\n\n<li>On your VPS, create the <strong>.ssh<\/strong> directory and add the key:<\/li>\n\n\n\n<li>\n<\/li><\/ol><pre class=\"wp-block-code\"><code>mkdir -p <span style=\"background-color: initial;font-family: inherit;font-size: inherit;text-align: initial;color: initial\">~\/.ssh<\/span>\n<code>nano ~\/.ssh\/authorized_keys<\/code><\/code><\/pre><p>Paste your public key, save with <strong>Ctrl+O<\/strong>, exit with <strong>Ctrl+X<\/strong>, then set permissions:<\/p><pre class=\"wp-block-code\"><code><code>chmod 700 ~\/.sshchmod 600 ~\/.ssh\/authorized_keys<\/code><\/code><\/pre><p>Once your key works, you can <a href=\"\/ca\/tutorials\/how-to-disable-ssh-password-login-on-vps\">disable SSH password authentication<\/a> so only key-based logins are allowed. This blocks the vast majority of automated login attempts.<\/p><h3 class=\"wp-block-heading\">Disable root login<\/h3><p>Before you change anything here, keep your current SSH session open and confirm your non-root user can log in from a second terminal. Testing first stops you from getting locked out if something in the config goes wrong.<\/p><p>Open the SSH config file:<\/p><pre class=\"wp-block-code\"><code>sudo nano \/etc\/ssh\/sshd_config<\/code><\/pre><p>Find the line that <span style=\"margin: 0px;padding: 0px\">says<strong>&nbsp;PermitRootLogin<\/strong><\/span>. It may start with a #, which means it&rsquo;s commented out and not active. Remove the # if present, and change the value to no:<\/p><pre class=\"wp-block-code\"><code>PermitRootLogin no<\/code><\/pre><p>Save the file with <strong>Ctrl+O<\/strong>, then exit with <strong>Ctrl+X<\/strong>. Restart SSH to apply:<\/p><pre class=\"wp-block-code\"><code>sudo systemctl restart ssh<\/code><\/pre><p>Now open a new terminal and confirm you can log in as your non-root user. If that works, root login is safely disabled.<\/p><h3 class=\"wp-block-heading\">Change the SSH port<\/h3><p>Changing the SSH port is optional and works best as an extra layer, not your main defense. The default <strong>port 22<\/strong> is the first one attackers scan, so moving SSH to a custom port reduces noise in your logs but isn&rsquo;t a substitute for keys and strong passwords.<\/p><p>If you want to go further, here&rsquo;s how <span style=\"margin: 0px;padding: 0px\">to<a href=\"\/ca\/tutorials\/how-to-change-ssh-port-vps\" target=\"_blank\">&nbsp;<\/a>change the<\/span><a href=\"\/ca\/tutorials\/how-to-change-ssh-port-vps\"> <\/a><a href=\"\/ca\/tutorials\/how-to-change-ssh-port-vps\">SSH port<\/a> on your VPS.<\/p><h2 class=\"wp-block-heading\" id=\"h-6-configure-a-firewall-for-your-vps\">6. Configure a firewall for your VPS<\/h2><p>A firewall controls which services on your VPS can receive traffic from the internet. Without one, every open port is exposed, even ones you didn&rsquo;t realize were listening.<\/p><h3 class=\"wp-block-heading\">Use the Hostinger VPS Firewall<\/h3><p>If you&rsquo;re on Hostinger, the easiest option is the built-in firewall in hPanel. Go to your VPS dashboard, open the Security section, and click Firewall. You can create rules through a visual interface without touching the command line.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a1d5d83de63d\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a1d5d83de63d\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/11\/image4-1-1024x533.png\" alt=\"Hostinger VPS Firewall. Create rules through a visual interface without touching the command line.\" class=\"wp-image-149333\" title=\"hpanel-vps-settings-firewall\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>For most setups, you&rsquo;ll want to allow inbound traffic on:<\/p><ul class=\"wp-block-list\">\n<li>Port 22, or your custom SSH port.<\/li>\n\n\n\n<li>Port 80 for HTTP.<\/li>\n\n\n\n<li>Port 443 for HTTPS.<\/li>\n<\/ul><h3 class=\"wp-block-heading\">Use UFW on Ubuntu or Debian<\/h3><p>UFW, short for Uncomplicated Firewall, is the friendliest command-line firewall for Debian-based systems. To <a href=\"\/ca\/tutorials\/how-to-configure-firewall-on-ubuntu-using-ufw\">configure UFW firewall rules<\/a> for a basic web server:<\/p><pre class=\"wp-block-code\"><code>sudo ufw allow OpenSSH\nsudo ufw allow 80\nsudo ufw allow 443\nsudo ufw enable<\/code><\/pre><p>Double-check that you&rsquo;ve allowed SSH before enabling UFW, or you&rsquo;ll lock yourself out of your own server. Also, if you&rsquo;ve replaced your SSH before, replace <strong>OpenSSH <\/strong>with your custom port number, for example, <strong>sudo ufw allow 2222<\/strong>.<\/p><h3 class=\"wp-block-heading\">Use firewalld on AlmaLinux, Rocky Linux, or CentOS<\/h3><p>On Red Hat-based systems, firewalld is the default:<\/p><pre class=\"wp-block-code\"><code><code>sudo firewall-cmd --permanent --add-service=ssh<\/code>sudo firewall-cmd --permanent --add-service=ssh\n<code>sudo firewall-cmd --permanent --add-service=httpssudo firewall-cmd --reload<\/code><\/code><\/pre><p>For a custom SSH port, replace s<strong>udo firewall-cmd &ndash;permanent &ndash;add-service=ssh <\/strong>with <strong>sudo firewall-cmd &ndash;permanent &ndash;add-port=your-port<\/strong>.<\/p><h3 class=\"wp-block-heading\">Add Fail2Ban as a bonus layer<\/h3><p>Fail2Ban monitors your logs for repeated failed login attempts and automatically blocks the offending IP. It&rsquo;s optional, but worth adding to most setups.<\/p><p>On Ubuntu, install it with <strong>sudo apt install fail2ban<\/strong>. On AlmaLinux, Rocky Linux, or CentOS, Fail2Ban lives in the EPEL repository, so you&rsquo;ll need to add that first: <strong>sudo dnf install epel-release<\/strong>, then <strong>sudo dnf install fail2ban<\/strong>. Then start the service with <strong>sudo systemctl enable &ndash;now fail2ban<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-host-a-website-after-setting-up-your-vps\">How to host a website after setting up your VPS<\/h2><p>Once your VPS is updated, secured, and reachable, you can <a href=\"\/ca\/tutorials\/host-website-on-vps\">host a website on a VPS<\/a> by installing a control panel, pointing your domain to the server, enabling SSL, and uploading your site files.<\/p><h3 class=\"wp-block-heading\">Install a control panel<\/h3><p>A control panel gives you a visual interface for managing websites, databases, and email instead of doing everything through the terminal. CyberPanel, Webmin, and HestiaCP are popular free options for beginners.<\/p><p>Hostinger users can also manage server-level settings like backups, firewall rules, and OS changes directly in hPanel. However, if you want to manage your websites using a virtual interface, you must install a separate control panel via hPanel.<\/p><h3 class=\"wp-block-heading\">Point your domain to the VPS<\/h3><p>You&rsquo;ll need to <a href=\"\/ca\/tutorials\/how-to-point-domain-to-vps\">point a domain name to your VPS<\/a> by updating its A record to match your VPS IP address. The change usually takes a few minutes to a few hours to propagate worldwide.<\/p><h3 class=\"wp-block-heading\">Enable SSL<\/h3><p>An SSL certificate encrypts traffic between your site and visitors, which is required for HTTPS and for ranking well in search. Most control panels include free Let&rsquo;s Encrypt SSL with a one-click installer.<\/p><p>Alternatively, for Hostinger VPS users, you can <a href=\"\/support\/6865487-how-to-install-ssl-on-vps-using-certbot-at-hostinger\">install SSL using Certbot<\/a> by running a few commands.<\/p><h3 class=\"wp-block-heading\">Upload or migrate your site<\/h3><p>If you&rsquo;re starting fresh, upload your site files through your control panel&rsquo;s file manager or via SFTP. If you&rsquo;re moving an existing site, your control panel likely has a migration tool that handles the transfer in one step.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-can-you-do-after-setting-up-a-vps\">What can you do after setting up a VPS?<\/h2><p>With the six setup steps done, your VPS is ready for whatever you want to build, whether that&rsquo;s a personal site, a SaaS app, a Discord bot, or a Minecraft server. The next priority is keeping it that way.<\/p><p>Set up automatic backups if your plan supports them, schedule regular system updates, and review your firewall rules every few months. For a deeper checklist of hardening steps, see how to <a href=\"\/ca\/tutorials\/vps-security\">improve VPS security<\/a> over the long term.<\/p><p>From here, most people branch in one of two directions. If you want a live website on the server, head to the website hosting walkthrough above and start with a control panel.<\/p><p>If you&rsquo;re running an app, a bot, or a game server, the next step is to install your stack and restrict access to the ports it actually needs.<\/p><p>A VPS rewards a bit of upfront care with years of reliable hosting. You&rsquo;ve already done the hard part.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up a VPS means preparing your server, connecting to it via SSH, updating the system, creating a safer user account, securing remote access, and configuring a firewall. You don&rsquo;t need to be a sysadmin to handle it. With the right plan, a terminal, and a bit of focused time, you can get a clean, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-set-up-vps\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":633,"featured_media":144958,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to set up a VPS in 6 steps","rank_math_description":"Check out this article to learn how to set up a VPS: 1. Purchase VPS hosting 2. Login to your VPS using SSH 3. Update Your VPS. + more.","rank_math_focus_keyword":"how to set up a vps","footnotes":""},"categories":[22699],"tags":[],"class_list":["post-12354","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/comment-configurer-un-vps","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/configurar-servidor-vps","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-menggunakan-vps","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/configurar-servidor-vps\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/configurar-servidor-vps\/","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-crear-un-slider-wordpress-7\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-set-up-vps\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-set-up-vps\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/12354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/633"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=12354"}],"version-history":[{"count":76,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/12354\/revisions"}],"predecessor-version":[{"id":144957,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/12354\/revisions\/144957"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media\/144958"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=12354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=12354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=12354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}