How to create a virtual machine using Virtualbox

In this post, I’ll be telling you how to create and use a virtual machine using Virtualbox. Virtualbox is a free service that allows you to have as many virtual machines as your hard drive can have. A virtual machine allows you to emulate another operating system without changing anything on your personal drive. When you create a virtual machine, the service allocates hard drive storage to a file stored in your computer. Enough about logistics, let’s create one our selves.

 

  1. Go to https://www.virtualbox.org/wiki/Downloads and select the latest version under your platform (i.e. Windows, Mac, Linux distrobutions)
  2. Download and install Virtualbox
  3. Once you have installed Virtualbox and started it up it should look something like this: Your machine list will be empty. I have some because I am experimenting and working on a project using a Linux kernel called Fedora. This is not important.
  4. To create a machine, click on the New button in the top left
  5. You will get a screen that looks like this: 
  6. Depending on what your project requires, this step will be different. We’re going to make a machine based on the OS I mentioned earlier which is Fedora.
  7. You can do this two ways. The easiest is typing the OS name in the dialog box and it will auto-select for you.
  8. When you click Next, you will get a screen like the image below. This asks you to define the amount of RAM to give this machine. Usually the recommended amount is plenty. Click Next to go to the next page.
  9. This screen asks if you want to create a virtual hard disk. If you are wanting to store things on the machine, you will want to select create virtual hard disk now. This will create a file in your computer that will hold all of the things you put in into it. As the name states, it’s like your hard drive in your personal computer or phone.
  10. If you chose to create a virtual hard disk, it will present a screen like the one below. The way I decide to create my virtual machines is using a live virtual disk image. A live disk image is an image that includes every operating file that an operating system needs to run including operating system, and in our case, hard drive storage. http://www.osboxes.org/virtualbox-images/ This link is where I got a fully functional version of Fedora. The reason I say fully functioning is that some distributors will only give you the live media version of the OS which means that you would have to install the full version to the hard drive and firmware. This link will give you a fully installed version of Fedora. Just scroll down to Fedora, download and unzip the image to a folder you want and hold of on it for right now.
  11. The next screen you will get when you continue in the virtual machine setup is one asking whether the file size of the virtual hard disk should be fixed or grow as used. if you are looking to save space on your hard drive, choose fixed size. This make the virtual hard disk seem like a natural hard drive where it has a fixed size that you must stick to. This also may take longer to create but it is often faster to use. If you’re not worried about it, choose dynamically allocated. This will grow the file as it’s used but this uses your physical hard drive space so be careful with this option.
  12. Now we will choose how big the virtual hard drive is. If you recall a few steps ago, it told us that the recommended size for the hard disk for Fedora is 8 GB. Depending on your goals and physical hard drive’s current storage available, 8 GB should be plenty. If not, you can add more here.

Depending on what you chose in the last step, this will tell how big your virtual hard drive is and how big the stored virtual machine file is on your physical hard drive.

13. The final piece to this is getting the virtual hard disk file we downloaded earlier into the machine and making it work. The image below shows how we’re going to do that. 

With the machine we just created selected, go into the Settings tab at the top left.

14. In the Settings, select the storage settings on the sidebar. You’ll get a screen like the one below.

15. In the SATA controller slot where says fedora.vdi or whatever the name of your machine is, click on that and go over to the right side where there are other options. On the image below, you will see that it says Fedora 25.vdi. This is the disk image file we downloaded earlier. Yours will need to be replaced with the file we downloaded earlier. To do this, click on the part that says fedora.vdi or what ever you named it and go over to the right side and click on the blue icon next to the dialog box. Choose the option that says Fedora 25 (64bit).vdi.

This will replace your original VDI file with a fully built and functioning Fedora Linux kernel.

16. To start it up, double click on the machine name in the machine list. Upon startup, you will get a menu with two options and possibly more if you update the kernel every so often. When this screen is presented, always choose the first option because it is the one that you will want to use. After waiting for the system to load, you will get a login screen like the one below. The password for logging into the system is osboxes.org. You can change along with the username in the settings later. If you plan on using the Terminal for a project in the future, the password for using the root user or running a command with the word “sudo” is the same as the login password. Note: Terminal will not be covered in this tutorial.

Congratulations! You can now use this virtual machine for basically what ever you want! If you want to learn more about other operating systems and their uses in VirtualBox, search around Google for tutorials on how to acquire the VDI file and install it into VirtualBox. If you do try this, be very cautious of what you download! Only follow a tutorial if the website it is on is credible and follow all directions in the tutorial to make sure you don’t ruin your system. Have fun with virtual machines and expanding your knowledge of computers!

How to add data to a database, via SQL

Do you have a database and need some information integrated into it (steps 6+), or do you just want a database all to yourself (steps All)?

  1. download PHPMyadmin
  2. Open PHPMyadmin.                             
  3. open the SQL command prompt on the page.
  4. Create a database
    CREATE DATABASE databasename;
  5. Open the command panel for your database
  6. Enter:
    CREATE TABLE table_name(
    column1 INT,
    column2 TEXT,
    column3 VARCHAR(255),
    .....
    columnN DATE,
    PRIMARY KEY( one or more columns )
    );
  7. You have entered a table where you can add data to a database
  8. Now enter:
    INSERT INTO table_name( column1, column2....columnN)
    VALUES ( value1, value2....valueN);
  9. Congratulations, you have entered data directly into a database