Monthly Archives: May 2016

How to install Centos on VirtualBox

Virtual box is a free, opensource Hypervisor, it allows you to run one operating system within another one. This post will detail how to install CentOS, an open source operating system  in Virtual Box.

 

To successfully follow this tutorial you will need to download and install Virtualbox. You will also need to download the 32 bit live CD of CentOS.

 

Virtual box can be downloaded from their download page https://www.virtualbox.org/wiki/Downloads and the CentOS live os can be downloaded from their download page http://isoredirect.centos.org/centos/6/isos/i386/

 

Once you have these two prerequisite steps completed you can start the tutorial below:

 

Part 1 – Creating the Virtual Machine

  1. Begin by opening VirtualBox, and click on new.

 

 

2. In the window that appears:

a. Type in CentOS.

b. Select Linux.

c. Select version 32 bit Red Hat.

 

 

3. Leave the memory size at the recommended and click next.

 

 

4. Select create a virtual hard disk now and click create.

 

 

5. Select VDI (VirtualBox Disk Image) and click next.

 

 

6. Select dynamically allocated and click next.

 

7. Leave the disk name as CentOS, the disk size as 8GB and click next.

 

Part Two – Mount the CentOS Live CD

 

1. You should now be returned to the VirtualBox main screen, and you should see your Virtual machine. Next you need to mount the CentOs ISO to install CentOs. Click on the CentOs Virtual Machine and then click settings.

 

 

2. Click Storage

 

 

 

3. Select Empty, and then select the CD icon and then click ‘choose Virtual Optical Disk File’.

 

 

4. Navigate to and select the CentOs ISO which you have downloaded. Select it and click open.

 

 

5.Click OK.

Part 3 – Install CentOs.

 

1.We can now start the CentOs virtual machine by clicking on it and then clicking start.

 

 

2. The Virtual Machine will boot into a live image of CentOs. Double click on install to disk.

 

 

3. Click Next.

 

4. Select Language and Click next.

 

5. Select basic storage device and select next.

 

6. Select discard any data.

 

7. Leave the hostname as default.

 

8. Select your time zone and click OK.

 

9. Enter a root password and click next.

 

10. Select ‘Use All Space’ and click next

 

11. Select write changes to disk.

 

12. CentoS will now install.

 

13. Once CentOs is installed you can click close.

 

14.Click system and Shut Down.

 

Part Four: Clean up

 

1. Now click the Centos Virtual Machine and click settings.

 

 

 

2.Click Storage.

 

 

3.Now select the CentOs ISO ,click the CD icon and select remove disk from virtual drive, then click OK.

4. Now start the Virtual Machine.

 

5. Move through the final steps which include setting up your user name and password. Once this is done you should see the log in screen.

 

Congratulations, you have just completed the installation of CentOs on a Virtual Machine.

 

 

How to Tweet From Python

Step one

Download and install twython, using pip. I’m using python 3 so I typed the command

sudo pip3 install twython

 

 

Step 2

Go to apps.twitter.com and create an account using your Twitter username and password.

 

Step 3

Click ‘Create New App’

Step 4

Fill in the mandatory fields and click next, if you don’t have a website just pop in a placeholder.

 

Step 5

Once your app is created you will now will be brought through to a new page, click ‘Key and Access Tokens’.

 

Step 6

Take note of the Consumer Key (API Key) and Consumer Secret (API Secret)

 

Step 7

You will need to create an access token.

 

 

Step 8

You should now see your access tokens, take note of these also.

 

Step 9

Open up your favorite text editor, I’m using Idle, and enter the following:

from twython import Twython

 

APP_KEY = ‘YOUR_KEY_GOES_HERE’
APP_SECRET = ‘YOUR_SECRET_GOES_HERE’
OAUTH_TOKEN = ‘YOUR_TOKEN_GOES_HERE’
OAUTH_TOKEN_SECRET = ‘YOUR_TOKEN_SECRET_GOES_HERE’

 

twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.update_status(status=’this is a test tweet from a python script!’)

 

Step 7

Now run your script, if using Idle, you can do this by pressing F5.

 

Step 8

Check Twitter to make sure your tweet has sent.