Installing and Configuring PostgreSQL 9.4 on Linux Mint/Ubuntu

Posted on April 19 2015 07:41 AM by jatten in Postgres, Database, Linux, CodeProject   ||   Comments (1)


Installing and configuring PostgreSQL on a Linux box is either simple, because you are a Linux and/or Postgres expert, or not so simple, because you are new(er) to Linux, Postgres, or both. Over the past year, I have resided firmly in the latter camp. I am a huge fan of the Postgres database platform, and I have been slowly but steadily trying to improve my Linux chops.

If you are an experienced Linux user, or a PostgreSQL DBA, this is not the post for you, although your feedback and constructive criticism are most welcome – if you see something amiss, please do let m eknow in the comments, or via email.

I should note here that, where practical, I do as much as I can on Linux from the terminal. While the desktop/GUI is handy for some tasks, I am doing my level best to become proficient with the terminal in Linux. I strongly recommend doing the same. Which is how we’re going to do things here.

The installation process for Postgres on Ubuntu or Linux Mint is, like many things in the Linux world, less than intuitive for new users. As much for my own sake as anyone else’s, I’m going to walk through the steps to getting Postgres installed and configured on a Linux box.

Why Postgres?

PostgreSQL is a fantastic database platform. Postgres is open source, cross-platform, free, and offers an amazing feature set which, in my mind, exceeds those of its principle peers in the relational database space.

Postgres offers all of the (mostly) standards-compliant SQL/relational database feature you would expect, plus a host of exciting and innovative features. Highlights include a JSON datatype (and also JSONB!), an array datatype, and the new HStore type, which essentially allows the specification of a column as containing a list of key/value pairs. We’ll take a tour of PostgreSQL in another post, but first, let’s get the thing installed and running.

Installation Steps for PostgreSQL on Linux Mint or Ubuntu

At the moment, my preferred Linux distro is Linux Mint 17 (“Quiana”) with the Cinnamon desktop. This is a long-term support release of the Linux Mint distro, very stable, and an excellent place to start. If you do not have a dedicated Linux machine, it is simple enough to spin up a VM using Virtual Box

As of this writing, the most recent version of PostgreSQL is version 9.4, which brought with it some very cool features such as full JSONB support. However, the 9.4 release is not available directly using the Advanced Packaging Tool (APT) or the Linux Mint/Ubuntu Software Manager.

Fortunately, the PostgreSQL Global Development Group (PGDB) maintain an APT repository of PostgreSQL packages for Debian and Ubuntu-derived Linux distros.

Before we can install Postgres, we need to add the package source for the distro we are using. In my case, I am using Linux Mint 17, which is derived from, and compatible with, the Ubuntu 14.04 (“Trusty Tahar”) release. We’ll see why this matters in a moment.

Add the Postgres Package Source for Your Linux Release

We need to create a sources file reflecting the proper Postgres source for our particular distro. In my case, as noted above, we need the source compatible with the “Trusty” release of Ubuntu. So we can do this from the terminal to add the file (make sure you use sudo in all of the following steps):

Add the PGDB APT Source file From the Terminal:
~ $ sudo touch /etc/apt/sources.list.d/pgdg.list


Now that the file exists, open in your editor of choice (we’ll use gedit here):

Open the pgdg.list File in gedit (use sudo):
~ $ sudo gedit /etc/apt/sources.list.d/pgdg.list


then add the following line in gedit and save (where I used “trusty” below, use the name of your release for Ubuntu, or the corresponding Ubuntu release if you you are using Linux Mint):

Add the Postgres Package Repository and Specify Your Distro Release:
deb trusty-pgdg main


Save, and close gedit.

Alternately, we can achieve all of the above in one shot from the terminal like so (take note of the placement of single and double quotes here…):

Add the Package Source in one multi-line Terminal Command:
~ $ sudo sh -c \
'echo "deb trusty-pgdg main" > \


Add the Postgres Package Repository Key

Next, add the package repository key:

Add the Postgres Package Repository Key:
~ $ sudo apt-get install wget ca-certificates
~ $ wget --quiet -O - | sudo apt-key add -


Update, Upgrade, and Install Postgres

Then, we need to update our package sources:

Update Package Sources:
~ $ sudo apt-get update


Once that’s done, we need to upgrade packages to the latest versions:

Upgrade Packages:
~ $ sudo apt-get upgrade


Note, this can be a long process. Also, you may be prompted at several points to make some choices about configuration items. Specifically, you may informed that this that or the other configuration file has been changed, and asked if you want to keep your original version, or replace with the package maintainer’s version. Select “Y” to accept the package maintainer’s version in these cases.

When the upgrade process finishes, we are ready to install Postgres (we’ll also include pgadmin3):

Install Postgres:
~ $ sudo apt-get install postgresql-9.4 pgadmin3


This shouldn’t take long (especially compared to the installation times for certain other GUI – installer-based database platforms. I’m looking at you, SQL Server). Once the installation completes, we’re ready to configure our new database.

Configuring Postgres for Use

We’ve now installed both PostgreSQL and the database management utility Pg Admin 3. Next, we should understand a few things about how PostgreSQL works, out of the box.

The Postgres User

When PostgreSQL was installed, a system user account named postgres was created. with a matching user account in Postgres. By default, the postgres user account is not configured with a password, so it is not possible to log into the server using the postgres user account without first creating a password for it. This postgres account has an all-access pass on your postgres database server, permission-wise. The postgres user account is analogous to the sa account in SQL Server. For security reasons, it is recommended that a password not be created for the postgres account.

The Postgres Database

PostgresSql is installed with a default database named…wait for it… postgres. From the PostgreSQL documentation:

Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the "template1" and "postgres" databases . . .

. . . The postgres database is a default database meant for use by users, utilities and third party applications.

For the most part, we use the postgres database for admin purposes, and create new databases on the PostgreSQL server to suit our needs.

The psql Command Line Utility

PostgreSQL includes psql, a command line utility for managing your databases and server. While a GUI-based utility such as pgadmin3 is often easier to use in the day-to-day, the command line utilty psql is also handy. Psql offers complete control of your Postgres system from the terminal, including the ability to execute SQL queries.

Also, we need to use psql to perform our initial configuration, and to create an initial database super user.

Create a Super User Account

Since we will not be creating a password for the postgres user account, we need a super-user account in order to work with our database in the day-to-day.

To do this, we will gain access to the postgres account through your system root user, and then use that postgres account to create a new super-user account on your Postgres installation which can be regulated more effectively. As an example, from my own machine (comments denoted by ##):

Access the Postgres User Through Root:
## switch user to root:
xivsolutions@mint-vm ~ $ su -
## switch user to postgres:
mint-vm ~ # su - postgres
postgres@mint-vm ~ $ 


As we can see, we now have a prompt for the postgres user. We can now log in to the default postgres database and, using psql, create a super user account for ourselves:

To get into the psql command line utility, we type the following:

Enter the psql Command Line Utility:
postgres@mint-vm ~ $ psql


Now, from the psql prompt, enter the following. Note the name you specify for your super-user account should match the system user account you plan to use to manage your Postgres Installation (use your own user account name in place of youruseraccount here):

Create a New Super User from the psql Prompt:
postgres=# CREATE USER youruseraccount
postgres-# PASSWORD 'userAccountPassword';


Notice in the above we can enter multiple lines of SQL. The SQL is not executed until we enter a semi-colon followed by enter. Which means, the semi-colon matters!

Now, we can exit psql, exit the postgres user, and exit root like so:

Return to your normal user account:
postgres=# \q
postgres@mint-vm ~ $ exit
mint-vm ~ # exit
xivsolutions@mint-vm ~ $ 


With that, we should now be able to log in using psql and make sure everything is wired up correctly.

Log In Using Psql and Create a Test Database

Now, just to make sure everything is working correctly, let’s log in with psql using our new super user account and create a quick test database:

Log-In Using the New Super-User Account:
xivsolutions@mint-vm ~ $ psql postgres
psql (9.4.1)
Type "help" for help.


Note in the above, we specified the postgres default database when we logged in, since there aren’ tyet any other databases to connect to. We’ll use the default postgres as our admin platform, create a new database, and then connect to the new database to test things out.

So, let’s create a database to play with (once again, make sure to end the SQL statement with a semi-colon!):

Create a Test Database Using Psql:
postgres=# CREATE DATABASE test_db WITH OWNER xivsolutions;


Now that we have our own database to mess with, use the \connect command to switch psql to that:

Switch the Active Psql Connection to the new Test Database:
postgres=# \connect test_db;
You are now connected to database "test_db" as user "xivsolutions".


Now, let’s whip up a quick and dirty table, insert some data, and query:

Create Table, Insert Data, and Select Query Using Psql:
test_db=# CREATE TABLE products (id SERIAL PRIMARY KEY, name TEXT);
test_db=# INSERT INTO products (name) VALUES ('Brass Widgets');
test_db=# SELECT * FROM products;
 id |     name      
  1 | Brass Widgets
(1 row)


This is a quick example of what can be done from the psql command line. psql is a powerful tool, and is very much worth exploring. While GUI-based tools like PG Admin 3 and others certainly can be helpful, gaining a certain level of comfort working with Postgres from the terminal will save you time in many cases.

That said, let’s configure PG Admin 3, so we can have our cake and eat it too.

Configure PG Admin 3 for Local Connections

PG Admin 3 is a free, open source GUI database management tool for Postgres. While the GUI itself is not as polished as some, all the essentials are there. We already installed PG Admin 3 when we installed Postgres itself, so let’s take a look.

First off, open PG Admin 3from the terminal:

Open PG Admini 3:
xivsolutions@mint-17 ~ $ pgadmin3


You will probably see something like this:

The PG Admin 3 GUI After Opening:


Before we can do much of anything here, we need to add our new database server. Since we are working on our local machine, we’ll go ahead and add a local server, which points to localhost. Use File –> Add Server… to open the Server Registration Dialog, and you should see something like the following:

Register your Postgres Server with PG Admin 3:


Note the default values you see in the above may differ slightly on your machine. We’re going to provide a name by which our local server will be known, specify the host, and make sure that the User Name matches our new Super User name (which in most cases should match our system user name, although this is not a requirement).

As an example, on my machine, I set things up like so:

Enter PG Admin Server Registration Items for Local Postgres Database:


In the above note that I deselected the “Store Password” option. In general, storing of Postgres user passwords is not recommended, although you may consider your circumstances and proceed accordingly. For example, if you are setting up a local development installation on your laptop, you may choose to store the password anyway. Next, hit “OK” and voila – our existing Postgres database server is available in PG Admin 3:

Postgres Database Server Registered in PG Admin 3:


Now you can use PG Admin 3 to create new databases, tables, query, and all the other tasks you might expect. While the GUI experience is not as polished as some commercially available alternatives, you will find that PG Admin 3 is highly functional, and can handle most of your database administration needs quite well.

Postgres Configuration Options – Database Files and Directory Location

When we performed our installation and configuration above, we basically allowed Postgres to use its own sensible defaults for most things. Most of the time, if you are setting up Postgres on your own machine, for development or just to mess around, these are sufficient. However, understanding some of the basic configuration options, how and where these are set, can be most helpful.

When Apt installs Postgres, it creates a few directories by default:

/etc/postgresql/9.4/main – Primary PostgreSQL configuration files are located here. This directory is owned by root, so you will need to elevate your privileges to edit files in here. Of particular interest to us are two files:

  • pg_hba.conf – Configuration parameters for client authentication and access is specified in this file.
  • postgresql.conf – Configuration parameters for important file locations, logging, resource usage, and a host of other database configuration items are set here. For our purposes, most of the defaults will do for now. However, the file locations may be of interest, as we’ll see in a moment.

/var/lib/postgresql/9.4/main – Default location for the database cluster and associated files. Above, when we initialized our database, we were working with database files in this location.

Specify a Different Directory for the Database Cluster Files

For a variety of reasons we may wish to specify a different directory for our database files. We may want to keep them more easily accessible, or we might have set up our system with a separate partition for data files. In any case, if we want to use a location other than the default for our database cluster, we can.

The Postgres cluster directory must be owned by the postgres user, so we need to create the directory, and then assign ownership to postgres.

For our example, we’ll create a /database directory in our file system root, and within that a pg subdirectory:

Create a New Directory for Postgres Data:
$ sudo mkdir –p /database/pg
$ sudo chown -R postgres /database


In the above, the –p flag tells bash to make sure any leading directories are created on the way to the final directory. The –R flag used with chown tells chown to work recursively, and apply the ownership change to any nested directories or files.

Now we need to initialize the new database cluster in the new directory. Note, if you are already running an existing postgres instance, it is best to stop the server before moving the data directory:

Stop Existing Postgres Instance:
$ sudo service postgresql stop


Once again, we will need to get to our postgres user through root, and then initialize the new cluster (note – I’m showing the full terminal prompt here for clarity, so we can see which user privileges are used):

Initialize the New Postgres Cluster Using initdb:
xivsolutions@mint-vm / $ su -
mint-vm ~ # su - postgres
postgres@mint-vm ~ $ /usr/lib/postgresql/9.4/bin/initdb -D /database/pg
postgres@mint-vm ~ $ exit
mint-vm ~ # exit
xivsolutions@mint-vm / $


Don’t forget to exit from the postgres user, and then also exit root as shown.

Next, we need to edit the postgresql.conf file and point the data_directory variable to the new cluster location. We can open the file with elevated privileges in gedit like so:

Open the postgresql.conf File with Elevated Privileges in Gedit:
$ sudo gedit /etc/postgresql/9.4/main/postgresql.conf


Scroll down in the file to the file locations section, comment out the existing entry for data_directory (using the ‘#’ character), and add a new entry pointing to our new directory like so:

Replace the data_directory Parameter to Point at the New Directory Location:
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
# Add a '#' to the beginning of the line below:
# data_directory = '/var/lib/postgresql/9.4/main'    # use data in another directory
data_directory = '/database/pg'          
# Blah blah more configuration stuff . . . 


Save and exit Gedit, then re-start the postgres server:

Restart the Postgres Server:
$ sudo service postgresql restart

NOTE: If you forgot to stop an existing instance of Postgres before moving the data directory (or for other potential reasons), you may receive an error indicating that “the pid file is invalid, and to manually kill the stale server process.” If this happens, you can manually kill the process with the following:

Manually Kill a Stale Postgresql Server Process:
sudo pkill -u postgres


Before restarting the server, it is important to make certain all Postgres processes have, in fact, stopped. Make sure that the shell command ps returns no results when used as follows:

Ensure All Postgres Processes have been Killed:
ps -u postgres


Then go ahead and restart postgres as per previous.

You should now be running Postgres in the new location. Note that any existing database files did not move as part of this process, so you will need to follow the previous steps for creating a new super user, etc.

In upcoming posts, we’ll take a look at some of the stand-out features of this database.

Additional Resources and Items of Interest

If you are just digging in to PostgreSQL, Linux, or both, see some of these excellent resources for additional information:

Some OSS projects I’m privileged to be involved with using PostgreSQL:


Posted on April 19 2015 07:41 AM by jatten     

Comments (1)

Setting Up for Mono Development in Linux Mint/Ubuntu

Posted on October 19 2014 06:08 PM by jatten in Linux, Learning Linux, C#   ||   Comments (5)

follow-the-yerllow-mint-roadI recently needed to create a cross-platform C# library which needs to work across Windows, OSX, and Linux. Obviously, getting a .NET library running on Windows presented no great difficulties. Getting the same library working under Mono on a Linux platform was a little more involved.

The folks at Xamarin have brought Mono, and the development tools available for Mono, a long ways. Xamarin Studio is a beautiful IDE which, while it differs from Visual Studio in some important ways, is a joy to work with. Xamarin's focus is building mobile application development tools. However, Xamarin Studio and Mono both lend themselves fairly well to working with C# code on either Windows or OSX.

Image by Neil Fowler  | Some Rights Reserved

There are some notable things missing (you can't work directly with Windows Forms, for example, nor is there significant support for ASP.NET), but overall, working with strictly library code presented only minor hurdles (not the least of which is a different workflow and navigation scheme from VS).

However, Xamarin Studio is only available for Windows and OSX - there is not currently any support for direct Linux platforms (yes, I know a shiny veneer on top of what amounts to Linux under the hood).

Getting things working on my Linux machine took a little more work.

Mono Development on Linux Using MonoDevelop

Xamarin Studio represents a "Super-Set" of the original, cross-platform Mono IDE, MonoDevelop. The Xamarin team have generously pushed a good number of improvements back to the MonoDevelop source. However, the most recent changes are not directly available as packages to all Linux distros.

Specifically, while the most recent version of MonoDevelop is, the most recent package available to Ubuntu, and Ubuntu-based systems from the MonoDevelop site is version

In this article, we will look at how to get a proper Mono development environment set up on Ubuntu-based systems, including the most recent (as of this writing) release of MonoDevelop. We will also look at getting Nuget, and Nuget package restore, working properly in this environment.

Got Linux?

If you don't have a Linux box, set up a VM to work through this post. I prefer using Linux Mint for my Linux-based activity. I found that all of the following steps worked fine in the most recent version of Ubuntu. However, I DON'T like Ubuntu itself. I prefer Linux mint. The last version of Mint I was using (Mint 13 with the KDE desktop) did not work very well with the most recent version of MonoDevelop. I found the the most recent stable release of Mint 17, using the Cinnamon desktop, worked great, with none of the bloat I found with Ubuntu.

See the following for detailed instructions if you need to set up a Linux VM:

For the purpose of this post, we will assume you are starting with a reasonably fresh VM, and do not already have Mono or MonoDevelop Installed.

As mentioned previously, the links on the MonoDevelop download site don't get you the most recent Mono release for Ubuntu-based systems. Fortunately, there are some great Personal Package Archives out there which DO.

Install Mono

Your machine may or may not already have Mono installed. Either way, we are going to pull down the most recent, complete version.

Open a terminal in your home folder, and do the following:

Update Everything:
$ sudo apt-get update


Install Mono:
$ sudo apt-get install mono-complete

Once the Mono Installation completes, update again before moving forward:

Update Everything Again:
$ sudo apt-get update


The most recent Mono release is now installed on your machine. Now, let's get all the goodness of the most recent MonoDevelop release.

Add the Personal Package Archive (PPA) for Latest Stable MonoDevelop Release

To get the most recent stable release of MonoDevelop, we can thank Eberhard Beilharz for making the Stable Version of MonoDevelop PPA at Launchpad.Net.

To get the most recent version of MonoDevelop on our machine, we simply need to add the PPA to our Synaptic Package Manager's list of sources, and then use synaptic to pull it down.

Add the MonoDevelop PPA to Synaptic:
$ sudo add-apt-repository ppa:ermshiperete/monodevelop


Update to refresh Synaptic:

Update Everything Yet Again:
$ sudo apt-get update


Install MonoDevelop

Now that we have added the PPA, we can use Synaptic just like any other package:

Install MonoDevelop from PPA:
$ sudo apt-get install monodevelop-current


Again, update everything:

Update Everything One More Time:
$ sudo apt-get update


Now, as indicated on the MonoDevelop PPA site, the install we just completed placed a shell script at /opt/monodevelop/bin/

Let's add an alias for this, so that we don't have to deal with that big long path every time we want to open MonoDevelop.

If this is a fresh install of Mint 17 on your machine, you will need to add a .bashrc file. If you already have a .bashrc file (or a .bash_profile file - in Mint they are functionally the same), add one:

Add a .bashrc File in your Home Directory:
$ touch .bashrc


Next, add an alias to .bashrc pointing to and executing the shell script:

Add Alias to Execute MonoDevelop-Launcher Script:
$ echo >> .bashrc "alias monodev=Exec=\"sh /opt/monodevelop/bin/\""


Close the terminal, and open a new terminal instance. You should now be able to open MonoDevelop from the terminal by typing, simply "monodev"

With that, we have successfully installed the most recent release of MonoDevelop on our Mint 17 or Ubuntu machine. However, we are likely to find that Nuget, and Nuget package restore, give us difficulties in this out-of-the box scenario.

Making Nuget Package Restore Work in MonoDevelop

Out-of-the-box, Nuget works a little differently in MonoDevelop than we are accustomed to in Visual Studio (this is true of much about MonoDevelop, actually…).

To see what I mean, use your new terminal alias and open MonoDevelop. Then, create a new Console project. Once that's done, take a moment to get oriented.

We can add Nuget packages by right-clicking on individual projects within the solution in the tree to the left:

Add Nuget Packages in MonoDevelop:


However, if we try to add Nuget packages right now, we get a big FAIL:

Add Nuget Packages Fails in MonoDevelop:



What's equally confounding is that, if we were to open and build an existing project which required Nuget Package Restore, the Package Manager would is not always able to connect to Nuget to pull down the packages, and an error would result.

This doesn't affect all packages, but enough to be annoying. In particular, several NUnit-related packages and a few others, appear to be affected, and your project can't be properly built.

As it turns out, we are missing some important SSL certificates. The fix is simple, and we can do it from our terminal.

Add Required SSL Certificates for Nuget to Work in MonoDevelop

Since we are using our current terminal instance to run MonoDevelop, we will either need to quit MonoDevelop, or open a new terminal instance, and then execute the following to import a number of important SSL certificates:

Import SSL Certificates from mozroots:
$ mozroots --import --sync


Once we have run this command, we should be able to add Nuget packages at will. Also, Update Packages, and Restore Packages commands from the Solution context menu both should work with no problems.

Additional Resources and Items of Interest


Posted on October 19 2014 06:08 PM by jatten     

Comments (5)

Setting Up Linux in a Virtual Machine for Windows Users

Posted on October 19 2014 10:04 AM by jatten in Linux, Learning Linux   ||   Comments (0)

photozel-linux-mint-18142If you have spent most of your computing life using Windows, odds are good you may find yourself in unfamiliar territory when if comes to setting up a Linux box. Even for some experienced technical folks, the differences between the platforms can have you feeling like a noob from the very start.

Setting Linux up in a virtual machine can save some time and pain, but comes with the added overhead of understanding how the particular virtualization software works.

In this post, we will look at setting up a basic Linux environment in a virtual machine, and look at some of the trouble-shooting you may need to do along the way.

Image by Photozel  |  Some Rights Reserved

Note, I am not a Linux expert. I have been learning my way through Linux for most of the past year or so, but there is a lot to learn. I find I really, really enjoy using Linux, and once I got past the initial learning curve, things began to make sense rather quickly.

Learn Linux the Hard Way

Most of the recommended introductory Linux distributions ("distro's") feature a GUI to varying degrees. It is possible to do much of what you set out to do without cracking open a terminal. However, when I started down the golden Linux path, a determined to use the terminal wherever possible, and patiently become proficient with this OS in the terms under which, ultimately, it was designed to be used.

I strongly recommend you do the same. Not only will you gain a deeper, better understanding of Unix-based systems, but of how your machine works in general. Unlike the Windows world in which I grew up, Linux/Unix is first and foremost a command-line driven platform, and is optimized as such. In fact, it's fair to say that, unlike Windows, in *nix OS's, anything you can do from the GUI, you can also do from the terminal, usually more efficiently (once you know how, and depending on your typing proficiency).

If you are stuck on how to do something from the terminal, Google is you friend. If your are still stuck, you can probably do it from the GUI until you find an answer. As I said, though, I strongly recommend using the terminal for everything you can. It will feel incredibly clumsy at first, but like all things, the more you do, the better you get.

The article linked below was focused on getting to know Git for folks with a Windows background, but there are a number of handy bash references you may find helpful:

Virtualization Software

Before we can set up a virtual machine, we need some virtualization software. I tend towards the free and open source VirtualBox solution. Despite lacking some of the polish associated with VMWare, I find that VirtualBox meets my needs nicely.

In this article we will be using VirtualBox as our virtualization environment.

Download and Install the appropriate VirtualBox package for your PC from the VirtualBox Downloads page.

Linux Mint

While Ubuntu is the most popular "beginner" Linux distro, I prefer Linux Mint. Newer releases of Ubuntu seem slow and bloated to me, and oriented more directly at desktop users, with many of the more advanced tools well hidden. Also note that Linux Mint is derived from Ubuntu.

Mint seems to more effectively consider both desktop/GUI users, as well as more technical folk. While the full desktop GUI is available (and well-done, compared to some), the terminal is a short context menu away.

At the time of this writing, Linux Mint 17 is the most recent stable release, and is targeted for long-term support.

Downloading the Linux Mint ISO

Linux Mint is available with a number of different desktop options. Until recently, I have been using Mint with the KDE desktop, but have just switched to the newer Cinnamon desktop to check it out. Also, I had issues getting MonoDevelop working in the KDE implementation.

You can download the stable Linux Mint release with the Cinnamon desktop from one of the mirrors on this page:

Once you have downloaded the Linux Mint ISO, save the file somewhere safe. You will need this shortly.

Configure a new Virtual Machine in VirtualBox

Once you have installed VirtualBox on your PC, select the "New" button from the top menu. You should be greeted with the Create Virtual Machine window like so:

VirtualBox Configuration - The Create Virtual Machine Window


Choose a unique and descriptive name for the VM you intend to create. I tend to follow a convention of OS-RAM-HDD specs, but how you do it may depend on what you plan to do with the VM.

Next choose the type (Linux), and the version. In this case, Linux Mint is not one of the options. However, Mint is a descendant of Ubuntu, so Ubuntu will work here.

Allocating Resources to the Virtual Machine

Once you click next, you will be asked to select how much RAM your virtual machine will have. Note that your VM will be sharing RAM with your physical host machine. VirtualBox will offer up a "recommended" amount of RAM to allocate. However, I tend to push this up, as I have physical RAM in abundance on my PC. You can see here I selected 4Gb of RAM, which is likely more than I will ever need.

Allocate RAM to the Virtual Machine:


Clicking next again, you will be asked if you want to create a virtual hard drive. The default (VDI) is the best bet here. You will also be asked if you want this to be fixed size, or dynamically allocated. I generally go with dynamically allocated.

Once you select these parameters, you will have the opportunity to specify the "size"  and location of the disk to be created. The recommended size if 8Gb. I generally bump this up to 20Gb, which is probably overkill. However, you will want to consider your intended use for the VM, and allocate disk space accordingly. If you plan to be working with lots of images or video, for example, you will want more disk space than if you plan to simply play with the terminal and familiarize yourself with Linux.

Allocate Disk Space to the Virtual Machine:


Once we hit the Create button, we are returned to the VirtualBox Management window. However, we are not done preparing our VM.

Other VM Settings

Now that we are back in the VirtualBox Management window, we can adjust the various settings for individual VM's by clicking on the appropriate heading to the right.

We want to change a few of the default settings here before we proceed.

Enable 3D Video Acceleration

If we click on the "Display" heading, we are greeted with the Display settings window. Here, we may want to increase the amount of Video RAM available to our VM. I generally push this up to 32 Mb.

Also, in order to get acceptable graphics performance, we will enable 3D acceleration.

Adjust Display Settings:


Share Folder(s) Between the VM and Physical Host

We may want to share files between our host machine (our physical PC) and our VM. We can do this by specifying a folder on the host to be shared. I generally have a dedicated folder named "VM Share" that I use for this.

To set up a folder to be shared between the host and your VM(s), select the "Shared Folders" header in the settings window. Then, click the folder icon (top right) to select/create a folder to share.


For our purposes, the other settings for network, USB, and such are generally good with the default settings.

Start the VM and Install Linux Mint

The first time you start your VM, you will be prompted to select a startup disk. At this point, navigate to the Linux Mint ISO you downloaded previously. Click on the folder icon to the right of the drop-down list to navigate your file system.

Select Startup Disk:


The system will boot into the Linux Mint OS on the ISO. When Mint is done loading, note the CD icon on the Mint desktop:

Mint Desktop when Booted from ISO:


Double click the CD icon, and follow the installation instructions to install Linux Mint on your VM.

NOTE: Linux will only accept lower-case user names, but the password you enter during set-up is case-sensitive.

If you enter a mixed-case username, it will be down-cased when it is saved.

When the installation completes, you will be asked to re-start the VM. Do this. If your VM hangs during the shutdown process (mine did), Simply close the VM window. When you are prompted to indicate how you want the machine to shut down, select the simple "Power Down the Machine" option.

Now, start the machine again using the "Start" icon in the VirtualBox Manager window. As soon as the window comes up, go to the "Devices" menu, eject the Mint Installation ISO:

Startup and Eject the Mint Installation ISO:


If everything has worked properly to this point, you should be greeted with a login screen to log in to Linux Mint.

Enter the user name and password you specified during installation (remember, your username will be all lower-case), and you should be off and running.

Additional Resources and Items of Interest


Posted on October 19 2014 10:04 AM by jatten     

Comments (0)

About the author

My name is John Atten, and my "handle" on many of my online accounts is xivSolutions. I am Fascinated by all things technology and software development. I work mostly with C#, JavaScript/Node, and databases of many flavors. Actively learning always. I dig web development. I am always looking for new information, and value your feedback (especially where I got something wrong!). You can email me at:

johnatten at typecastexception dot com

Web Hosting by