Ubuntu 10.04 Guide – Installing a LAMP server (Linux, Apache, MySQL, PHP) with phpMyAdmin

13 February 2010 1 comment

This is a guide to installing Apache, MySQL and PHP on a standard Ubuntu 9.10 box together with the additional phpMyAdmin application.

 

Notes on the tutorial:

This tutorial assumes:

- You have an internet connection.

- You have Ubuntu installed on your system

When you are required to type in a command, it will be presented by firstly showing the command prompt and then whatever should be typed, eg

# clear

This means that “clear” should be typed in (without the quotation marks). 

Also note that Linux is case sensitive, thus “clear” does not equal “Clear”.

 

1.  Prepping your Ubuntu box

Boot up your machine and log into Ubuntu.

Start the Terminal application by clicking on Applications –> Accessories –> Terminal.

# sudo apt-get update

Enter the root password and wait for the upgrade.  If all went well your terminal window should look something like the one below (you might have different servers listed depending on where you live).  Either way the execution of the update command should end in “Reading package lists… Done”.

image

 

2.  Installing the LAMP server

Still in the terminal window type in the following:

# sudo tasksel

This terminal window should change to the following screen:

image

Using your arrow keys, scroll down to “LAMP server” and press Spacebar to select it. 

Now press the Tab key to highlight the “<Ok>” button and press Enter.

The following screen should appear:

image

Now wait until all the modules are installed.  Note the amount of files you have to retrieve may vary depending on what you already have installed on your Ubuntu system.

During the installation, you will be prompted with the following screen:

image

You need to enter a password for the root MySQL user.  It is the password that the database administrator will use to manage the database.  This should not be the same as as any user password.  Fill it in and press Enter. 

You’ll be asked to confirm this password.  Type it in again and press Enter.

The installation will then make a few configurations and exit the installer.

You will then be presented with your terminal window again.

——————–

3.  Installing phpMyAdmin

Whilst still in the terminal window, type in the following:

# sudo aptitude install phpmyadmin

A few instructions will run and you will be asked if you want to continue.  Type in “y” and press Enter.  This will start the installation of phpMyAdmin.

During the installation you will be presented with the following screen:

image

Select only “apache2” using Spacebar.  Press the Tab key to highlight the “<Ok>” button and press Enter.

You will shortly thereafter be presented with the following screen:

image

Use the Tab key to highlight the “<No>” option and press Enter.

When the installation is complete the installer will exit and you’ll be presented with the terminal window again.

# exit

This closes the Terminal application.

Click the power button icon in the top right corner of your screen and then the “Restart…” option.

 

4.  Post installation tests

After rebooting and logging in, click on the Firefox icon –>  image

After Firefox has started up type in “127.0.0.1” in the URL bar and press Enter.  You should be presented with a webpage like the one illustrated below:

image

 

Now type in “127.0.0.1/phpmyadmin” and press Enter.  You will be presented with the phpMyAdmin login page as indicated below. 

image

Enter “root” as the username and the password you chose in step 2 and click the “Go” button.

This will load the phpMyAdmin main menu, as show below:

image

On the right hand side of the page, under the “Web server” heading you can see that Apache, MySQL and the PHP extension “mysql” are installed.

 

That’s it.  You have successfully installed a LAMP server with phpMyAdmin.

 

 

Post installation notes:

Depending on what you plan to do with your server, you might find it necessary to install some additional php modules later on.  Your server documentation should indicate exactly which modules will have to be installed.

For a list of php modules:

# sudo aptitude search php5

You may then install whichever module by typing in the module name, eg.

# sudo aptitude install php5-curl

Categories: Linux

VirtualBox Installation – Windows Host with a Ubuntu 9.10 Guest and VirtualBox Linux Guest additions

8 February 2010 Leave a comment

 

Experience has taught me that dual-booting Linux and Windows can become a nightmare if you mess up your Linux system by accident.  VirtualBox gave me the best of both worlds, as I could run my Linux distributions within Windows and even when I mess things up, I can just revert to my latest snapshot and undo everything I’ve done wrong.

If you’re interested in Linux for any reason and want to learn a bit more about the operating system and how it works, I seriously advise you to download VirtualBox (it’s free) and run a Linux distribution through a virtual machine.

 

Notes on the tutorial:

When you are required to type in a command, it will be presented by firstly showing the command prompt and then whatever should be typed, eg

# clear

This means that “clear” should be typed in (without the quotation marks). 

Also note that Linux is case sensitive, thus “clear” does not equal “Clear”.

 

 

1.  Download Ubuntu 9.10 from http://www.ubuntu.com

In my example, I’ll be using Ubuntu 9.10 – i386 edition (aka the 32-bit version).  Unless you have a 64-bit processor, I would advise you to always use 32bit distributions for your virtual machines.  In this example I downloaded the following file:  “ubuntu-9.10-desktop-i386.iso”

 

2.  Download the latest VirtualBox application from http://www.virtualbox.org

In my example I have downloaded VirtualBox 3.1.2

 

3.  Install VirtualBox. 

During the installation you should elect to have all components installed.

During the installation you will get the following error message several times:

The software you are installing has not passed Windows Logo testing to verify its compatibility with Windows XP…

Click the ‘Continue Anyway’ button to proceed.  Just so you know, what your installing are virtual network devices which enables your virtual machines to communicate with the host machine, other virtual machines, the internet, etc.

 

4.  Set up your the Ubuntu Virtual Machine

Start VirtualBox.

Click image and then click Next. 

Type in a name for your virtual machine, in this example I’ve used “Ubuntu”.  Under the Operating System drop-down box select “Linux” and under Version select “Ubuntu” (as indicated below).  Click Next.

image

Next you have to select the amount of memory you wish your virtual machine to have.  I would personally not use more than half of your system memory.  In this example I’ve used 512MB of memory as experience has shown that this is more than enough.  Click Next.

Select “Create new hard disk” and then click Next.

This brings us to the “Create New Virtual Disk” window.  Click Next.

You now have the option of using either selecting “Dynamically expanding storage” or “Fixed-size storage”.  The difference between the two options is explained within the window.  In this example, as my disk space is limited, I’ve selected “Dynamically expanding storage”.  Click Next.

You now have the option to change the default location of where the hard disk of the virtual machine will be stored.  Change the location if you need to.  You also have the option of changing the maximum size of your hard drive.  Unless you know for a fact that you’ll be placing large files in your virtual machine, don’t bother making the hard drive larger.  In my example I’ve left it as 8 GB.  Click Next. 

Click Finish.

Click Finish again.

 

5.  Prepping you virtual machine for the Ubuntu installation

Make sure the ‘Ubuntu’ virtual machine is selected and click image .

This brings up the Settings window.  In the left navigation pane select ‘Storage’.

In the ‘Storage Tree’ box click on the logo of a CD.  Its label should read ‘Empty’.  This will change the ‘Attributes’ section on the right hand side of the window as indicated below:

image

In the ‘Attributes’ section, click the following icon:  image

This will open the ‘Virtual Media Manager’ window.

Click the ‘Add’ button and navigate to the your Ubuntu ISO file downloaded in step 1 (“ubuntu-9.10-desktop-i386.iso” in my case).  Select the ISO file and click ‘Open’.  This will take you back to the ‘Virtual Media Manager’ window.  Make sure the correct ISO is highlighted and click ‘Select’.

This will take you back to the ‘Settings’ window.  Click OK

Your Ubuntu CD (the ISO) is now loaded (aka mounted) into the virtual DVD drive.

 

6.  Installing the Ubuntu 9.10 operating system

(Before you start you should know that virtual machines capture your mouse movements and keyboard strokes after you click on them.  To release them and use Windows again you need to press right Ctrl)

Before you turn on your virtual machine, ensure that you are NOT connected to the internet.

Make sure your Ubuntu virtual machine is highlighted and click on Start.

Your virtual machine will boot up and present you with a menu of languages.  Choose the language of your choice (I’m assuming English) and press Enter.

Now select “Install Ubuntu” and press Enter.

The following screen should appear once Ubuntu has booted up:

image

Click Forward

Next you’ll be prompted to select your region and zone by clicking on a location on the map of the world.  You may also use the drop down boxes as a method of selecting a region and zone.  Select your applicable options and click Forward.

At the following screen you’ll be asked to select a keyboard type, which should be the “USA” version in most cases.  In the screenshot below you can see that the “Suggested option” was already on the USA keyboard.  My advice is to select the suggested option unless you know for a fact that it’s wrong.  Click Forward.

image

Next you’ll be presented with the “Prepare disk space” screen.  Make sure that “Erase and use the entire disk” is selected and click Forward.

Now you come to the “Who are you?” screen (below).  All the fields are already explained at length within the window.

image

One thing to note is that it’s always safer to require a password to log in, and if you’re really security conscious, you can also elect to have your home folder encrypted.  Fill in all the necessary details and click Forward.

Lastly, you’ll be presented with the “Ready to install” screen.  Click Install.

Now wait.  It took between 10-15 minutes on my system.

When completed, the following message will appear:

 image

Click the Restart Now button and wait.  The graphical user interface (GUI) will shut down and you’ll soon be presented with the following message: “Please remove the disk and close the trai (if any) then press Enter” (as shown in the screen below).

At this point you need to unmount your loaded ISO.  First press right Ctrl (to release your mouse from the virtual machine).  Then click on Devices –> CD/DVD Devices –> Unmount CD/DVD Device as indicated below.  You might get an error message that says that the image could not be unmounted.  Just click ‘Force Unmount’ if the error appears.

image

 

After unmounting the disk, click on the virtual machine screen (to recapture your mouse and keyboard) and press Enter.  This will restart you machine.

After the machine is finished rebooting, you’ll be presented with a logon screen like the one below:

image

Click on the username (“John Doe” in the example above). Type in your password (the one you typed in during the installation process) and press Enter.

You are now logged into Gnome (the default graphic desktop environment).

 

 

7.  Installing the VirtualBox Linux Additions

Once logged into Gnome, press right Ctrl and then click Devices –> Install Guest Additions.

This should lead to the next message:

image

Click on your your virtual machine again to recapture your mouse and keyboard.

Click on Cancel.

Navigate to the terminal application by clicking Applications –> Accessories –> Terminal, as shown below:

image

This should bring up a terminal window, as indicated below:

image

The terminal window is where all your commands are issued and where Linux, in my opinion, really comes alive.  If you are new to Linux you should know that most of your time will be spent in a terminal window, and if it isn’t, you’re doing it wrong.

Anyway, type in the following:

 

# sudo –s You’ll now be prompted to enter the root password (this is the same as your main user password). 
This command gives you root privileges on all your commands.  You’ll also notice that your prompt has also now changed to indicate that the “root” user is now logged in to issue commands.
# cd /media/cdrom0 This changes the path to the mounted CD.
# ls This lists the contents of a directory.
# ./VBoxLinuxAdditions-x86.run Note the “./” at the beginning of the command.  This tells Linux that you want it to to run a script.
# exit This drops the root privileges.  You’ll notice that the command prompt has once again changed to the standard user prompt.

 

If all went well your terminal should look as follows:

image

type in “exit” and press Enter to close the terminal.

Unmount the virtual additions ISO as explained in step 6 (Devices –> CD/DVD Devices –> Unmount CD/DVD Device).

Shutdown your virtual machine by clicking the power button in Ubuntu (in the top right corner of your virtual machine) and then selecting “Shut Down…”

A message box will appear with a shut down countdown.  Click Shut Down to power off your machine.

 

 

That’s it!  You’ve successfully installed an Ubuntu 9.10 virtual machine with the VirtualBox additions.  When you boot up your virtual machine and log onto Gnome your mouse and keyboard will automatically be captured and released (thus no more right Ctrl) and you can resize your window to suit your needs.  If you want to run it in fullscreen mode, just press right Ctrl+F.

VirtualBox Installation – Windows Host with a BackTrack 4 Guest and VirtualBox Linux Guest Additions

3 February 2010 30 comments

In this tutorial I shall be installing BackTrack 4 as a guest in my Windows XP host.

Background:  Backtrack is a great hacking platform with pre-installed network security tools.  It was originally designed to be used as a live-cd, but the latest version allows for an easy hard drive install.  Later tutorials will explain how to get BackTrack talking to other virtual machines.  One could thus set up a nice hacking testbed to further your own understanding of network security.

One word of warning though:  If the aim of your BackTrack installation is to learn more about Wi-Fi hacking, I’d advise you to use a live-cd or install it to a computer.   It is possible to run a wi-fi usb stick through the virtual machine, but its not just plug and play.  VirtualBox does have USB issues and you are going to find it difficult to get everything working as it should.  Chances are if you’re reading this tutorial it’s probably a bit over your head to attempt that right now.  My advice is to get used to the system and then go for it at a later stage.

Notes on the tutorial:

When you are required to type in a command, it will be presented by firstly showing the command prompt and then whatever should be typed, eg

root@bt:# clear

This means that “clear” should be typed in (without the quotation marks).

Also note that Linux is case sensitive, thus “clear” does not equal “Clear”.

1.  Download Backrack 4 from http://www.backtrack-linux.org/

In this example I downloaded the following file:  bt4-final.iso

2.  Download the latest VirtualBox application from http://www.virtualbox.org

In my example I have downloaded VirtualBox 3.1.2

3.  Install VirtualBox.

During the installation you should elect to have all components installed.

During the installation you will get the following error message several times:

The software you are installing has not passed Windows Logo testing to verify its compatibility with Windows XP…

Click the ‘Continue Anyway’ button to proceed.  Just so you know, what your installing are virtual network devices which enables your virtual machines to communicate with the host machine, other virtual machines, the internet, etc.

4.  Set up your the Backtrack Virtual Machine

Start VirtualBox.

Click image and then click Next.

Type in a name for your virtual machine, in this example I’ve used “Backtrack 4”.  Under the Operating System drop-down box select “Linux” and under Version select “Other Linux” (as indicated below).  Click Next.

image

Next you have to select the amount of memory you wish your virtual machine to have.  I would personally also not use more than half of your system memory.  In this example I’ve used 512MB of memory as experience has shown that this is more than enough.  Click Next.

Select “Create new hard disk” and then click Next.

This brings us to the “Create New Virtual Disk” window.  Click Next.

You now have the option of using either selecting “Dynamically expanding storage” or “Fixed-size storage”.  The difference between the two options is explained within the window.  In this example, as my disk space is limited, I’ve selected “Dynamically expanding storage”.  Click Next.

You now have the option to change the default location of where the hard disk of the virtual machine will be stored.  Change the location if you need to.  You also have the option of changing the maximum size of your hard drive.  Unless you know for a fact that you’ll be placing large files in your virtual machine, don’t bother making the hard drive larger.  In my example I’ve left it as 8 GB.  Click Next.

Click Finish.

Click Finish again.

5.  Prepping you virtual machine for the Backtrack installation

Make sure the ‘Backtrack 4’ virtual machine is selected and click image .

This brings up the Settings window.  In the left navigation pane select ‘Storage’.

In the ‘Storage Tree’ box click on the logo of a CD.  Its label should read ‘Empty’.  This will change the ‘Attributes’ section on the right hand side of the window as indicated below:

image

In the ‘Attributes’ section, click the following icon:  image

This will open the ‘Virtual Media Manager’ window.

Click the ‘Add’ button and navigate to the your Backtrack ISO file downloaded in step 1 (the bt4-final.iso file in my case).  Select the ISO file and click ‘Open’.  This will take you back to the ‘Virtual Media Manager’ window.  Make sure the correct ISO is highlighted and click ‘Select’.

This will take you back to the ‘Settings’ window.  Click OK

6.  Installing the Backtrack 4 operating system

(Before you start you should know that virtual machines capture your mouse movements and keyboard strokes after you click on them and to release them you need to press right Ctrl)

Make sure your Backtrack 4 virtual machine is highlighted and click on Start.

This will spawn the virtual machine and should load the Backtrack boot menu.  Depending on your screen resolution you may either select “Start BackTrack FrameBuffer (1024×768)” or “Start BackTrack FrameBuffer (800×600)”.  In my example I’ve selected the 1024×768 resolution.  Select your option and press Enter.

Backtrack is now booting up.  At the end of the process you’ll be presented with the command prompt – root@bt:#

root@bt:# startx

This should open up KDE, the Backtrack graphical front-end.

In the top left hand corner of the desktop is a file called “install.sh” script.  Click on this icon.  This will start the Backtrack 4 installation.

Select your time zone and click Forward.

Select your keyboard type.  In my example its just the standard USA keyboard.  Click Forward.

You should now be at the “Prepare disk space” screen.  Make sure “Guided – use entire disk” is selected.  Click Forward.

You should now be at the “Ready to install” screen.  Click Install.

(Just a quick note:  There are actually 7 steps in the install screen, but if you follow the above guide, you should automatically skip several of them).

Now wait.  It takes quite a while to install.   It took about 20 minutes on my system.

After the installation you’ll be presented with a message that states that the installation is complete.  Click ‘Restart Now’.

You’ll be taken back to the command prompt and the following message will be displayed: “Please remove the disc and close the tray (if any) then press ENTER:” (as shown below).

At this point you need to unmount your loaded ISO.  You do this by pressing right Ctrl (to release your mouse from the virtual machine).  Then click on Devices –> CD/DVD Devices –> Unmount CD/DVD Device as indicated below.  You might get an error message that says that the image could not be unmounted.  Just click ‘Force Unmount’ if the error appears.

Unmount disc after installation

After you have unmounted the disc, click on the virtual machine screen (to recapture your mouse and keyboard) and press Enter.  This will restart you machine.

After booting up, you’ll be presented with the login prompt.

The default login details for Backtrack 4 after a clean install are as follow:

login:  root

password:  toor

Note: if you want to shut down the virtual machine at this point and continue the tutorial later, type in the following after logging in:

root@bt:# shutdown –P –q now

7.  Installing the VirtualBox Linux Additions

After booting up and logging in press right Ctrl to release your mouse and click Devices –> Install Guest additions.

Click on the virtual machine (to re-capture mouse and keyboard) and type in the following:

root@bt:# cd / This changes the path to the root directory.
root@bt:# mkdir /mnt/cdrom This creates a directory under the ‘mnt’ directory.
root@bt:# mount /dev/hdc /mnt/cdrom This mounts the VirtualBox additions disk to the newly created directory.
root@bt:# cd /mnt/cdrom This changes the path to the mounted CD.
root@bt:# ls This lists the contents of a directory.
root@bt:# ./VBoxLinuxAdditions-x86.run Note the “./” at the beginning of the command.  This tells Linux that you want it to to run a script.

If all went well, your terminal should look like the one below:

image

Lastly enter the following command to shut down your virtual machine:

root@bt:# shutdown –P –q now

That’s it!  You’ve successfully installed a Backtrack 4 virtual machine with the VirtualBox additions.  When you boot up your virtual machine and log onto KDE your mouse and keyboard will automatically be captured and released and you can resize your window to suit your needs.  If you want to run it in fullscreen mode, just press right Ctrl+F.

Follow

Get every new post delivered to your Inbox.