Skip to main content

Installing LAMP

LAMP = Linux, Apache, MySQL, PHP



1. Installing Linux 

More detailed information from my previous post.

  • Before starting the installation of a new OS make sure you have all the important files from your computer in a safe place (just in case something goes wrong). I used Buffalo's external hard drive (250 Gt).
  • I started by downloading Xubuntu 13.04 (64 bit version) torrent file and used UNetboot to create a bootable memory stick.
  • When the Live USB was done I restarted my computer, pressed F12 during the start-up and navigated myself to Boot manager where I chose to try Xubuntu without installing.
  • I opened the internet browser and made a Google search to lightly test my new OS.  

2. Installing Apache

More detailed information from my previous post.

  • Before installing anything it is important to update in order to get all the newest versions of packages. Do this with the command sudo apt-get update in Terminal.
  • After this start the installation of Apache2 by writing sudo apt-get install apache2.
  • I changed the location folder to user's directory with sudo a2enmod userdir and restarted Apache.
  • When testing functionality you should be able to open "It works!" -page by writing your computer's IP address (or simply localhost) to the address bar.
  • I created a new directory public_html (mkdir public_html) and added there a file called foo (nano foo). The operation was successful since my file appeared in localhost/~xubuntu

3. Installing PHP

  • To start the installation of PHP module use the command sudo apt-get install libapache2-mod-php5
  • Notice that after the installation the PHP module is not working by oneself yet. When visiting /etc/apache2 and using the command grep -ir php we can easily see what lines in which file we have to comment to get the module working. 
Grep-command prints all the wanted elements. In this case we are searching for PHP.

  • Go to the folder /etc/apache2/mods-enabled and start editing the file "php5.conf" with the command sudoedit php5.conf
  • Comment the needed lines with # and save the modified file. 
The modified php5.conf file.
  • Now the module should run fine so let's test it by creating a PHP file to user directory's public_html.
  • As we can see the PHP file is working fine and the code prints the number 4 to my webpage as it should. 
  • But what to do if there is something wrong with the code and the browser only shows you a blank page?
    • Go to the error log /var/log/apache2 and tail error.log
  • Thanks to the error log it is easy to figure out where the problem is. Here we can see that on Sunday 22nd 12:23:25 (GMT+0) year 2013 the error occurred because there was unexpected mark ":" in the file /home/xubuntu/public_html/foo.php on line 2. 


4. Installing MySQL

  • Run the command sudo apt-get install mysql-server. After a moment you are asked to define the root user's password.
  • When the installation of MySQL is done we are able to connect it with phpMyAdmin (sudo apt-get install phpmyadmin.)
  • The next part is really important and without doing it right you are not able to connect phpMyAdmin. Select apache2 with a star (use space key) and continue.
  • Now the installation screen will tell you that you must have a database installed and configured in order to use phpMyAdmin. Since I already did this I select "Yes".
  • Now you will be asked to give the same password you configured for the root user and a new password you never need to use so the wise thing is to leave this space empty and let the computer generate it for you.
  • The installation is done and if everything went as planned phpMyAdmin should be found from localhost/phpmyadmin (once again, put this address to your browser's address bar). You can log in by using the username root and the password you selected before.


I wanted to play a little bit with my shiny new phpMyadmin and created a new database called "Hunting dogs" and inserted there information and values to test it.




Linux version: Xubuntu 12.04, 64-bit

System information - OS: Windows 8 64bit Manufacturer: Dell Inc.Model: Inspiron 3721 BIOS: A05 Processor: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz (4 CPUs), ~~1,8GHz Memory: 8192MB RAM

Based on Linux course by Tero Karvinen (http://terokarvinen.com/)

Comments

Popular posts from this blog

Building Love-O-Meter by using a temperature sensor

This "Love-O-Meter" is based on the tutorial by Arduino and it comes with the starter kit. It uses a temperature sensor to measure the warmth of your skin and then starts to turn on (or off) the LEDs  indicated by the temperature.

The components Arduino UNOBreadboardJumper wiresLEDs220 ohm resistorsTMP36 temperature sensor

Building the Circuit
At first I ran the "Hello World" for Arduino to make sure the environment would work as expected. Now I could start to connect the jumper wires between Arduino UNO and the breadboard.

As usually I connected the breadboard to power (5V) and to the ground (GND). I inserted the TMP36 on the breadboard so the rounded part of the sensor would face away from Arduino.

I attached 3 LED lights and the resistors and connected them with Arduino. The lights should react to the heat of the finger and if the temperature would get hot enough all the lights would be on and would also tell you if you are a hot lover or not...

The result and the …

Creating a Bootable USB for Kali Linux

If you are interested to see my documentation about making a bootable USB for Xubuntu please click here!

This USB was made by using the latest version of Xubuntu (the 14.04 release).

Downloading Kali Linux 
23.13. After navigating to https://www.kali.org/ I chose the version that would suit me the best and started downloading the ISO image for 64-Bit system.


USB imaging
22.40. I followed the guide offered by kali.org and used the commandsudo fdisk -lwithout plugging the USB yet. I needed to pay attention to the path of Device Boot (/dev/sdb1). After this I inserted USB and ran the same command again. Now I could see how the name of Device Boot had changed to sdc1. This would be my USB to use.

22.50 It only took a while to format the dd code correctly as the base was already given on Kali's web page. After running the correct command for the first time I got an error message "'/dev/sdc1': Permission denied". In these kind of situations I tend to ask sudo for help an…

Using a button to control the LED light

This time my project was to configure how to build a button that would turn on and off depending if the user is pushing it or not. While holding the button down the LED should stay on until removing the finger.



For this assignment I used the fallowing components:
Arduino UNO and USBJumper wiresLED lightBreadboardButton10k ohm resistor
At first I run the "Hello World" for Arduino and made sure that the LED I was using worked properly (read my previous post).

I attached the button in the middle of the breadboard so the legs were touching the both "sides" of it.


Now I started to connect the jumper wires between the Arduino UNO and the breadboard. In order to get it working like in the sample code (Ardoino > Examples > 02.Digital > Button)
I linked the wires with Arduino's 5V (red wire, positive) and ground (black wire, negative) to the equal holes on the very corner of the breadboard (+ and -). I put the white jumper wire to connect the positive circuit to t…