The introduction of cloud computing has fundamentally transformed how organizations create and maintain their websites and other online services and applications. Previously, organizations would have to purchase expensive physical machines to run their web servers. Now, organizations have the option of running powerful cloud-based servers from anywhere in the world via an internet connection. This has resulted in lower costs, increased flexibility, and better scalability for organizations’ infrastructures as they can expand the number of servers they use as needed based on demand.
CentOS (Community Enterprise Operating System) is one of the most widely used operating systems for cloud servers today. This Linux-based server operating system is a highly stable operating system that provides both strong performance and a high level of reliability. Because CentOS is an open-source product, many developers, hosting providers, and system administrators use it as their primary server operating system because of its cost advantages over proprietary operating systems and high level of security as well as its intended lifecycle of long-term server deployment.
AWS provides an advanced cloud infrastructure for businesses. Companies can use the AWS Cloud to host their servers and applications. AWS allows customers to launch and run virtual servers very quickly, with the expectation of being able to scale their resources up or down at any time, as necessary, and to store their data in a completely separate location from their physical servers. One of the services provided by AWS is Amazon EC2 (Elastic Compute Cloud).
Users can use EC2 to launch and manage virtual servers in order to run their business applications. This tutorial will explain how to use EC2 to launch a CentOS Stream 10 instance on AWS, perform basic configuration, set up security groups, connect to the server, and set up the environment for the server. You will learn everything necessary to perform these tasks and get your CentOS Stream 10 instance running on the Amazon Cloud, even without having significant experience with cloud computing.
What Is CentOS Stream 10?
Overview of CentOS Linux
CentOS Linux is a free and open-source operating system created using the Linux kernel and other open-source software. It does this in order to provide a reliable, secure, and stable platform for server, database, and application hosting in a variety of operating environments.
Because CentOS is an open-source, community-developed project, there are many commercial developers and companies that take advantage of it to develop websites, databases, and applications. Another strength of CentOS is that it has been tested and verified to deliver enterprise-grade reliability. System administrators can rely on CentOS to have been tested and securely patched before being deployed to a production environment. As a result, many enterprises utilize CentOS and rely on it to provide unwavering reliability.
Key Features of CentOS Stream 10
CentOS Stream 10 builds on the previous version’s stability and reliability, but adds new advantages for both cloud hosting and production environments. Regular security updates are an example of one of CentOS’s advantages, as this will help keep your servers protected from potential security weaknesses and threats.
Maintaining a consistent level of security is crucial for any business that is hosting applications or managing sensitive data. Another major advantage of CentOS is the overall stability of the operating system, as it has been developed to run for extended periods of time without experiencing any type of failure or having any major issues arise.
This feature is particularly beneficial for websites and online services that are required to remain online 24 hours per day, seven days per week. The international community of developers and system administrators also provides additional resources for users by providing tutorials, tools, and troubleshooting information.
CentOS additionally works well with other enterprise level tools and server software, therefore, making it a great operating system for enterprise environments.
Why Use CentOS for Cloud Servers?
Because of its dependable performance and strong security features, CentOS is frequently chosen by numerous cloud providers as the platform of choice for their servers. Many developers and hosting services rely on CentOS as the platform for developing/serving websites, applications, and APIs.
Another reason for using CentOS is its size; the compact nature of CentOS allows it to operate optimally on small cloud instances, thereby helping save money when provisioning server hardware. Many startups and developers operate on limited budgets, making this point especially noteworthy.
Finally, CentOS has excellent interoperability with large cloud providers like Amazon Web Services (AWS). By supporting these leading companies in the cloud, it provides developers with an easy way to start up and manage their cloud-based CentOS installations.
What Is AWS EC2?
Introduction to AWS EC2
Amazon EC2 is a cloud computing platform that provides you with the opportunity to set up and run a virtual server when needed. Instead of purchasing a physical server, you can create a virtual server in minutes and start using it without delay.
You can create an EC2 instance with your preferred operating system (OS). On top of this, you have the flexibility to choose how you want to configure your instance in terms of size, storage, and network. There are many options available for setting up your EC2 instance, depending on what you need for your project.
Benefits of Using AWS EC2
The scalable infrastructure is one of the primary benefits of EC2. It is simple to scale resources (e.g., storage and computing power) up or down as needed based on your usage (traffic or workload).
This flexibility allows businesses to manage unexpected spikes in their user base without the expense of upgrading physical hardware. Another advantage of using AWS is the pay-as-you-go pricing model. Unlike traditional hosting solutions, you’ll only be charged for the actual computing resources you utilize, making cloud servers cheaper than traditional hosting options in most situations.
A third significant advantage is that AWS has data centers located throughout the globe. By implementing your servers within close proximity of your users, you can improve the response time of your site and provide your users with better performance.
EC2 Instance Basics
It’s helpful to know what type of EC2 instance you need before launching an EC2 server. Instance Types are the main indicators of how powerful your server will be; they will define the amount of CPU and memory, as well as the performance level of your instance.
Instances can be categorized as either small or large. A small instance will usually work well for testing, while a large instance generally works better when you have actual production workloads. Storage is typically provided to an EC2 Server through EBS ( Elastic Block Store).
The EBS service is used to store files, databases, and applications for an EC2 Server. Networking is what you use to configure how your EC2 Server communicates with other servers (through the internet) or the outside world. Security Groups are used to configure firewall rules and define what traffic will be allowed to pass through to your EC2 Server.
Prerequisites Before Launching CentOS Stream 10 on AWS
Before launching your CentOS 10 on AWS, there are a few simple things you need to prepare. These requirements ensure the setup process runs smoothly.
First, you need an active account with Amazon Web Services. Creating an account is free, although AWS may request a payment method for verification. Once registered, you will have access to the AWS Management Console where all cloud services are managed.
It is also helpful to have basic knowledge of Linux commands. While this guide explains the main steps, understanding simple commands like navigation, updating packages, and editing files will make server management easier.
Next, you need an SSH client to connect to your server. Linux and macOS users can use the built-in Terminal application. Windows users often use tools like PuTTY to establish an SSH connection.
Finally, make sure you have a stable internet connection. Launching a server and connecting through SSH requires consistent network access. Once these prerequisites are ready, you can begin launching your CentOS server on AWS.
Step-by-Step Guide to Launch CentOS Stream 10 Server on AWS EC2
Step 1 – Log in to AWS Management Console
Start by logging into the AWS Management Console using your account credentials. After signing in, you will see the main dashboard where all AWS services are listed.
From the dashboard, search for EC2 and open the service. This will take you to the EC2 control panel where you can create and manage cloud servers.
Step 2 – Launch a New EC2 Instance
Inside the EC2 dashboard, click the “Launch Instance” button. This option allows you to create a new virtual server.
You will be asked to enter a name for your instance. Choose a simple name such as “CentOS-Server” to make it easier to identify later.
Step 3 – Choose CentOS Stream 10 AMI
Next, you must select an Amazon Machine Image (AMI). An AMI is a template that contains the operating system and basic configuration needed to launch a server.
Search for CentOS Stream 10 in the available images and select the appropriate version. Make sure you choose an image that matches the correct architecture, such as x86 or ARM.
Step 4 – Select an Instance Type
After choosing the AMI, you need to select the instance type, which determines the server’s computing power.
For beginners or small projects, t2.micro or t3.micro instances are commonly used. These options are lightweight and often included in the AWS free tier.
If you plan to run heavy applications, you may choose larger instance types with more memory and CPU power.
Step 5 – Configure Key Pair
AWS requires a key pair to securely access your server.
Create a new key pair and download the private key file (.pem). This file is extremely important because it allows you to log in to the server through SSH. Store it in a safe location and never share it publicly.
Step 6 – Configure Network and Security Group
Next, configure the security group, which acts like a firewall for your server.
You should allow the following ports:
- SSH (22) – for remote server access
- HTTP (80) – for websites
- HTTPS (443) – for secure web traffic
These settings ensure that your server can be accessed and used for web applications.
Step 7 – Configure Storage
AWS will automatically assign a default storage size to your instance. For testing or basic websites, the default storage is usually enough.
However, if you plan to host large applications or store large files, you can increase the disk size during this step.
Step 8 – Review and Launch the Instance
Finally, review all configuration settings carefully.
Check the instance type, storage, security group rules, and selected AMI. Once everything looks correct, click Launch Instance.
Within a few minutes, your CentOS Stream 10 server on AWS EC2 will be running.
How to Connect to Your CentOS Stream 10 Server?
Connect Using SSH (Linux / Mac)
To connect from Linux or macOS, open the Terminal and navigate to the folder containing your private key.
Use the following command:
ssh -i key.pem centos@your-public-ipReplace your-public-ip with the public IP address of your EC2 instance. Once connected, you will have full command-line access to your server.
Connect Using PuTTY (Windows)
Windows users typically connect using PuTTY.
First, convert the .pem key file into a .ppk format using the PuTTYgen tool. After converting the key, open PuTTY and enter your server’s public IP address.
Load the .ppk key file and start the connection. You will then gain access to the CentOS server.
Basic Server Setup After Launch
Update the System
After connecting to the server, the first step is updating all packages. This ensures your system has the latest security fixes.
sudo dnf update -yUpdating the system helps protect your server and improves performance.
Install Essential Packages
Next, install some useful tools that are commonly used on servers:
- nano – simple text editor
- wget – download files from the internet
- git – version control system
- curl – command-line data transfer tool
These tools make it easier to manage files and install applications.
Create a New User
It is recommended to create a new user account instead of working directly with the root user. This adds an extra layer of security and reduces the risk of accidental system damage.
Essential Security Configuration
Disable Root Login
Disabling direct root login helps protect your server from unauthorized access. Instead, administrators should log in using a regular user account with sudo privileges.
Configure Firewall
A firewall controls which connections are allowed on the server. Proper firewall rules help block suspicious traffic and protect services running on your system.
Enable Automatic Security Updates
Automatic updates ensure that your system receives the latest security patches without manual intervention. This helps keep the server protected against new vulnerabilities.
Change Default SSH Port
Changing the default SSH port from 22 to another number can reduce automated attacks that scan servers for open SSH connections.
Installing a Web Server on CentOS Stream 10
Install Apache
Apache is one of the most popular web servers used to host websites. It is stable, widely supported, and easy to configure.
Install Nginx
Nginx is another powerful web server known for its high performance and low resource usage. Many modern applications use Nginx for handling large amounts of traffic.
Test Your Server in Browser
After installing a web server, open your browser and enter your server’s public IP address. If everything is configured correctly, you will see the default web server page, confirming that your server is running.
Monitoring Your AWS EC2 Instance
Monitoring your server helps you understand how resources are being used.
AWS provides a monitoring tool called CloudWatch that tracks server performance. It can show metrics like CPU usage, memory activity, and network traffic.
Regular monitoring allows you to detect issues early and scale resources if your application grows.
Common Issues and Troubleshooting
Unable to Connect via SSH
If you cannot connect through SSH, check the security group rules and ensure port 22 is open.
Permission Denied Error
This usually happens when the private key permissions are incorrect or the wrong username is used.
Instance Not Starting
Sometimes instances fail to start due to configuration errors or resource limits. Reviewing the instance logs can help identify the issue.
Cost Optimization Tips for AWS EC2
Running cloud servers efficiently can save money.
One simple method is to stop instances when they are not in use. This prevents unnecessary charges for idle servers.
You should also take advantage of the AWS free tier, which allows new users to run small instances at no cost for a limited time.
Choosing smaller instance types for testing or development can further reduce expenses.
Advantages of Running CentOS on AWS
Running CentOS on AWS EC2 provides several important advantages for developers and businesses. One of the biggest benefits is scalability. AWS allows you to increase server resources whenever your website or application grows. Instead of upgrading physical hardware, you can simply choose a larger instance or add additional servers.
Another advantage is reliability. AWS infrastructure is built on a network of highly secure data centers that operate around the world. This means your server can run with minimal downtime and maintain consistent performance.
The platform also offers global data centers, allowing you to deploy servers close to your users. This improves loading speeds and creates a better experience for visitors accessing your website or application.
Finally, AWS provides enterprise-grade infrastructure that supports professional workloads. Combined with the stability of CentOS, this creates a powerful environment for hosting applications, websites, and online services.
Alternatives to CentOS on AWS
While CentOS is a strong choice for cloud servers, several other Linux distributions are also popular on AWS.
Ubuntu is widely used because it has extensive documentation and a large developer community. Many beginners prefer it due to its simplicity.
Rocky Linux is another reliable option that aims to provide enterprise stability similar to traditional CentOS systems.
AlmaLinux is also designed as a stable and free enterprise-level Linux distribution. It is often used as a replacement for older CentOS deployments.
Each operating system has its own strengths, but the best choice depends on your project requirements and personal preference.
Conclusion
Launching a CentOS Stream 10 server through AWS’s EC2 service is a simple process once you understand how it all works. First, you must create your AWS account and choose the appropriate Amazon Machine Image (AMI) for CentOS Stream 10, then configure your security group(s) accordingly, finally using ec2-lls to launch your Instance.
Once the server is launched and you connect via SSH to manage the system and perform the essential configuration for your New Instance, installing additional programs and making the necessary Security Configuration changes will keep your Server stable and secure.
The Cloud Infrastructure offered by AWS is robust and flexible enough to expand based on your Project needs, while Hosted on top of a reliable & performance-optimized Operating System (CentOS), it allows you to easily build and Host Web pages, Applications, and/or Development Environments. If you are not familiar with Cloud Computing, working with CentOS on AWS EC2 offers an opportunity to understand how current Cloud Systems operate, while also building valuable technical experience.
