[LINUX] Start commands to make CentOS 7 unobtrusive in Parallels Desktop 16 for Mac

I'm a Mac user, but I had ** Parallels Desktop ** installed because Windows 10 may also be needed to support my customers.

On the other hand, even imagemagik, Vue.js, and even rbenv, which are used for Linux application development on Mac, ** "I don't want to install it because it pollutes the Mac environment!" ** I had a hard feeling.

Therefore, I decided to install CentOS 7 in Parallels Desktop to complete such "dirty?" In the VM volume (file).

I won't explain the introduction of CentOS 7 in Parallels Desktop, but the settings such as launching a command and hiding the Parallels app window are summarized below. * Currently at Parallels Desktop 16.

After installing CentOS 7 with Parallels, a user named Parallels will be created by default, GNOME will start, and you will be prompted to set a Parallels password and enter it. Up to that point, let's say you're done.

Ssh connection from Mac terminal

Paralells seems to automatically add the following to `/ etc / hosts``` on your Mac while booting CentOS. (The 10.XXX.XX.X`` part is the IP address of the VM automatically determined by Parallels)

10.XXX.XX.X    	centos7.shared centos7 #prl_hostonly shared

So from the Mac terminal app

% ssh paralells@centos7
parallels@centos7's password: 

You can connect with. The password is the password you initially set. It seems that / etc / host is automatically restored when you exit CentOS from Paralells.

I want to install Docker etc. as root

Parallels users can use sudo because wheel is added, but it is easier to become the root user. Therefore, change the password for root as well. As the parallels user, do su - with sudo to become root and then passwd.

[parallels@centos7 ~]$ groups $USER
parallels : parallels wheel
[parallels@centos7 ~]$ sudo su -
[sudo]parallels password:
Last login: 2020/08/17 (Month) 15:31:06 JST date and time pts/0
[root@centos7 ~]# passwd
Changing password for user root.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@centos7 ~]#

Now, from your Mac terminal,

% ssh root@centos7 
root@centos7's password: 

You can now log in with You can install Docker, git, and the libraries required for your environment as root.

In addition, I add a development user and usually log in here to use it.

[root@centos7 ~]# useradd development

Dedicate the / home / development directory to development only. (Paralells users have logged in to GNOME, so there are unnecessary directories such as Desktop and Documents, so we set up development as a user who does not log in to GNOME)

I want to start a VM command

To launch commands for each VM instead of launching Parallels apps one by one

% prlctl start <VM name>

You can start it with. The default VM name for CentOS 7 is CentOS 7, so rename it in the VM settings to make the command a little easier to launch. For example, centos7 is a little easier. fig.png

Each command is as follows (explanation labor saving).

% prlctl start centos7
% prlctl stop centos7
% prlctl restart centos7
% prlctl pause centos7
% prlctl resume centos7
% prlctl list --all

No need for Parallels windows

If you only use commands on CentOS, you don't even need a Parallels window. There was a setting that did not display properly.

% prlctl set centos7 --on-window-close keep-running

Summary

With the above settings, From the Mac terminal app, you can do a series of things from starting the VM to developing work and ending with just commands.

% prlctl start centos7
Starting the VM...
The VM has been successfully started.
% ssh development@centos7
development@centos7's password: 
Last login: Mon Aug 17 15:30:51 2020 from 10.211.55.2
[development@centos7 ~]$ 
……
…… <Development on CentOS etc.> ……
……
[development@centos7 ~]$ exit
Log out
Connection to centos7 closed.
% prlctl stop centos7    
Stopping the VM...
The VM has been successfully stopped.
% 

You can work "quietly?" Without displaying the Paralells window.

Note that there is of course a small time lag for starting from start to ssh login (you can't ssh right away), and don't forget to stop (a waste of CPU and memory resources if you don't use it).

Recommended Posts

Start commands to make CentOS 7 unobtrusive in Parallels Desktop 16 for Mac
Use Docker Desktop for Windows to start the latest odo with 2 commands
Tool to make mask image for ETC in Python
Check for external commands in python
How to make a model for object detection using YOLO in 3 hours
Introduction to Graph Database Neo4j in Python for Beginners (for Mac OS X)