Setting Up a Linux VPS Server for Hosting

Admin
·
min read
Thumbnail
 
 
 
 
Discover the secrets to effective Linux VPS hosting! From setting up your server to optimizing your budget.

Buying a Server

VPS providers often offer plans with fixed monthly costs, providing predictability in budgeting. This can be particularly beneficial when you have a steady or predictable workload with substantial data transfer requirements.

The inclusion of features such as unmetered bandwidth in certain plans eliminates concerns about overage charges, making it a cost-effective choice for projects with significant data transfer needs.

While you don't directly need to worry about physical disk damage on a VPS, it's crucial to take proactive measures such as regular backups, monitoring, and choosing a reliable hosting provider.

VPS VLE-2


vCore (Virtual Core): The vCore is a virtualized processing unit. In this server, there are two virtual cores, which means the server has the equivalent of two physical CPU cores. This allows the server to handle parallel processing and execute multiple tasks simultaneously.

RAM (Random Access Memory): The server is equipped with 2 GB of RAM. RAM is a type of volatile memory used by the server to temporarily store and quickly access data that is actively being used or processed. Sufficient RAM is crucial for the smooth functioning of applications and the overall performance of the server.

Storage: 40 GB SSD NVMe (Solid State Drive Non-Volatile Memory Express): The server is equipped with a 40 GB SSD NVMe storage. SSDs are faster and more reliable than traditional HDDs (Hard Disk Drives). NVMe is a protocol designed for SSDs, providing even faster data transfer speeds compared to older protocols. The 40 GB storage is where you can store your operating system, applications, and data.

Bandwidth: 500 Mbps Unmetered: Bandwidth refers to the data transfer rate of the server's internet connection. In this case, the server has a bandwidth of 500 Megabits per second (Mbps). The term "unmetered" means that there is no set limit on the amount of data that can be transferred over the network within the specified bandwidth. It allows for a consistent and uninterrupted data transfer at the specified rate.

OVH VPS Server VLE-2

Operating System: Installing Ubuntu Server 22.04.3 LTS on your server offers advantages. It's a Long Term Support (LTS) release, ensuring stable performance and security updates until 2027. The version introduces newer features, enhanced hardware compatibility, and improved software stacks.


Accessing the Server

When setting up a VPS, the process typically involves receiving an email with a temporary password once the server is ready.

The initial access to the server requires connecting through the command line or your preferred SSH client. Follow these steps:

  1. Open your command line interface (cmd) or your chosen SSH client.

  2. Use the following command, replacing user with your username and your_server_ip with the server's IP address:

ssh user@your_server_ip
# Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-91-generic x86_64)
  1. Upon executing the command, you will be prompted to enter a password. It's important to note that when typing the password, you won't see letters or asterisks on the screen. This is a security feature, so proceed to type your password without visual feedback.

  2. After successfully entering the temporary password, you will gain access to your server.

  3. It is crucial to change the temporary password to a new, secure one.

sudo passwd

Changing the Default Username

Changing the default username, such as "ubuntu," is generally considered a good security practice as it adds another layer of complexity for potential attackers. Default usernames are well-known and commonly targeted, so altering the default username makes it less predictable and potentially more secure.

If you decide to change the default username, it's advisable to do this during the initial setup of your VPS to minimize potential complications. Additionally, make sure to document the changes and update any relevant configurations to maintain a clear understanding of your server's setup.


However, keep in mind that changing the default username involves additional steps and precautions, and it might have implications on existing configurations and permissions. Here are some considerations:

  1. Existing Configurations: Changing the username might require updates to existing configurations, scripts, and permissions associated with the default username. Make sure to review and update these accordingly.

  2. System Users: If the default username is used for specific system-level tasks or services, changing it may impact those functionalities. Ensure that you update any dependencies on the old username.

  3. Security through Obscurity: While changing the default username adds a layer of security through obscurity, it should not be the sole security measure. Always use strong, unique passwords, implement regular security audits, and keep your system and applications up-to-date with the latest security patches.

# Create a new user with sudo privileges
sudo adduser newusername
sudo usermod -aG sudo newusername

# Log in as the new user
su - newusername

# Optional: Confirm that you can use sudo
sudo whoami

# Once you're certain, you can disable the original ubuntu user
sudo usermod --expiredate 1 ubuntu

Remember to replace newusername with your desired new username. Always exercise caution when making changes to user accounts to avoid unintended consequences.


Host Multiple Websites

With Nginx, you can efficiently host multiple websites on a single machine through virtual hosting. Its robust configuration capabilities enable you to define distinct server blocks for each site, directing traffic based on domain names.

This setup optimizes resource usage, saving you money on infrastructure. Additionally, Nginx seamlessly integrates with Let's Encrypt, enabling you to obtain free SSL certificates.

Read more: Hosting Multiple Websites with Nginx on a Single Linux Server

VPS VLE-2


Billing Model

VPS (Virtual Private Server), especially a Linux-based one, can be advantageous when specific needs and significant data transfer are key considerations for your project.


VPS Linux Server vs Cloud Hosting:

VPS Linux Server Cloud Hosting
Suitable For Projects with consistent resource needs Projects with dynamic workloads and varying resource requirements
Cost Model Fixed monthly cost, cost-effective for steady workloads Pay-as-you-go model, cost-effective for small to medium-sized projects
Advantages Unmetered bandwidth for significant data transfer Scalability based on usage, flexibility for dynamic workloads

Static Website Hosting Comparison:

Let's break down the billing models for the VPS Linux server and cloud hosting, considering the requirements for hosting a static website with 10GB downloads per day and 1GB storage.

Hosting Service Storage Cost Bandwidth Cost Total Monthly Cost
VPS Linux Server Included (40GB) Unmetered (No additional cost for data transfer) $5 per month
Cloud Hosting $0.26 for 10GB $1.50 for 10GB (Daily downloads: 10GB, Monthly: 300GB) = $45 $45.26 per month

Conclusion

Knowing your website needs and traffic patterns? A fixed price for hosting is your go-to solution. It brings predictability to your budget, offering stability for steady workloads. Consider it for a cost-effective and straightforward hosting choice.


References

  1. OVH VPS Limited Edition