How to set up Linux development environment in Windows

In many cases, we need to develop and debug in Linux. How do we solve this problem only on Windows computers? Let’s take a look at how Windows sets up Linux environments and manages them.

This article uses Oracle VM Virtualbox +Vagrant to set up one or more Linux systems on Windows and configure the development environment

Install required software

1. Oracle VM Virtualbox

VirtualBox is open source virtual machine software that we will use later to install Linux on our Windows systems

Official download address: www.virtualbox.org/

2, Vagrant

Vargrant is a tool for creating and deploying virtualized development environments. VirtualBox, for example, opens an interface for creating virtual machines, which Vagrant uses to create virtual machines and manage, configure, and install them automatically.

View some common commands using: Vargant

Official download address: www.vagrantup.com/

3. Download the required system

D:\vBox\vagrant-centos-7.2.box

The download address is www.vagrantbox.es/

How to build LinuxLinux development environment in Windows, learn to develop in Linux environment

4, Git

I won’t go into that

Software installation

1, the default installation software Oracle VM Virtualbox [recommended installation on a relatively non-system disk, and large space, otherwise install more system, disk will be full]

Vagrant is the default installation software. It is recommended to install Vagrant on a non-system disk with large space, otherwise the disk will be full.

3, Download the required Linux system to D:\vBox\vagrant-centos-7.2.box

4. Install Git by default

Start the deployment

1. Test the command running status

After installing the software, we use Git to test whether the installation is successful

Vagrant -V // View the version

Vagrant box list // View existing images

Vagrant box add custom system name box image path

CD /D/vBox // Go to the directory where the image resides

Vagrant box add centos/7.2 /D/vBox/vagrant-centos-7.2

Using the Vagrant Box List you can see that it was successfully added

3, create a folder Centos7 to initialize the image, D:/vBox/Centos7/

CD /D/vBox/Centos7 // Go to the folder

Vagrant box list //

Vagrant init centos/7.2 // Initialization

4. Configure the IP address

Vagrantfile Vagrantfile is the initialization configuration file in D:/vBox/Centos7/

Configure private IP: remove the # sign from the front. Config.vm.net work “private_network”, IP: “192.168.33.10”

5. Enable mirroring

Start the image in the /D/vBox/Centos7 directory with the Vagrant up command

Vagrant up // Starts the image

Vagrant SSH // Into the Linux system

To use root, run the su command

su

Default password: Vagrant

6, pingwww.baidu.com indicates a successful pull.

To view the local IP address, run the IP add command

ip add

7. Set up the development environment, taking Web as an example.

Click to view the Linux Quick Build Web development environment

Q&A

1. The database cannot be logged in as the root user

2. How to synchronize the local directory to the Linux system