Fundamentals 7 min read

Step-by-Step Guide: Install Linux on VirtualBox and Connect with Xshell

This tutorial walks you through installing VirtualBox, setting up a CentOS Linux virtual machine, and using Xshell to remotely access the system, covering download links, configuration steps, partitioning details, and essential command-line tips.

macrozheng
macrozheng
macrozheng
Step-by-Step Guide: Install Linux on VirtualBox and Connect with Xshell

This article explains how to install and use a Linux system by covering three aspects: installing a virtual machine, installing the Linux OS, and using the Xshell SSH client.

Virtual Machine Installation

VirtualBox is an open‑source virtualization software originally from Sun and now maintained by Oracle. It supports Windows, Linux, macOS, Android, etc. This guide uses VirtualBox to host a Linux VM.

Installing VirtualBox

Download the VirtualBox installer from https://www.virtualbox.org/wiki/Downloads.

Run the installer and follow the prompts.

Optionally customize the installation path.

Finish the installation.

Creating the Virtual Machine

Create a new Linux VM.

Allocate memory according to host capacity.

Create a virtual hard disk, choose VDI format, dynamic allocation, set location and size.

Linux Installation

CentOS is a community‑driven Linux distribution derived from Red Hat Enterprise Linux. This guide uses CentOS 7.6 as an example.

Download

Download URL: http://vault.centos.org/7.6.1810/isos/x86_64/

File: CentOS-7-x86_64-DVD-1810.iso

Installation

Add the ISO as a virtual CD/DVD in the VM.

Start the VM and select

Install CentOS 7

.

Choose language

English

.

Set timezone to Asia/Shanghai.

Select language packs (English and Simplified Chinese).

Choose software set

Server with GUI

and additional components.

Configure disk partitions; create a swap partition and optionally use manual partitioning.

Explanation of partition directories: / (root), swap, /boot, /usr, /var.

Set hostname and activate network.

Click

Begin Installation

to start.

Set the root password during installation.

After installation, reboot and complete first‑boot configuration.

Switch the VM network mode to Bridged to allow host access.

Xshell Usage

Xshell is a free SSH client for home and school users (requires an email address to obtain the download link).

Free version request URL: https://www.netsarang.com/zh/free-for-home-school/

After installing Xshell, open a terminal in the Linux VM.

Run

ifconfig

to obtain the VM’s IP address.

Use Xshell to connect to that IP, entering the username and password.

Once connected, you can operate the Linux system remotely.

Changing Default Boot Target

<code># Set default to multi‑user (text) mode
systemctl set-default multi-user.target
# Set default to graphical mode
systemctl set-default graphical.target
# Reboot
reboot
</code>

Common Linux Commands

Refer to the “Developer Essential Linux Commands” guide for a list of useful commands.

linuxVirtualizationInstallationCentOSXshellVirtualBox
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.