DEV Community

Cover image for Day 3: Exploring Vagrant and Linux Server Setup
Kanavsingh
Kanavsingh

Posted on

Day 3: Exploring Vagrant and Linux Server Setup

Welcome Back to My DevOps Journey!

Hello everyone! Welcome to Day 3 of my 30-day DevOps journey. Today, I'll share insights from section 5 of the "DevOps Beginners to Advanced with Projects" course by Imran Teli. This section covers the fundamentals of Vagrant and Linux Server setup, which are crucial tools for creating reproducible development environments.

Understanding Vagrant

What is Vagrant?
Vagrant is an open-source tool for building and maintaining portable virtual development environments. It provides a simple and consistent workflow for managing virtual machines, making it easy to work with different operating systems and configurations.

Why Use Vagrant?
Consistency: Vagrant ensures that your development environments are consistent across all team members and production environments.
Portability: Vagrant environments can be easily shared and replicated.
Automation: Vagrant automates the setup of development environments, saving time and reducing errors.

Getting Started with Vagrant

Installation:

Download and install Vagrant from the official website.
Install a hypervisor such as VirtualBox.
Creating a Vagrantfile:

Initialize a new Vagrant project:

vagrant init

Edit the Vagrantfile to configure your VM. For example:

In ruby

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network "private_network", type: "dhcp"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
end

-- Managing the VM:

  • Start the VM:

vagrant up

  • SSH into the VM:

vagrant ssh

  • Halt the VM:

vagrant halt

-- Setting Up a Linux Server

Why Linux Server?
Linux servers are widely used in the industry due to their stability, security, and performance. Understanding how to set up and manage a Linux server is essential for any DevOps professional.

Basic Linux Server Setup
Installing the Server:

Choose a Linux distribution (e.g., Ubuntu Server).
Install the server using the distribution's installation media.
Configuring the Server:

Update the system:

sudo apt update && sudo apt upgrade

  • Set up a firewall:
    sudo ufw allow OpenSSH
    sudo ufw enable

  • Create a new user:

sudo adduser newuser
sudo usermod -aG sudo newuser

  • Setting Up SSH Access:

Generate SSH keys on your local machine:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  • Copy the public key to the server: ssh-copy-id newuser@your_server_ip

My Learning Experience:-
Exploring Vagrant and setting up a Linux server has been incredibly informative. Vagrant's ability to create consistent and portable development environments simplifies collaboration and deployment processes. Understanding Linux server setup is crucial for managing production environments and ensuring system reliability.

What's Next?
Tomorrow, I'll dive into Section 6 and maybe Section 7, a critical aspect of modern DevOps practices. Stay tuned for more exciting insights!

Connect with Me
Feel free to connect with me on LinkedIn for more updates and to join the conversation. Let's learn and grow together in this exciting field of DevOps!

Top comments (2)

Collapse
 
piya__c204c9e90 profile image
Piya

I really enjoyed reading this piece. Great article!

Collapse
 
singh_in_cloud profile image
Kanavsingh

Thanks, Hope it will help the community...