How do I copy/paste into a minimal installation of CentOS on VirtualBox?

Solution 1:

For that to work, you have to install the Guest Additions. That will give you a shared clipboard.

After starting your VM, you can install the Guest Additions from the menu. Click on Devices and then select Insert Guest additions CD image.

Another way is, when your VM is off, you can attach an ISO image to it from the VirtualBox GUI. It is under the Storage tab.

When you install VirtualBox, it should contain the Guest Additions ISO image as well. If you can't find it, you can download it from here. Make sure it matches the exact version of Virtualbox.

The reason you need to install the Guest Additions to get copy and paste working is that your VM is a separate machine running in its own environment that is unaware of the host machine. You have to install drivers on the guest machine so it can communicate with the Virtualbox instance running on the host.

You can use your mouse without Guest Additions, but then it is either captured by the guest or owned by the host. You transfer control to the Guest by clicking in the Guest window. You have to "release" the mouse from the guest using a key combination (Right-Alt by default) to use it on the host again. See imgur.com/a/Ci5HM

If you have the Guest Additions installed, you mouse moves seamlessly between guest and host.

Note that if you don't have a GUI on your VM, but only a console, then you won't get a mouse pointer. A console system has no mouse. The Bash shell has no clipboard i.e. you can't copy/paste from/to a console-only system.

The easiest way to get around that is to use ssh to your VM from your host. You can then use copy and paste in the ssh terminal.