Franske ITC-2480 Lab 5

From ITCwiki
Jump to navigation Jump to search

Introduction

Lab Procedure

Prerequisites

  1. Open an SSH console to your Linux system using the PuTTY software, login with your standard user account

Set a static IP

  1. Using your text editor of choice, open up the file /etc/network/interfaces
  2. Notice how it is currently set to dhcp for the eth0 interface.
  3. To set a static IP, you will need to change iface eth0 inet dhcp to iface eth0 inet static.
  4. Now, under the iface line you just edited, you will need to enter the address, netmask, and gateway for the static network.
    • Reminder: it is common practice to indent (tab) static network configuration information in the interfaces file.
  5. Your configuration should be similar to this:
auto eth0
iface eth0 inet static
	address xxx.xxx.xxx.xxx
	netmask xxx.xxx.xxx.xxx
	gateway xxx.xxx.xxx.xxx
  1. Now save the file, and exit your file editor.
  2. Now we are going to apply the static IP change
    • NOTE: You should only do network configuration changes when you have physical access to a machine. This way, if you mess up your configuration you will be able to fix it from a local console.
  3. Using the ifdown and ifup command, we are going to restart the network interface
  4. In a terminal, run ifdown eth0 && ifup eth0. Notice the two && symbols. This tells the linux shell that it should run the second command right after the first. If we do not define this, then we would be left with a machine that has its networking turned off.
  5. At this point, your machine should now be using a static address. Verify it is now applied using the ifconfig command.

Install PHP & MySQL

  1. Using aptitude, install the php and mysql packages using aptitude install php5 mysql-server
    • Note: Remember to do an aptitude update before installing packages to make sure you get the latest versions
  2. After the dependencies are found, go ahead and accept them to continue the install.
  3. During the mysql-server install, you will see a blue window (similar to the debian install screen) that will ask you to create a mysql root password. This password is what will be used to access the root account in mysql. Just like in linux, the mysql root account has full control of all databases hosted on the system. It does not need to be the same as your system root password but just like your system root password it is important that you keep it secure and don't forget what it is.
  4. After the install is complete, cd to /var/www
  5. At this point we will test to verify that php is working properly with Apache. Create a new file named phptest.php, and then open it in a text editor.
  6. Enter the following into the file:
    <?php
    phpinfo();
    ?>
  7. Now save the file, and on your local machine go to xxx.xxx.xxx.xxx/phptest.php in a web browser where xxx.xxx.xxx.xxx is your VM's static IP. You should now be on a page that shows your PHP Version, and system information.

experiment with websites and databases

View Logfiles