Skip to content

Step by step Ubuntu installation guide

franke-hub edited this page Apr 6, 2021 · 10 revisions

This is a step-by-step complete project installation guide on an Ubuntu 18.04 virtual machine, including almost everything. The inherent assumption here is that you basically know how to install and operate programs. Also, you have 64-bit hardware. (32 bit worked and probably still works. It's just not being tested anymore.)

Prerequisites

Virtual Machine Driver

I use Oracle's VirtualBox, downloadable from https://www.virtualbox.org/wiki/Downloads

Since my primary machine is Windows based, I use the "Windows Host" version. For whichever version you choose, you will also need the "Virtual Box Extension Kit", available on the same page. This is the same download page you'll use for updates.

Install the virtual box before the extension kit. Install the extension kit after VirtualBox itself.

Virtual Machine setup

Start the VirtualBox application. Use Machine/new to create the Ubuntu Virtual Machine.

  • Name: Ubuntu (or whatever else you like)

  • Machine Folder: (defaulted)

  • Type: Linux

  • Version: Ubuntu (64-bit)

  • Memory size: 4MB (Less, if you're tight on memory)

  • Create a virtual hard disk now

  • VDI (VirtualBox disk image)

    • This works well enough and reduces the actual disk image size
  • SELECT: Dynamically allocated

  • Size: 32 GB

    • SELECT: Create

Update these Machine/settings to configure your machine:

  • General/Basic

    • Name: Ubuntu, or your choice
    • Type: Linux
    • Version: Ubuntu (64-bit)
  • System/Motherboard

    • Base memory: 4096 MB
    • Boot order: Hard Disk, Optical
  • System/Processor

    • Processors: 4
    • Execution cap: 100%
    • Extended features: UNchecked
  • System/Acceleration (Defaulted)

    • Paravirtualization Interface: Default
    • Hardware Virtualization: CHECK Enable Nested Paging
  • Display/Screen

    • Video Memory: 32 MB
    • Monitor count: 1
    • (Defaults for all other Display settings)
      • Graphics Controller: VMSVGA
  • Storage (set during machine creation)

  • Audio (use defaults)

  • Network/Adapter1

    • CHECK Enable Network Adapter
    • Attached to: Bridged Adapter
    • (All else defaulted)
  • Serial Ports (Defaulted, NONE)

  • USB (You can leave this defaulted)

    • CHECK USB 3.0 (xHCI) Controller
  • Shared Folders (Defaulted, NONE)

  • User Interface (Defaulted)

Ubuntu installation

Download the ISO installation image from: https://ubuntu.com/download/desktop

Use the latest LTS (Long Term Support) image. Currently this is version 18.04.4, but I've already downloaded the 18.04.2 image and am going to use that. This shouldn't matter much, but be aware. In any case, Ubuntu could release 18.04.5 tomorrow and it would be impossible to keep all the documentation 100% up to date.

This is a 1.9G download to "ubuntu-18.04.2-desktop-amd64.iso". Keep it in a safe place in case you need to use it again.

Load the ISO image onto your virtual DVD player.

  • From the VirtualBox manager, select Settings/Storage.
  • Click on the blue CD icon on the right side of the screen, to the right of "IDE Secondary Master" selector.
    • Select "Choose a Disk File"
    • Select "ubuntu-18.04.2-desktop-amd64.iso", locating it if necessary.
  • Close the Settings window. You're ready to begin installation.
  • Click "Start" to start the virtual machine. It should boot from the installation disk.
  • When the Welcome screen appears, select "Install Ubuntu"
  • Select keyboard layout (I use the default English(US)) and click continue.
  • The defaults are good enough for "Updates and other software". Click continue.
  • The default installation type, Erase disk and install Ubuntu, is OK. Click Install Now.
  • Write the changes to disks? Select Continue.
  • Select your time zone, then Continue.
  • Type in the information requested. I use the same username and password for all my virtual machines, and pick a better computer name than the default. Let's call this one Ubuntu, then click Continue.
  • Be advised: installation takes a while and you're now free to do other things in the meantime.
    • As you may have already surmised by now, I adding these instructions to the Wiki while performing the actions. We have gotten to the "Installation Complete" panel quicker than I expected. Click "Restart Now".
  • For me, the installation media has been automatically removed, so I just pressed enter.
    • If not, select Devices/Optical Drives/Remove disk from optical drive.
  • Click your name and enter your password.
  • First time initialization, click next
    • Set up livepatch? No, just click next. (Setting up livepatch requires additional steps.)
    • Help improve Ubuntu? Make a choice and click next.
    • You're ready to go! Click Done.
  • Install the updates? Sure. It's a good idea to keep all your software current.
    • Apparently, this runs in the background, and slows down the machine considerably. The bottom icon (Circle-A) can be used open the updater to see what it's doing. Eventually it comes up with a Restart Now/Later selector. I usually pick Now rather than later.
  • Let's install the VirtualBox additions. (Including a little error recovery scenario)
    • Click on Devices/Insert Guest additions CD Image. You may need to right-click on the VBox_GAs_ CD icon, select Open, and on the new panel select Run.
    • "Would you like to run it?" screen, select Run. FAILED: need packages gcc, make and perl.
      • Click the 9 dot search bar on the bottom left of the screen. Select XTerm, then install it and launch it.
      • In this window, type "sudo apt install gcc make perl"
    • Retry: Right click on the VBox_GAs icon, select open, and on the new screen select Run. Much better.
    • Reboot: Select the power icon on the top right, select the power icon in the resultant menu, select restart. After the reboot, when you select the square fullscreen icon in the top right you should wind up with a full screen window.
  • That's enough for today, except that we're going to create a VirtualBox checkpoint. These checkpoints save the entire state of the virtual machine and can be quite useful.
    • Log in as usual. Right click on the VBox_GAs icon and click eject, virtually removing the guest additions CD.
    • Click Machine, APCI shutdown. This is like clicking on your power button.
    • From the VirtualBox Manager, click the TAKE camera icon (to create a snapshot.)
    • Name your snapshot. For this, we'll use "installation complete". Mostly I use the date as a snapshot name.
      • Verify that the Current State is the same as the snapshot by moving your cursor away from and back to the current state entry. If not, click on Current State and take yet another snapshot. (VirtualBox is not 100% glitch-free.)
    • When you want to resume, just select Current State and then the green Start arrow.

Since you now know how to operate a virtual machine, these startup/boot instructions will not be repeated. The steps needed to complete the installation will be done from an xterm window. You can always use VirtualBox snapshots to recover if you make some sort of build mistake. It's probably a good idea to play around with VirtualBox a little to get an idea of what it is and what it can do, if you don't already know.

Project installation

Before we actually begin, I think I need to "play around" with git to see how to define an installation checkpoint. This will allow this document to be followed along with project code changes needed to make it work better. Now that that's (sort of) done, we'll continue, ignoring the automatic update procedure, documenting only what you need to do. It's up to you to decide if, and when you want to checkpoint your virtual machine image. I tend to go overboard with this, taking a lot of checkpoints that I later merge.

For purposes of exposition and to make describing it easier, we're going to install this Project exactly as I would (if I wasn't able use a read-only NFS mount point.) Everything is done from an xterm console, assuming the user name "userid".

cd /home
sudo mkdir data
sudo chown userid:userid data 
cd data

## Clone the project
sudo apt install git 
git clone [https://github.com/franke-hub/Project](https://github.com/franke-hub/Project)
## The project is downloaded into ./Project, but we're going to use ./home
mv Project home
## The /home/data/home/.configure script doesn't do anything useful. Maybe later it will.

## Bringup option 1: Apply work-arounds as you go, the same as specified here
git checkout tags/0.0.0 ## (Synchronize with this version)

## Bringup option 2: Bringup with fixes. (When available)
git checkout HOTFIX/0.0.1 ## (Synchronize with fixed version)

## Create the base environment
cd ## (To your home directory)
mkdir bin
mkdir obj; mkdir obj/.git
ln -s /home/data .
ln -s /home/data/home/bat .
ln -s /home/data/home/src .
ln -s /home/data/home/usr .

## There are a lot of broken links into /home/data/home/usr, which is now also ~/usr/.
cat usr/.README ## Explains why

## This step sets up the home environment for MY personal preferences. Tailor to your own liking instead.
cd bat/.home
. .bash_aliases ## Personal preferences, but this document now assumes you're using them
copy .bash* .exrc .gitconfig .profile .Xresources ~/.
## (overwrite)
sudo touch /etc/RO
sudo chmod a-w /etc/RO
## ~/.bash_history now doesn't save anything. Another personal preference.
## To follow along however, you'll need at least:
##    .:~/bin:~/bat in your PATH environment variable. I've only tested when these are the first three.
##    To have invoked "source ~/bat/bash_common"
## I'm going to warn you (twice) when I use commands or aliases.
## But, for "move", I'm only going to tell you that it's not a mistake.
## (My usage of scripts and aliases is sometimes too ingrained for me to notice when I use them.)

## We're now ready to dive in with the new environment. Logout and login.
## Your xterm terminal is (should now be) a white background and black foreground
rexterm -cs partner  ## Green background xterm (~/bat/rexterm is named for remote xterm)
rexterm -cs linux    ## Blue background xterm
## You might want to look at the ~/bat scripts that might interest you.
## Recommended: bash_common, ftool, rgrep, and rexterm. You might want to tweak the "f.*" scripts.

## Let's populate the ~/obj subdirectory
cd ~/src/obj
.README restore ## FAILS w/o HOTFIX/0.0.1 
## HOTFIX/0.0.1 >>>>>>>>
cd ~/obj/.git
touch FETCH_HEAD
mkdir refs; mkdir refs/head; mkdir refs/tags
cd ~/obj
git reset --hard HEAD
dir
## You should now see directories: asm, c, cpp, .git, java, lily, make, mcs, and py and file .gitignore
## HOTFIX/0.0.1 <<<<<<<<

## Build preparation. The resultant makeproj automatically builds dependencies from source files.
sudo apt install autoconf automake binutils gcc g++ gdb libtool make patch
cd ~/obj/cpp/Tools/Makeproj
## HOTFIX/0.0.1 >>>>>>>> (Should fix this if you've done the "~/src/obj: .README restore" step)
ln -s S/Makeproj.cpp .
ln -s S/Makeproj.h . 
## HOTFIX/0.0.1 <<<<<<<< (
make
strip
move makeproj ~/bin/. 

## Build the (empty) C library
## ~/obj/c/lib/jpeg is unused, and removed in HOTFIX/0.0.1
cd ~/obj/c/lib
make 

## Build the C++ library
sudo apt install libboost-all-dev libbz2-dev libncurses5-dev libx11-dev zlib1g-dev
sudo apt install openssl libssl-dev
sudo apt install libxcb-image0-dev libxcb-xfixes0-dev 
## HOTFIX/0.0.1 >>>>>>>> (Updates ~/src/cpp/lib/pub/Include.cpp instead)
touch ~/src/cpp/inc/pub/SNC8.h
## SNC8.h is locally compile tested, but not ready for release and .gitignore-d.
## HOTFIX/0.0.1 <<<<<<<<

qd lib ## (or cd ~/obj/cpp/lib)
## qd is quick directory, found in ~/bat/f.nickdir, included from ~/bat/bash_common via ~/.bashrc
## If you've followed the build instructions, you've done everything needed to:
make
## Which creates a set of libraries. There are additional prereqs for some samples.
## I have a build how-to file which lists them, but won't test compile everything.
## But we will test part of the latest and greatest of my libraries

## Testing one of the libraries, pub. All libraries have a similar test structure.
## (You are still in ~/obj/cpp/lib, in which "S" is a link to ~/src/cpp/lib.)
cd pub/Test
dir ## "ls -alF" if for some reason your environment is incomplete.
## Here's where these (indirect) links lead: (based on ~ equivalent to /home/data/home)
##   H -> ~/src/cpp/inc ## The include library
##   L -> ~/obj/cpp/lib ## Where you just built the libraries
##   M -> ~/src/cpp/ctl/BSD ## The Makefile controls
##   Makefile -> (obvious)  ## The standard Makefile
##   S -> ~/src/cpp/lib/pub/Test ## The source directory
##   utf8.sh -> (obvious) ## A script maintained as source
## Why isn't doit maintained as source? These things happen.
## Let the testing begin!
make ## (Only compiles a test we're not interested in)
make all
## HOTFIX/0.0.1 >>>>>>>> (Updates .gitignore to include the UNTESTED file)
touch ~/src/cpp/inc/pub/memory.h ## It doesn't need content
## HOTFIX/0.0.1 <<<<<<<<
make all

Enviro ## Uninteresting.
Quick --all (--debug=4) ## Tests that graduated from Dirty. Note "--all" doesn't really mean all. (See --help)
Test_bug ## Tests ../S/Debug.cpp ## "debug.out" is the trace file in question. 
TestDisp ## Tests ../S/Dispatch.cpp and Worker.cpp ## The reason I'm working hard to get this ready.
## Interfaces defined in ~/src/cpp/inc/pub/Dispatch* and Worker.h
## Runs slowly virtualized. My current bare metal results for "TestDisp --time" are in S/.TIMING
## See ~/src/cpp/Brian/. for the current migration of ~/src/cpp/Wilbur/., which uses similar interfaces
##     found in ~/src/cpp/inc/com/Dispatch* 
TestLink ## Tests ../S/LinkedList and associated interface definitions.
## TestDisp relies on its AU_List functionality, vastly improved over the com library.
TestMisc ## Tests miscellaneous functionality. Maybe TestMisc an Quick should be combined.
TestPerf ## Is for machine to machine comparison.
## For me: VirtualBox on Windows: 12-13M/sec; Windows: 17-18M/sec; Linux: 33-30M/sec (doubles slower)
Test_Thr ## Tests threading, lightly stressing.

make clean ## Does some cleanup
make pristine ## Does all cleanup, usually. Some source Makefiles forget locally unique items. 

This (almost) concludes the bringup section, which builds and tests the C++ libraries, which I view as the most important and are needed to run and test the program packages in ~/src/cpp/. All the source libraries are similarly structured. Sources are designed to reside on a read-only filesystem, compiled and run from the associated (local) filesystem at ~/obj/.

For the additional prerequisites, the documentation I use to bring up new virtual machines is included. All the prerequisites are included (after HOTFIX/0.0.1) in ~/src/log/howto/howto.installLinux.log. There's more than you need in there. You do need to know the IP addresses your internet provider supplies for name servers, and I changed the name of my linux machine that hosts /home/data on a read-only filesystem that virtual machines use. I use static IP addresses for all linux machines of interest to linux hosts. I also included the (slightly modified) .BACKUP.sh script I use to synchronize my /home/data information between machines. /home/data/home is now safely backed up in one way or another on multiple external sites (and every year or so /home/data is copied to a DVD or two and put in a safety deposit box.)

HOTFIX/0.0.1 has been pushed and synchronized with the maint and master branches. It's accuracy and completeness has not been verified.