-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathvb-image-details.html
More file actions
244 lines (244 loc) · 20.2 KB
/
Copy pathvb-image-details.html
File metadata and controls
244 lines (244 loc) · 20.2 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<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>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<link rel="stylesheet" href="../markdown.css" />
</head>
<body>
<main>
<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/">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>Ran the following two commands to change the default C/C++ compiler to clang:</li>
</ul>
<pre><code>sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++</code></pre>
<ul>
<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>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.</li>
</ul>
<pre><code>alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
alias xemacs='emacs'</code></pre>
<ul>
<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>Removed all the empty default directories in ~/student other than Desktop and Downloads</li>
</ul>
<h3 id="introduction-to-cybersecurity-configuration">Introduction to Cybersecurity configuration</h3>
<ul>
<li>Cloned the github repo via <code>git clone https://github.com/aaronbloomfield/ics</code>; note that a <code>git pull</code> will still have to be executed each time to update it</li>
<li>Ran <code>sudo apt-get install default-jdk libssl-dev fcrackzip libarchive-zip-perl testdisk libboost-dev libboost-doc unzip traceroute strace nmap apache2 php libapache2-mod-php imagemagick</code>
<ul>
<li>default-jdk: for the Java assignments, such as RSA</li>
<li>libssl-dev: for the hashing HW (C++ MD5 routines)</li>
<li>fcrackzip: for the zip cracking program</li>
<li>libarchive-zip-perl: for the CRC program</li>
<li>testdisk: used in autopsy / sleuthkit (includes photorec)</li>
<li>libboost-dev libboost-doc: for boost</li>
<li>(see notes for 2019 for additional packages and installs)</li>
<li>unzip, if not already installed</li>
<li>traceroute, for networks</li>
<li>strace, for the kernel rootkits tutorial</li>
<li>nmap, apache2, libapache2-mod-php: for networks</li>
<li>python3, python3-pip, python-virtualenv, python3-virtualenv, for Python development</li>
<li>php, libapache2-mod-php: for PHP on apache</li>
<li>imagemagick: needed for autopsy</li>
</ul></li>
<li>Installed the kernel headers, as per <a href="http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/">http://derekmolloy.ie/writing-a-linux-kernel-module-part-1-introduction/</a>
<ul>
<li>Ran <code>apt-cache search linux-headers-$(uname -r)</code>, then installed that package (if not already installed)</li>
</ul></li>
<li>apache2 configuration
<ul>
<li>enabled the userdir apache2 module (i.e., using ~userid/ for each userid): <code>sudo a2enmod userdir</code></li>
<li>enabled the URL rewriting apache2 module: <code>sudo a2enmod rewrite</code></li>
<li>enabled PHP in user directories: edit (via sudo) <code>/etc/apache2/mods-available/php7.4.conf</code> (the number ‘7.4’ may be different), and change the <code>Off</code> in the <code>php_admin_value engine Off</code> line to <code>On</code></li>
<li>restart apache: <code>sudo service apache2 restart</code></li>
<li>the ‘student’ user can already view the apache2 error logs (in /var/log/apache2), but if they couldn’t, then they would have to have been added to the ‘adm’ group (i.e., <code>usermod -a -G adm student</code>, but this requires logging out and logging in for the group change to take effect)</li>
<li>made a ‘public_html’ directory both in ~student and /etc/skel; the former is chown’ed to student:student</li>
</ul></li>
<li>Install autopsy:
<ul>
<li><p>Download the latest version of autopsy and the the sleuthkit_java package from <a href="http://sleuthkit.org/">http://sleuthkit.org/</a> (the download page is on the autoposy tab there, not the sleuthkit tab)</p>
<ul>
<li>A given version of autopsy is “mated” to a specific version of sleuthkit, and they have to match. As of the writing of thus (June 2021), the current downloadable versions (autopsy 4.18.0 and sleuthkit-java 4.10.2) match.</li>
</ul></li>
<li><p>The command to install the package is <code>dpkg -i sleuthkit-java_4.6.6-1_amd64.deb</code> – when that fails due to dependency issues, run <code>apt-get -f install</code>, and it will install the dependent packages and finish the sleuthkit package installation</p></li>
<li><p>Unzip autopsy to /usr/local – the path will be something like /usr/local/autopsy-4.18.0/</p>
<ul>
<li>This should be unzipped as root: <code>cd /usr/local; sudo unzip -q /path/to/autopsy-4.18.0.zip</code></li>
</ul></li>
<li><p>This needs a specific version of Java (1.8) along with JavaFX; directions for installing this can be found <a href="https://github.com/sleuthkit/autopsy/blob/develop/Running_Linux_OSX.txt">here</a>; they are:</p>
<pre><code>wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | sudo apt-key add -
echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | sudo tee /etc/apt/sources.list.d/bellsoft.list
sudo apt-get update
sudo apt-get install bellsoft-java8-full
export JAVA_HOME=/usr/lib/jvm/bellsoft-java8-full-amd64</code></pre>
<ul>
<li>Put that list line at the end of <code>~student/.bashrc</code></li>
</ul></li>
<li><p>If the /usr/local/autopsy-4.18.0/unix_setup.sh file is Windows text file format, it needs to be converted</p>
<ul>
<li>Run <code>file /usr/local/autopsy-4.18.0/unix_setup.sh</code>, and if it says “CRLF line terminators”, it needs to be converted</li>
<li>Run <code>sudo fromdos /usr/local/autopsy-4.18.0/unix_setup.sh</code></li>
<li>Note that it doesn’t hurt to run that <code>fromdos</code> command regardless of the format</li>
</ul></li>
<li><p>Configure autopsy: from the autopsy directory (/usr/local/autopsy-4.18.0/), run <code>sudo JAVA_HOME=/usr/lib/jvm/bellsoft-java8-full-amd64 bash ./unix_setup.sh</code></p>
<ul>
<li>Use the actual path of the JRE, not necessarily what is listed in the command above</li>
<li>It should complete with no errors and print “Autopsy is now configured. You can execute bin/autopsy to start it”</li>
</ul></li>
<li><p>More autopsy configuration</p>
<ul>
<li>Run <code>sudo chmod 755 /usr/local/autopsy-4.18.0/bin/autopsy</code> to allow non-root to run autopsy</li>
</ul></li>
<li><p>Put in an alias in ~/.bashrc: <code>alias autopsy='/usr/local/autopsy-4.18.0/bin/autopsy --nosplash --jdkhome /usr/lib/jvm/bellsoft-java8-full-amd64'</code></p>
<ul>
<li>The <code>--nosplash</code> is critical, as there is a <a href="https://github.com/sleuthkit/autopsy/issues/6980">known bug</a> where the spash screen hides the confirmation box, and the confirmation box needs to be checked before one can open up the GUI.</li>
</ul></li>
<li><p>Run autopsy to get it working</p>
<ul>
<li>Ensure that the <code>~/.autopsy</code> directory is not present, and that no autopsy processes are running</li>
<li>The first time, run without the <code>--nosplash</code> option: <code>/usr/local/autopsy-4.18.0/bin/autopsy --nosplash --jdkhome /usr/lib/jvm/bellsoft-java8-full-amd64</code></li>
<li>That will hang on “starting modules” or “loading module services”</li>
<li>Kill the process (likely by finding the PID via <code>ps</code>), and then run with the <code>--nosplash</code> option</li>
<li>This should load properly with the “Welcome” dialog</li>
</ul></li>
</ul></li>
</ul>
<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>
</main>
</body>
</html>