How to setup an Ubuntu Linux VM For Udacity NanoDegree

These are the items to setup a Linux virtualbox machine using Linux Ubuntu to practice you projects and create your projects. This will help you if you have a windows computer and you don't have to buy a new Macbook OS computer. Best of all, its free!

  1. Virtual Box - First thing you will need a virtual box, you can download at https://www.virtualbox.org - very easy to install
  2. Linux Ubuntu - Download the latest version of ubuntu ISO file at https://ubuntu.com/ [My current version is 20]
  3. Create a Virtual Machine in VirtualBox
  4. Install VirtualBox Additions [Optional]
  5. On the new machine, go to settings > Storage and attached the ISO file you downloaded from ubuntu. This will allow the virtual machine to boot from your ISO file. Then start the virtual machine and follow the installation prompts, its very easy, just follow the instructions. When you get to the prompt to install the minimal or regular version, I suggest you install the regular version which includes some useful tools like openoffice and browsers.
  6. By now you should have a brand new clean install of Ubuntu in your virtual Machine. The following you software, apps and utilities you will need to install:

Important: I am putting this here for beginners to clear confusion. Do not enter the $ in the command, the dollar sign is not part of the command, therefore, omit it from the commands below, this is only used to reference a linux command.

Install Python3:

To install python version 3 open a terminal and execute this command:

$ sudo apt-get update

$ sudo apt-get install python3

After the installation is completed, validate you have it installed with this command:

$ python3 --version

Install pip

$ sudo apt install python3-pip

After pip completes installation, validate you have it installed with this commnad:

$ pip3 --version

Install PostgreSQL

To install PostgreSQL, as well as the necessary server software, run the following command:

$ sudo apt-get install postgresql postgresql-contrib

* If you need help installing postgresql, here a nice tutorial with more details
Follow these steps: https://www.godaddy.com/garage/how-to-install-postgresql-on-ubuntu-14-04/

Install pgAdmin

UPDATE: follow these instructions to install:

  • https://wiki.postgresql.org/wiki/Apt
  • https://www.youtube.com/watch?v=GQ9qp1o-Ohs

To install pgAdmin in ubuntu, I did not have to send a command. You can install it by going into the Ubuntu Software Application and searching for pgadmin. This person create a nice video showing you on to install and configure postgresql with pgAdmin and it shows how to install pgadmin with ubuntu software.
https://www.youtube.com/watch?v=-LwI4HMR_Eg

Install psycopg2

$ sudo apt-get install python3-psycopg2

The commands in the instructions by Udacity did not work well with me, so I used these commands to do certain functions like:

To create database :
$ sudo -u postgres createdb udacity

DELETE REMOVE OR DROP a Database
$ sudo -u postgres dropdb todoapp

TO LOGIN:
$ sudo su - postgres
# psql

These are the psql commands I used the most during their videos:

LIST DATABASES
\l


show all the tables
\dt


VIEW SCHEME:
\d table1

CONNECT TO ANOTHER DB
\c <dbName>

QUIT
\q

Install Visual Studio Code

To install VS Code, is simple as installing pgAdmin, just go to the Ubuntu Software application and seach for vs code and click the install button

Install Flask

$ sudo pip3 install flask

Install Flask-Migrate 

$ sudo pip3 install Flask-Migrate

Install flask-sqlalchemy

$ sudo pip3 install flask-sqlalchemy

This setup worked for me, I followed along the code with the instructor and my scripts worked.