Introduction
Lab Procedure
Prerequisites
- Open an SSH console to your Linux system using the PuTTY software, login with your standard user account
Set a static IP
- using your text editor of choice, open up the file /etc/network/interfaces
- Notice how it is currently set to dhcp for the eth0 interface.
- To set a static IP, you will need to change iface eth0 inet dhcp to iface eth0 inet static.
- 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.
- 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
- Now save the file, and exit your file editor.
- 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.
- Using the ifdown and ifup command, we are going to restart the network interface
- 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.
- At this point, your machine should now be using a static address. Verify it is now applied using the ifconfig command.
Install PHP & MySQL
- Using aptitude, install the php and mysql packages using aptitude install php5 mysql-server
- Note: Remember to do an aptitude update before installing packages.
- After the dependencies are found, go ahead and accept them to continue the install.
- 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 any database hosted on the system.
- After the install is complete, cd to /var/www
- To test that PHP is installed and functional, we will test it. Create a new file named phptest.php, and then open it in a text editor.
- Enter the following into the file:
<?php
phpinfo();
?>
- 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