Introduction
In the previous post (http://leaders-skills.blogspot.kr/2016/11/linux-in-vagrant-and-virtualbox.html), you might have created Linux in the vagrant and virtualbox environment.Now, you can set up a GUI environment for CentOS 6, as follows:
1. Install CentOS 6 update
2. Install "Desktop" packages
3. Install VirtualBoxGuestAdditions and related packages (optional)
4. Install ubuntu fonts (optional)
5. Modify Vagrantfile (optional)
<CentOS 6 with GUI>
Installing CentOS 6 update
You can login to the virtual machine (CentOS guest) and update it by running:mict@mict:~/centos6$ vagrant ssh
[vagrant@localhost ~]$ sudo yum update
Loaded plugins: fastestmirror, security
Setting up Update Process
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 37 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.7 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.47.rc1.el6_8.1 will be updated
---> Package bind-libs.x86_64 32:9.8.2-0.47.rc1.el6_8.3 will be an update
... [deleted] ...
util-linux-ng.x86_64 0:2.17.2-12.24.el6_8.1
Complete!
[vagrant@localhost ~]$
You have to reboot the virtual machine here for step 3.
Installing "Desktop" packages
You can group install by running:[vagrant@localhost ~]$ sudo yum groupinstall Desktop
Loaded plugins: fastestmirror, security
Setting up Group Process
Determining fastest mirrors
* base: ftp.neowiz.com
* extras: ftp.neowiz.com
* updates: ftp.neowiz.com
base/group_gz | 226 kB 00:00
Package 1:dbus-1.2.24-8.el6_6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:0.8.1-107.el6 will be installed
--> Processing Dependency: ppp = 2.4.5 for package: 1:NetworkManager-0.8.1-107.el6.x86_64
... [deleted] ...
xulrunner.x86_64 0:17.0.10-1.el6.centos
zenity.x86_64 0:2.28.0-1.el6
Complete!
[vagrant@localhost ~]$
You have to run startx after login to the CentOS 6 virtual machine.
[vagrant@localhost ~]$ startx
Installing VirtualBoxGuestAdditions and required packages (optional)
You will need to install VirtualBoxGuestAdditions to resize the CentOS GUI. The installation of VirtualBoxGuestAdditions needs some required packages beforehand. You need to run:[vagrant@localhost ~]$ sudo yum install kernel-devel kernel-headers gcc
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
... [deleted] ...
Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-17.el6 glibc-devel.x86_64 0:2.12-1.192.el6
glibc-headers.x86_64 0:2.12-1.192.el6 libgomp.x86_64 0:4.4.7-17.el6 mpfr.x86_64 0:2.4.1-6.el6
ppl.x86_64 0:0.10.2-11.el6
Complete!
[vagrant@localhost ~]$
Now, you can download the image by running:
[vagrant@localhost ~]$ wget http://download.virtualbox.org/virtualbox/5.1.10/VBoxGuestAdditions_5.1.10.iso
--2016-11-24 01:01:37-- http://download.virtualbox.org/virtualbox/5.1.10/VBoxGuestAdditions_5.1.10.iso
Resolving download.virtualbox.org... 182.162.106.10, 182.162.106.35
Connecting to download.virtualbox.org|182.162.106.10|:80... failed: Connection timed out.
Connecting to download.virtualbox.org|182.162.106.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 59408384 (57M) [application/octet-stream]
Saving to: “VBoxGuestAdditions_5.1.10.iso”
100%[==========================================================>] 59,408,384 11.2M/s in 5.1s
2016-11-24 01:02:45 (11.2 MB/s) - “VBoxGuestAdditions_5.1.10.iso” saved [59408384/59408384]
[vagrant@localhost
~]$ sudo mkdir /mnt/VBoxGuestAdditions
[vagrant@localhost ~]$ sudo mount -o loop,ro VBoxGuestAdditions_5.1.10.iso /mnt/VBoxGuestAdditions
[vagrant@localhost ~]$ sudo mount -o loop,ro VBoxGuestAdditions_5.1.10.iso /mnt/VBoxGuestAdditions
[vagrant@localhost
~]$ sudo sh /mnt/VBoxGuestAdditions/VBoxLinuxAdditions.run
Verifying
archive integrity... All good.
Uncompressing VirtualBox 5.1.10 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
vboxadd.sh: Starting the VirtualBox Guest Additions.
Uncompressing VirtualBox 5.1.10 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
vboxadd.sh: Starting the VirtualBox Guest Additions.
Could
not find the X.Org or XFree86 Window System, skipping.
[vagrant@localhost
~]$ rm VBoxGuestAdditions_5.1.10.iso
[vagrant@localhost
~]$ sudo umount /mnt/VBoxGuestAdditions [vagrant@localhost ~]$ sudo rmdir /mnt/VBoxGuestAdditions
Now, you have a CentOS 6 virtual machine with GUI. Step 4 and 5 will make it better in another post.