Click Technology Limited

Linux, Windows, Macs – it's all good!

How to create and mount shared folders in VirtualBox

February2

On your workstation host, open VirtualBox.  Select the host you want to set up shared folders on, right click and click ‘Settings’.

3

In the Settings panel (shown above), click ‘Shared Folders’ in the left pane.

Click ‘Machine Folders’ in the right pane and then the new path folder icon on the extreme right hand side.

4

Add a folder path.  This location is on the host workstation and will be made available to the virtual machine, for example…

Folder Path : /home/username/VirtualBox/shared_folders/linux_mint
Folder Name : linux_mint

Click OK.  Now start the client OS.

Install VBox Addidtions

Install VBox Additions by now switching to the VM you have just started.

1

In the window of this device, click on the Devices menu, Insert Guest Additions CD Image.  That mounts the Additions CD.

2

Now open a terminal prompt.  Switch directories to the CD.  It’s auto-mounted at

/media/username/VBOXADDITIONS_4.3.18_96516

or similar, depending on revision / edition etc.  so cd into it thus..

cd /media/username/VBOXADDITIONS_4.3.18_96516

Now run the command below..

sudo ./VBoxLinuxAdditions.run

It’s installed.

Now, switch back to the host workstation. Open a command line and type the following…

sudo mkdir -p /mnt/hostOS
sudo mount -t vboxsf linux_mint /mnt/hostOS/

Finished.

 

posted under Linux Tips | No Comments »

Output a MySQL result set to a .csv file

October15

This is quite sweet. You need to get some table data straight out to a CSV for manipulating in OpenOffice Calc, or similar products. But how?

Connect to your SQL server using a command line, ususally

mysql -u root -p

enter your password. Show your databases using

SHOW DATABASES;

Switch to your database using

USE my_database_name;

Now show your tables if you like..

SHOW TABLES;

Now get your CSV out from the table results of a query thus..

SELECT Name, Surname, Address, Postcode, Telephone
FROM Customers
INTO OUTFILE '/tmp/customers.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Et voila, data dumped to /tmp/customers.csv! Nice.

 

Perhaps my favourite XKCD cartoon.

Perhaps my favourite XKCD cartoon from xkcd.com

OK, funny / cool but how do I get .CSV file to my PC?

Understood.  I use Linux Mint, but in any Debian, Ubuntu, Mint system, open your file manager (or Thunar in Mint-speak) and put

sftp://your_username@your.server.name.com/tmp/

Enter any password required for the target server and voilà, you’re on the /tmp directory on the target server!  From there, you can copy / paste the file as you wish,

posted under Linux Tips | No Comments »

Extract data from a photo

October3

All pictures taken with digital cameras add information to images they take. A lot of information. To see it, install imagemagick using this command on the command line..

sudo apt-get install imagemagick

Then, just use the identify command thus..

identify -verbose /home/me/pics/some_picture.jpg

and it should pump out a heap of data.

Personally, if ever uploading photos to the internet (never) or emailing them to friends (rarely), I make sure to strip all the data from them. For this, use mogrify, also from the imagemagick suite…

mogrify -strip /home/me/pics/some_picture.jpg

Now the exif data has been removed. Nice!

 

True dat..

posted under Linux Tips | No Comments »

Start a VirtualBox server in headless mode

October2

Sometimes (in fact, why not every time?), you will want to start a server on your machine but not have it display a console. In other words, start it ‘headless’.

First, list all your machines. From the command prompt…

VBoxManage list vms

You get a list of all the machine images thus..

"Windows XP" {f0e63449-61bc-40e1-a82f-5a9bc6fb2434}
"Debian Basic" {b596b383-04e7-4895-bfaf-94a206f66960}
"Homestead_default_1407795525403_97441" {7abc2b40-5f57-4a6f-a647-8583c8790a62}
"UDA" {68999d0c-6391-4792-b13a-c120649ab240}
"PXE Boot" {fe1480eb-68d1-493a-9a90-6c36f819410e}
"Tiny Linux" {44ed7a1d-4e75-4d21-9bdd-a23699603af4}
"Turnkey Linux" {a2194ccb-c88d-48b9-aa6f-12b0805500c9}

So, to boot the Turnkey Linux box, just enter..

VBoxManage startvm "Turnkey Linux" --type headless

You should get

VBoxManage startvm "Turnkey Linux" --type headless
Waiting for VM "Turnkey Linux" to power on...
VM "Turnkey Linux" has been successfully started.

Now, just ssh straight onto the machine

ssh root@192.168.10.123

Obviously, you need to know the ip address of the machine in advance or see your DHCP log to see what address it picked up. Otherwise, you’re ready to log in.

To shut it down again…

VBoxManage controlvm "Turnkey Linux" poweroff

Sweet!

Check out the well-written and compact documentation for VirtualBox here.

posted under Linux Tips | No Comments »
« Older Entries