forked from uva-cs/pdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvb-image-details.html
145 lines (145 loc) · 13.8 KB
/
vb-image-details.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>VirtualBox image creation details</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="../../markdown.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="virtualbox-image-creation-details">VirtualBox image creation details</h1>
<p><a href="index.html">Go up to the main directory page</a> (<a href="index.md">md</a>)</p>
<p>For those who are interested, this is how the VirtualBox image was created.</p>
<h1 id="introduction">Introduction</h1>
<p>This page has a number of different sections, and the sections you need to install will vary depending on what course you are using this image for. The top of each section describes which of the sub-sections need to be installed for what.</p>
<p><strong>Software Versions</strong></p>
<p>This installation document installs the following versions:</p>
<ul>
<li><a href="http://ubuntu.com">Ubuntu 18.04, 64-bit</a></li>
<li>Clang++ version 6.0.0</li>
<li>g++ version 7.4.0</li>
<li>Python <a href="http://packages.ubuntu.com/xenial/python3">3.6.8</a></li>
</ul>
<p>Newer versions of the above may have since come out, but at the time of the last update of this document (August 2019), they the latest versions installed via apt-get.</p>
<p><strong>Notes</strong></p>
<ul>
<li>The guest hard drive reported 27 Gb of space available, prior to distribution of the image. The disk image itself was, after compaction, 10 Gb. When compressed via zip, it was 4.3 Gb in size.</li>
<li>You will likely need to use a different unzip program to extract the image; the ones that come bundled with most operating systems can not handle archives of that size. We have used <a href="http://www.7-zip.org/">7-zip</a> with success.</li>
<li>Video and sound (via youtube) worked fine with both Chrome and Firefox (although it may a bit slow depending on your computer's speed)</li>
<li>The VM may capture the mouse - to uncapture it, you press the "host key", (which is the right Control key on Linux and Windows hosts, and the left Command key on Mac hosts). To have it warn you about what this is, you can reset all warnings via the VirtualBox help menu, and it will warn you about this at boot-up</li>
<li>In the image creation process, you may run into a problem with VirtualBox where it cannot register a new (or different) disk because it has the same UUID as a previous disk that you are replacing. If so, then the command <code>VBoxManage internalcommands sethduuid disk.vdi</code> (changing <code>disk.vdi</code> appropriately) will change the UUID, and allow you to proceed</li>
</ul>
<h1 id="basic-installation">Basic installation</h1>
<p>All installations need to run through this, as it sets up the default Ubuntu installation.</p>
<p><strong>Basic installation</strong></p>
<ul>
<li>Created a new VirtualBox image
<ul>
<li>I named it "Ubuntu 18.04" or similar; this automatically selected Linux as the OS type; I manually selected "Ubuntu (64 bit)" as the version</li>
<li>I set the memory at 4096 Mb (instead of the default of 512 Mb), ensured that the disk size was "dynamically allocated" and was set to 40 Gb (instead of the default 8 Gb); everything else was set at the default</li>
</ul></li>
<li>I installed Ubuntu 18.04.3 LTS (64 bit), desktop edition, from the DVD image downloaded from <a href="https://www.ubuntu.com">ubuntu.com</a>
<ul>
<li>When prompted, I clicked on 'download updates' and 'install 3rd party software' when the options were given</li>
<li>For hard drive, I used the default option that was already selected</li>
<li>The computer name is cassiopeia, the login name is 'student', full name is 'l33t h4x0r', and the password is 'password'</li>
<li>This account can run root (system) commands via 'sudo' - if you don't know what this means, you can safely ignore it</li>
</ul></li>
<li>Once it was finished, I rebooted, and logged in</li>
<li>Via a Konsole, ran <code>sudo apt-get update</code> then <code>sudo apt-get dist-upgrade</code></li>
<li>Reboot!</li>
<li>Ran <code>apt-get autoremove</code> (which didn't have to remove anything)</li>
<li>VirtualBox guest additions
<ul>
<li>These are the utilities so that VirtualBox will work correctly with the host computer (proper full screen, etc.)</li>
<li>The menu option to "Insert Guest Additions CD Image" downloads a version that will not work with the current Linux kernel version, so the ISO must be manually downloaded from <a href="http://download.virtualbox.org/virtualbox/" class="uri">http://download.virtualbox.org/virtualbox/</a></li>
<li>Installing these requires the <code>gcc make perl</code> packages to be installed first</li>
<li>Once done, run <code>autorun.sh</code> from <code>/media/student/VBOXADDITIONS_4.3.36_105129</code> (or similar), and follow the prompts. Alternatively, if that does not work, try running <code>sudo bash VBoxLinuxAdditions.run</code> from that same directory.</li>
</ul></li>
<li>Reboot!</li>
<li>As per <a href="https://askubuntu.com/questions/973017/wrong-nameserver-set-by-resolvconf-and-networkmanager">here</a> to fix an issue with /etc/resolv.conf, edited /etc/systemd/resolved.conf to put 8.8.8.8 as the DNS line, and then ran the commands from the second answer: <code>sudo rm -f /etc/resolv.conf</code> followed by <code>sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf</code>, and then rebooted</li>
<li>Ran <code>apt-get remove thunderbird</code></li>
<li>Disable the KDE wallet system (if using KDE)</li>
</ul>
<h1 id="development-installation">Development installation</h1>
<p>The "Program and Data Representation configuration" section is for the <a href="http://uva-cs.github.io/pdr">Program and Data Representation</a> course, and it includes all of the compilers and editors needed. The "Python/Django" section installs the files needed to run Python 3 and the Django framework.</p>
<h3 id="program-and-data-representation-configuration">Program and Data Representation configuration</h3>
<ul>
<li>Installed the other packages: <code>sudo apt-get install clang emacs25 vim nasm astyle tofrodos source-highlight gdb lldb doxygen doxygen-doc graphviz ddd git g++ gobjc gnustep gnustep-make gnustep-common libgnustep-base-dev evince g++-multilib libc6-dev-i386 libc6-dev:i386 flex</code>
<ul>
<li>Note that there are two other <code>apt-get install</code> lines to be run, below</li>
<li>The last 5 packages are for Objective C, based on the instructions <a href="http://www.fatvat.co.uk/2010/04/getting-started-with-objective-c-on.html">here</a> (it may be that only a subset of those packages are actually necessary)</li>
</ul></li>
<li><p>Ran the following two commands to change the default C/C++ compiler to clang:</p>
<pre><code>sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++</code></pre></li>
<li>Downloaded Google Chrome from <a href="https://www.google.com/chrome/browser/desktop/index.html">here</a>, and installed it via <code>sudo dpkg -i google-chrome-stable_current_i386.deb</code>
<ul>
<li>If that installation does not work perfectly, run <code>sudo apt-get -f install</code></li>
<li>Then the .deb file was removed</li>
</ul></li>
<li>GNOME customization
<ul>
<li>Removed RhythmBox, Ubuntu Software, and Amazon from the favorites bar on the left-hand side</li>
<li>Added Terminal, Emacs, and Chrome to the favorites on the left-hand side</li>
<li>Disabled the screen saver lock, as detailed in the first answer <a href="https://stackoverflow.com/questions/28281077/how-do-i-disable-the-gnome-desktop-screen-lock">here</a></li>
</ul></li>
<li>Browser customization
<ul>
<li>Set the home pages for both Chrome and Firefox to online course repo site (http://uva-cs.github.io/pdr) and to Collab</li>
<li>Chrome is set as the default browser</li>
</ul></li>
<li>I loaded up emacs from the command line, and then told it to disable showing the startup messages (this could also be accomplished by following the guidelines <a href="http://xenon.stanford.edu/~manku/dotemacs.html">here</a>).</li>
<li><p>Added a few aliases were added (the last 4 lines of .bashrc) to help prevent people from accidentally removing files (adding -i for rm, mv, and cp; and aliasing xemacs to emacs). This was done both in /home/student/.bashrc and /etc/skel/.bashrc.</p>
<pre><code>alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
alias xemacs='emacs'</code></pre></li>
<li>Cloned the github repo via <code>git clone https://github.com/uva-cs/pdr</code>; note that a <code>git pull</code> will still have to be executed each time to update it</li>
<li><p>Removed all the empty default directories in ~/student other than Desktop and Downloads</p></li>
</ul>
<h3 id="introduction-to-cybersecurity-configuration">Introduction to Cybersecurity configuration</h3>
<p>These are not included in this repo, but can be found <a href="https://github.com/aaronbloomfield/ics/blob/master/docs/vb-image-details.md#introduction-to-cybersecurity-configuration">in the aaronbloomfield/ics repo</a>. These instructiosn were last updated in August 2019.</p>
<h3 id="service-learning-practicum-configuration-section">Service Learning Practicum configuration section</h3>
<p>These sections are no longer included here, nor used in the images currently distributed, but can be found in <a href="https://github.com/aaronbloomfield/slp/blob/master/docs/virtualbox-image-details.md#development-installation">the latest version of the aaronbloomfield/slp repo</a>. There were two sections for this: "LAMP configuration (with both PHP and Python 3)" and "Ruby on Rails configuration". Note that that repo, and the linked instructions, were last updated in August of 2017. All the versions stated therein are outdated, and many (all?) of those instructions may need tweaking to work properly again.</p>
<h3 id="programming-contest-configuration-section">Programming Contest configuration section</h3>
<p>This section is no longer included here, nor used in the images currently distributed, but can be found in <a href="https://github.com/uva-cs/pdr/blob/2019-spring/tutorials/01-intro-unix/vb-image-details.md#programming-contest-configuration-sections">an old version of the PDR repo</a>. That version was last updated in the spring of 2018.</p>
<h1 id="image-completion">Image completion</h1>
<p>The "Image finalization" section should be run on every image.</p>
<p><strong>Image finalization</strong></p>
<ul>
<li>Reboot (rebooting also clears out /tmp)</li>
<li>Run <code>apt-get autoremove</code> and <code>apt-get clean</code></li>
<li>Cleared browser history</li>
<li>Removed the apt-get proxy, if present: <code>sudo /bin/rm -f /etc/apt/apt.conf.d/02proxy</code></li>
<li>To reduce the size of the hard disk (since I have to host it for people to download), I ran <code>sudo cat /dev/zero > zero; sudo /bin/rm -f zero</code>. This creates a large file of all 0's until it runs out of space, then removes that file.</li>
<li>Ran <code>history -c</code> to remove the history of the commands entered on the command line</li>
<li>Logged out then shut down the guest, and ran: <code>VBoxManage modifyhd disk.vdi --compact</code> (using the real image file name instead of "disk.vdi"). A better way would be to load up into recovery mode and run zerofill, but the grub menu does not seem to be easily available to load into recovery mode, so I didn't pursue it any further.</li>
</ul>
<p><strong>Increasing the disk size</strong></p>
<p>The hard drive size was set at 40 Gb, and about 27 Gb is available; the rest is used by the operating system (and the swap partition). If you need more space than this, you will have to expand the hard drive. Be careful -- it is easy to accidentally erase the entire hard drive while doing this!</p>
<ul>
<li>The process has two steps: increase the VirtualBox disk image itself, then increase the partition of the guest OS.</li>
<li>To increase the VirtualBox disk image, power it down, and then run the following command. The size listed is the size in Mb, so 40960 Mb is 40 Gb. The command is: <code>VBoxManage modifyhd <imagefile> --resize 40960</code> -- but you will want to use a larger value if you are increasing the size.
<ul>
<li>Note that <code><imagefile></code> is the .vdi disk image, and should be the absolute path including the name and extension</li>
</ul></li>
<li>The second step is to resize the guest OS partition. The easiest way to do this is to download a bootable disk image for this purpose. You can use <a href="http://sourceforge.net/projects/gparted/files/gparted-live-stable/">Gparted</a>, which is free. Keep in mind that your guest OS is 64-bit, so you will want the "amd64" version.</li>
<li>To boot up via the Gparted image, Go to Settings -> Storage. In the "Storage Tree" box, there will be a "Controller: IDE" entry, with an "Empty" line below that; click on the "Empty" line, and select the Gparted disk image (using the blue DVD icon on the right). Click Okay, then start the image. It should start the Gparted disk.</li>
<li>When Gparted boots, selected the default boot option. In the text-based menus, hit Enter to select the defaults.</li>
<li>From the GUI, resize your partition. Hit "Apply" when done.</li>
<li>Double click on the red "Exit" icon, and select shutdown.</li>
<li>Back in Settings -> Storage -> Controller: IDE -> Empty, remove that disk from the virtual CD/DVD drive (under the blue DVD icon, select the last option to remove the image) -- it should not be there by default at this point. Click OK.</li>
<li>Boot into Kubuntu normally.</li>
</ul>
<p><strong>Changes for the future</strong></p>
<ul>
<li>none, yet</li>
</ul>
</body>
</html>