LAMP: Installing on ubuntu desktop

Open baby

LAMP: Installing on ubuntu desktop

Postby intodis » 03 Feb 2008, 14:15

Setup LAMP(Linux, Apache, MySQL, PHP/Perl/Python) on your desktop. This involves installing Apache, PHP, Python and MySQL. I think Python will be installed by default and we only need to install mod_python for Apache.

Apache 2
Apache is the most popular web server, install by running this command in the terminal.
Code: Select all
sudo apt-get install apache2

All your files should be placed in the /var/www/ folder to be viewed from your server.

PHP5
PHP is on version 5 and can be installed by running
Code: Select all
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart

You can easily test whether you have correctly installed PHP by writing a simple test file.
Code: Select all
gksudo gedit /var/www/testphp.php

This will open a text editor and here insert this line.
Code: Select all
<?php phpinfo();?>

Point your browser to http://localhost/testphp.php

MySQL Server
Next install MySQL server
Code: Select all
sudo apt-get install mysql-server

MySQL by default allows connections only from 127.0.0.1 i.e., only from your own computer. This is ok if you are developing only on your own system. If you want to access your MySQL server from a network,
Code: Select all
gksudo gedit /etc/mysql/my.cnf

Find the line bind-address = 127.0.0.1 and comment it. Comments start with #(hash).
If you want to set a different password to your MySQL server (than the default none),
Code: Select all
mysqladmin -u root password your-new-password
mysqladmin -h root@local-machine-name -u root -p password your-new-password
sudo /etc/init.d/mysql restart

Install MySQL for Apache
Code: Select all
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After this, you have to enable the MySQL extension in your php.ini. Edit the file
Code: Select all
gksudo gedit /etc/php5/apache2/php.ini

Here uncomment the line “;extension=mysql.so”

After this restart Apache 2
Code: Select all
sudo /etc/init.d/apache2 restart

Python
Python for Apache can be installed by installing the libapache2-mod-python package.
Code: Select all
sudo apt-get install python libapache2-mod-python

From:
http://fslog.com/2006/12/01/setting-up-lamp-on-your-ubuntu-desktop/
intodis
Site Admin
 
Posts: 204
Joined: 30 Mar 2006, 20:57

Re: LAMP: Installing on ubuntu desktop

Postby intodis » 10 Jun 2008, 23:34

On an eeepc where you want to reduce the writes/etc to the solid state HD, there is a tweak that uses the tmpfs for the /var/log folder, this may result in apache2 failing to start with some mention of "httpd (no pid file) not running" and unable to write to the /var/log/apache2/error.log. Apache doesn't seem to like the log dir missing.

To resolve this and also a similar error with apt-get ... create a startup script and save it in the /etc/init.d folder, make it executable and register it to run at startup.

The script content, which created with and saved too, sudo gedit /etc/init.d/tmpdirs
Code: Select all
#!/bin/sh

#********************
# creates tmpfs dirs
# needed for correct
# system behaviour
#********************

mkdir /var/log/apt
mkdir /var/log/apache2
sudo /etc/init.d/apache2 restart


To make script executable
Code: Select all
sudo chmod +x /etc/init.d/tmpdirs


To test the script
Code: Select all
sh /etc/init.d/tmpdirs


Once happy it works then register to run at startup.
Code: Select all
sudo update-rc.d tmpdirs defaults


should work now.
intodis
Site Admin
 
Posts: 204
Joined: 30 Mar 2006, 20:57


Return to Ubuntu/Linux

Who is online

Users browsing this forum: No registered users and 1 guest

cron