Installation is really easy. Just use Synapitc Package Manager to choose the packages you need, like Apache2, php5, MySQL server/client, etc. If you like to add more features for your LAMP, just add more packages.
For seucrity purpose, it is necessary to add root password for MySQL. (Initially the root password is blank. When it asks password, just press the
return key and it log into the MySQL directly.)
Log into mysql as root:
fish@pool:~$
mysql -u root -pEnter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
set password for 'root'@'localhost'=password('newpassword');mysql>
flush priviledges;If root needs log into the MySQL from other machine, add a line,
mysql>
set password for 'root'@'hostname'=password('newpassword');If root needs log into the MySQL from any remote host, add a line,
mysql>
set password for 'root'@'%'=password('newpassword');END of MySQL root setting.
After Apache2 installation, the default Apache2 directory is
/var/www/apache2-defaultYou could save your HTML, php documents under this directory and view from other machine. If you like to have it from other directory, some changes need to be done on file
/etc/apache2/sites-available/defaultOR generate a new file
/etc/apache2/sites-available/newsiteThe contents of the file should be,
##############################
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot
/path/dirname/ <Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory
/path/dirname/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/
/path/dirname/cgi-bin/ <Directory
"/path/dirname/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
#################################################
To make the new site work, a symbolic link needs to be created under
/etc/apache2/sites-enabledAnd you can remove the
default-000 under this directory and then restart Apache,
sudo apache2ctl restartTo test php, a short php file could be saved under /path/dirname. (test.php)
Use browser to view the file. (http://localhost/test.php)