- install virtualbox
- install vagrant
There are several ways to do this, but a quick easy way to get a base install with a development environment already configured would be to use an already configured box.
For e.g. laravel/homestead https://laravel.com/docs/5.7/homestead - Follow the instructions to install Homestead.
-
Edit the Homestead.yaml file so you can share folders between the Virtualbox and your host macOS
-
e.g. for the rest of the instructions, it is assumed that you've placed your Homestead directory in ~/Servers/Homestead
Once the above is all set up and you can vagrant ssh
into your virtualbox:
-
sudo apt-get update
-
sudo apt-get install ubuntu-desktop
-
check in this file
sudo nano /etc/ssh/sshd_config
that the lineX11Forwarding yes
is set to yes
-
sudo apt install xfce4 xfce4-goodies
-
sudo apt install tightvncserver
-
Startup the VNC Server, type
vncserver
-
It will ask you to setup a password for when you try to connect to this
-
It will ask you to setup a view-only password, can say no
It will then create config files and set the new 'X' desktop as homestead:1
Example, something like this:
New 'X' desktop is homestead:1
Creating default startup script
- Kill the :1 instance that is running for now by typing in:
vncserver -kill :1
- Backup the original xstartup
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
- Edit the file
nano ~/.vnc/xstartup
and add these lines to the file:
~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
- Make the file executable:
sudo chmod +x ~/.vnc/xstartup
- Now startup the VNC server again:
vncserver
- Can get a VNC Viewer here https://www.realvnc.com/en/connect/download/viewer/
- Or use screen sharing
- Open up the VNC Viewer and connect to: 192.168.10.10:1 Or whatever IP address you set for Homestead
-
It will log you in as
root
and you may want logout and login asvagrant
-
To reboot the system, can use the GUI to Shut down or reboot
-
If the GUI is having problems, in terminal, if you're in Homestead and the terminal prompt looks like
vagrant@homestead
, then you can typesudo reboot
to reboot the system. -
If you're at the macOS terminal prompt, and want to get into vagrant@homestead, then type:
vagrant ssh
-
If you've rebooted the system, from the macOS terminal prompt: type
vagrant ssh
, then typevncserver
to start up the server again.