1. Home
  2. Blog
  3. How to Set Up a Linux VPS for Your Project

How to Set Up a Linux VPS for Your Project

Learn how to configure a Linux VPS securely, from first login and user accounts to SSH keys, firewall rules, updates and deployment for your project.

A newly activated VPS gives you freedom, but also responsibility. In a few minutes, you can put a website, an API, a bot, an automation dashboard or a development environment online. Knowing how to set up a Linux VPS correctly from the first login prevents the most common problems: break-ins through weak passwords, services exposed without need, missing updates and slowness caused by an unplanned installation.

This is a practical process for anyone who wants to prepare a Linux VPS for professional use, with security and room to grow. The examples use Ubuntu Server, a common choice because of its extensive documentation and compatibility with modern applications. On Debian, Rocky Linux and other distributions, the logic is the same, although some commands may differ.

Before setting up the Linux VPS, define its purpose

The ideal setup depends on what will run on the server. A VPS for hosting WordPress needs a web server, PHP, a database and caching rules. An environment for n8n requires Docker, a domain and special attention to credentials. A VPS for trading or remote desktop, on the other hand, must prioritize availability, stable remote access and a location close to the service being used.

Also define the project's minimum resources. Corporate sites and small APIs usually run well with little memory, while databases, simultaneous automations, deployment panels and games may need more CPU and RAM. NVMe SSD makes a difference when loading files, running queries and starting applications. If you expect growth, start with a structure that can be scaled without rushed migrations.

Have the VPS IP address, the initial user or root account, and the temporary password sent after activation ready. With providers offering immediate delivery, this access arrives shortly after payment is confirmed, so you can start the deployment without waiting days.

First login and system updates

On Windows, you can access the VPS through PowerShell, Terminal or PuTTY. On macOS and Linux, open the terminal. Use the command below, replacing the IP with your server's address:

```bash ssh root@SEU_IP ```

On the first connection, the system will ask you to confirm the server's key. Then, enter the password. If your provider gave you a temporary password, change it immediately:

```bash passwd ```

Next, update the installed packages. This step fixes known bugs and reduces the risk of starting the project with outdated components.

```bash apt update && apt upgrade -y apt autoremove -y ```

Restart only if the system requests it after a kernel or critical library update:

```bash reboot ```

Wait a few moments and reconnect. For servers hosting production applications, schedule recurring updates during low-traffic hours. Automatic updates can be useful for simple projects, but environments with sensitive dependencies should test changes before applying them.

Create a separate administrative user

Using root for daily tasks increases the impact of a wrong command or a compromised account. Create your own user and grant administrative permissions with sudo:

```bash adduser admin usermod -aG sudo admin ```

Log out and test the new access:

```bash ssh admin@SEU_IP ```

Then, confirm that sudo works:

```bash sudo whoami ```

The result should be `root`. This user will be used to install packages, edit configurations and manage services. For applications, it is even better to create dedicated users when needed, especially on servers shared by a team or hosting several projects.

Secure SSH without losing access

SSH is the most used administration port on a Linux VPS and, for that reason, it receives automated login attempts all the time. The most effective protection starts with SSH keys, which replace the password with a cryptographic key pair.

On your computer, generate a key if you don't have one yet:

```bash ssh-keygen -t ed25519 ```

Copy the public key to the VPS:

```bash ssh-copy-id admin@SEU_IP ```

On Windows, if this command is not available, copy the contents of the public key file and add it to the user's `~/.ssh/authorized_keys` file on the server. Before disabling passwords, open a second terminal window and confirm that key-based login works.

Edit the SSH configuration:

```bash sudo nano /etc/ssh/sshd_config ```

Find or add these options:

```text PermitRootLogin no PasswordAuthentication no ```

Save the file and test the syntax before restarting the service:

```bash sudo sshd -t sudo systemctl restart ssh ```

Do not disable `PasswordAuthentication` before testing your key. This simple mistake can lock you out of your own server. Changing the default port 22 may reduce bot noise, but it does not replace SSH keys, a firewall and updates.

Configure the firewall and open only what is necessary

On Ubuntu, UFW makes firewall management more straightforward. First, allow SSH so you don't drop your session:

```bash sudo ufw allow OpenSSH ```

If the server will publish a website, allow HTTP and HTTPS:

```bash sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw enable sudo ufw status verbose ```

A VPS with a web panel, a database or an internal application requires more specific rules. Avoid opening ports such as 3306 for MySQL, 5432 for PostgreSQL, 6379 for Redis or 8080 to the entire internet without a reason. When a service only needs to be accessed by the application itself, keep it on the server's local network.

The infrastructure's Anti-DDoS protection helps against volumetric attacks, but it does not remove the need to protect the application layer. Strong passwords, correct permissions, request limits and plugin updates remain the project's responsibility.

Install the foundation of your application

For a traditional web stack, Nginx is a lightweight and efficient option as a web server and reverse proxy:

```bash sudo apt install nginx -y sudo systemctl enable --now nginx ```

Then, open the IP address in your browser. If the default page appears, the service is responding. From there, you can install PHP, Node.js, Python, Docker or a management panel depending on the project.

Docker is often a good choice for n8n, Coolify, APIs and applications with several services, because it organizes dependencies into containers. On the other hand, it requires attention to persistent volumes, memory consumption, published ports and image updates. For those who manage a few PHP sites, a panel such as cPanel, aaPanel or CyberPanel can speed up tasks like domains, email, SSL and databases. The best option is the one that reduces operational work without limiting the customization you need.

Domain, SSL and configuration files

Once the application is responding internally, point your domain's DNS to the VPS IP address. Propagation may take some time, depending on the configured TTL. Only after the domain responds correctly should you issue and validate the SSL certificate.

Never leave database passwords, API tokens and private keys inside code pushed to the repository. Use environment files, such as `.env`, with restricted permissions. A secure practice is to keep these files outside the public folder and limit read access to the user running the application.

Also set up backups. A backup is not just a complete image of the VPS: databases, user-uploaded files and project configurations need their own routine. Keep at least one copy in a location separate from the server. A backup on the same disk protects against accidental deletion, but it does not solve a major infrastructure failure or unauthorized access to your account.

Monitor resources before the server stops

A VPS does not need to be at its limit to become slow. Exhausted memory, a full disk and poorly configured processes usually show up first as small signs: pages loading slowly, automations running late or unexpected restarts. Check basic usage with:

```bash htop df -h free -h ```

Install `htop` if it is not available. It lets you identify processes consuming CPU and memory in real time. Also monitor the logs of Nginx, the application and the database. Repeated errors should not be ignored just because the service is still online.

For commercial projects, set up external uptime monitoring and disk usage alerts. This is especially important for stores, support systems, automations and trading operations that cannot depend on manual checks.

When it makes sense to ask for specialized support

There are situations where setting things up yourself is the right choice, especially for developers who need full control. But if the priority is getting a site, panel or desktop environment online quickly, technical support saves hours of trial and error. HostMF offers Linux VPS with immediate activation, NVMe SSD, unlimited traffic and panel options for different use cases. Support is available in English and Portuguese.

Start with a simple structure, document every change and keep access, updates and backups under control. A well-configured Linux VPS is not the one with the most tools installed, but the one that runs exactly what is needed with security, speed and predictability.

Need a server to put this into practice?

Windows and Linux VPS with instant activation, NVMe SSD and 24/7 support.

View VPS plans
Cookies

By using this site, you automatically agree that we use cookies. For what?

I agree