[1] Nginx Server Setup - VirtualBox Installation and Putty Connection

How to Set Up a Linux Virtual Environment for Testing Using VirtualBox on Windows 10

Setting up a Linux virtual environment can be helpful for testing purposes. This guide walks you through setting up a virtual machine on Windows 10 using VirtualBox.


1. VirtualBox Download

To begin, download VirtualBox.

virtualbox download
  • Go to VirtualBox Downloads.
  • Download the installer for your OS (choose "Windows hosts" for Windows 10).

virtualbox download

After downloading, proceed with the installation by following the prompts.


2. RHEL (Red Hat Enterprise Linux) OS Download

Since CentOS reached its End of Life (EOL), it's recommended to use RHEL.

  • Visit RHEL Downloads (version 9.4 as of 2024.11.02).
  • To use RHEL for free, register for an Individual Developer Subscription. There is no cost for registration.

3. VirtualBox - Setting Up a RHEL Virtual Machine

  1. Create a New Machine
  • Open VirtualBox and click "New.", Set the storage path.

  1. Set Up VM Password
  • Create a password for your VM account during the installation setup.

  1. Allocate Resources to VM
  • Allocate resources based on your computer's specs. For example, assign 4 CPU cores and 8GB of RAM, and set the disk size to 20GB.

  1. Software Selection
  • Select the necessary software. If a GUI is not needed, deselect GUI-related packages to save resources.

  1. Connection Check
  • Confirm that the virtual machine is correctly set up by starting it and verifying the console output.

4. Connect to the VM Using Putty

  • To connect to the VM, follow the steps below:

4-1. Verify VM Settings in VirtualBox

1. Open VirtualBox, select the VM, and go to **Settings**.
2. Navigate to the **Network** tab, and set **Adapter 1** to **NAT**.
3. Set up port forwarding rules:

   - **Name**: Enter a name (e.g., SSH).
   - **Host Port**: Set an unused port on your host (e.g., 9999).
   - **Guest Port**: Enter 22 (default SSH port).

   Example:
   "putty -(9999 port)> VM -(22 port)> Linux"

4-2. Internal VM Configuration

  • Download and start the SSH server
sudo yum install -y openssh-server  # Install SSH server
sudo systemctl start sshd           # Start SSH server
sudo systemctl enable sshd          # Enable SSH to start on boot
  • Firewall configuration
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --reload
  • Modify SSH configuration
sudo vi /etc/ssh/sshd_config

Edit the file as follows (In VI, find the term with '/term', press 'a' to edit, then press ESC and type ':w' to save)

#PermitRootLogin $value -> PermitRootLogin yes (necessary if the ID is root)
#PasswordAuthentication yes -> PasswordAuthentication yes
(Remove # and change to yes)

Restart SSH to apply changes:
sudo systemctl restart sshd
  • Connection Verification



댓글

이 블로그의 인기 게시물

윤석열 계엄령 선포! 방산주 대폭발? 관련주 투자 전략 완벽 분석

한국 핵무장 논의와 방위산업 관련주: 핵무기 개발 과정과 유망 종목 분석

[로스트아크] 제작 효율 최적화 위한 영지 세팅