Now we have an Ubuntu GNU/Linux installation up and running we'll look a few basic pieces of installation and configuration that will make your life easy.
Before we begin here's a little background.
Debian is the upstream distribution of Ubuntu. Debian packages exist as either binary or source packages with the .deb
extension. Under the hood [.deb] packages contain two .tar
archives with optional compression. The program handling the configuration, installation and removal of Debian packages is dpkg
.
The Advanced Packaging Tool APT is the "package manager" of Debian GNU/Linux and its variants (e.g. Ubuntu). It provides for the (almost) completely-automated discovery, retrieval, configuration, installation and removal of both binary and source packages. APT is wrapper around dpkg
adding useful extra functionality like automated package download, bulk package update, automatic package dependency tree resolution, etc...
Warning: I have experienced some issues with the combination of Ubuntu and VirtualBox which can make it kernel panic on boot causing the boot to fail.
I suspect those issues have been resolved by now, however I still strongly advise you take advantage of VirtualBox Snapshots now (as shown in the screen shot below) in case anything goes wrong in the next section so that you can rollback to your snapshot and go again if you need to.
Apologies: You'll need to type a few commands here yourself as we don't yet have copy and paste enabled between the virtual machine host and guest operating systems.
If GUI application Software Updater is open (it opens automatically on startup if there are updates) then close it. We're going to use the terminal-based update system (described above) to update our system now.
- Open a new Terminal and run
apt-get update
to update to the latest package definition list. You should see the following error message:
- So we need root eh? Indeed. Root is the super user (administrator) on Unix variants. Let's try our command again but this time we'll preface it with the
sudo
(super-user do) command to run it "as root". Run the commandsudo apt-get update
and let's see what happens:
-
You will see that you are prompted for your password (not the root password) to confirm that you are in the list of sudoers i.e. the list of users who have been granted the ability to run commands "as root" by the super user. The first account created (as part of the installation) gets added to the sudoers list automatically.
-
Now that we have an up-to-date package definition list we can run
sudo apt-get upgrade
to upgrade our system to the latest package and security updates:
- Once
sudo apt-get upgrade
has completed running you should see that it has "done" its job successfully:
Note: Here is where we get copy and paste working.
-
Open a new Terminal by pressing the shortcut
CTRL+ALT+T
or by pressing theSUPER
(Windows or Command) key, typingterm
and then pressingENTER
. This is how you launch applications in Ubuntu Linux i.e. it's the same as in Windows. -
Run the following command to install the tools we will use for compiling a few kernel modules which will help us test our OpenGL acceleration is working:
sudo apt-get install mesa-utils dkms build-essential linux-headers-$(uname -r)
-
Mount the VirtualBox Guest Additions ISO by selecting Devices => Insert Guest Additions CD image....
-
Once you see the following prompt select run to begin the process.
- Enter your password and select Authenticate to run the installation script as root.
- You should see the following output indicating you've succeeded.
-
Press
ENTER
to close the terminal. -
Open a new terminal and run
sudo reboot
to restart your VM.
To confirm that everything's working OK do the following:
-
Open System Settings by pressing the
SUPER
(Windows) key, typingsystem se
and then hittingENTER
. -
Open the Screen Display option and then select whichever resolution takes your fancy. I selected
1024x768
which in "retina mode + 200% scale factor" will be2048x1536
size-wise. -
Run
glxgears
. If the "world falls over" then shut down your VMsudo shutdown -h now
and reconfigure your VM to deselect enable 3D acceleration. Start your VM again and re-runglxgears
to make sure all is now well.
Note: See VirtualBox ticket 12941 for more information.
OK so what's next? Let's install some general programs we'll need later.
We'll need git
for sure, so let's sudo apt-get install git
now.
We'll need a text editor and I'm a vim
mouse potato so let's sudo apt-get install vim
now.
If you prefer emacs
you could sudo apt-get install emacs
and then add the awesome spacemacs distribution like so git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d && emacs --insecure
.
So we have even more text-editing options let's install Sublime Text 3. There are two options for doing this which I will use to illustrate some other ways of getting software installed over and above just downloading a binary.
-
Our first option (but don't do this!) is to download a
.dpkg
from the Sublime Text 3 homepage and then install it using thedpkg -i
command i.e. run thewget https://download.sublimetext.com/sublime-text_build-3126_amd64.deb && sudo dpkg -i sublime-text_build-3114_amd64.deb
command. -
Our second (and the better) option is to use the Sublime Text 3 Installer PPA. A PPA is a Personal Package Archive which is simply just an unofficial APT repository hosted by an individual on Canonical's Launchpad software collaboration service. Run the following commands to install Sublime Text 3 using the PPA.
Canonical is the company behind the Ubuntu Linux distribution.
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
Now run subl
to confirm that Sublime Text 3 is available and working OK.
If you're like me you want GitHub's Atom! If so run wget https://github.com/atom/atom/releases/download/v1.13.0/atom-amd64.deb && sudo dpkg -i atom-amd64.deb
now.
Now run atom
to confirm that Atom is available and working OK.
Note: You may instead need to run atom --disable-gpu
to get it to run in a virtual machine (depending on your host's graphics adapter).
You might use Adobe Brackets? If so here's what you do:
sudo add-apt-repository ppa:webupd8team/brackets
sudo apt-get update
sudo apt-get install brackets
Now run brackets
to confirm that Adobe Brackets is available and working OK.
Note: Brackets wouldn't load correctly for me so your mileage may vary...
You must have thought I was forgetting something by now! Here's what you do:
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vscode-amd64.deb
sudo dpkg -i vscode-amd64.deb
Now run code
to confirm that Visual Studio Code is available and working OK...
You'll see that it's not working, so let's fix that now.
Let's take stock of what we know:
-
The issue we're seeing here looks to be a GPU rendering issue.
-
We know that Visual Studio Code is an Electron application, so "under the hood" it has Node, Chromium and V8.
-
We know that Chromium (Chrome) has hardware accelerated rendering.
Hypothesis => Our issue is caused by a combination of the "VirtualBox virtual GPU" and "Chromium's hardware accelerated rendering".
Solution? Disable the hardware accelerated rendering (for now).
Fortunately someone else has the workaround for us. Run Visual Studio Code again as follows:
code --disable-gpu
Work out how to configure code
to always execute as code --disable-gpu
.
The following code may assist you in your journey:
alias code='/usr/bin/code --disable-gpu'
You'll know you have it working when you can simply run code
from any location and there are no graphical glitches.
Next work out how to "lock" the Visual Studio Code icon to the Ubuntu/Unity Launcher.
Lastly locate the file code.desktop
(created by the process of locking code
to the Launcher) and update it appropriately to include the --disable-gpu
.
You should now be able to click on the Visual Studio Code icon in order to run code
with no graphical glitches.
Good job! You are now in possession of a configured and maintainable Linux VM.
Take a 5 minute coffee break and then head over to 3. "Hello, world!" .NET Core .