Roshan Book

My Tech Notebook

Tag Archives: lamp

Install and Configure LAMP on Ubuntu

This post was originally published at http://www.blog.highub.com/shell/install-and-configure-lamp-on-ubuntu/

In this article, I will share my experience install and configure LAMP on Ubuntu Linux.

1. Launch Terminal
First open up Applications->Accessories->Terminal.

2. Install Apache
Type the following line of command:

sudo apt-get install apache2

3.Install PHP5
Execute the following command by typing the following line in the Terminal and hit enter:

sudo apt-get install php5 libapache2-mod-php5

4. To Stop/Restart Apache
Execute the following command in the Terminal:

Stop/Restart Apache

5.Install MySQL Server

sudo apt-get install mysql-server

6.Set mysql root password
You’ll need to set a password for local computer gets root access.

a. First type the follwing line and hit enter to avoid being prompted for password:

sudo su

b. now you must kill the running mysql server. The process id is grabbed from /var/run/mysqld/ and inserted into the kill statement. Note there are ticks (`) around the process id, not single quotes (‘).

kill `cat /var/run/mysqld/mysqld.pid`

c. Now you need to run a command to cause the server not to use the privilege system at all, which gives anyone with access to the server unrestricted access to all databases.

mysqld –skip-grant-tables & mysql -u root

d. Set the password:
UPDATE mysql.user SET Password=PASSWORD (‘newpassword’) WHERE User = ‘root’;

e. execute the following commands one by one to finish the password setup.
exit
kill `cat /var/run/mysqld/mysqld.pid`
mysqld &
mysql -u root -p

7.Install MySQL Administrator

sudo apt-get install mysql-admin

8. Refresh Gnome Panel

killall gnome-panel

9. Install MySQL for Apache HTTP Server

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Install and Configure phpMyAdmin on Ubuntu LAMP

PhpMyAdmin is a nice database management and administration tool, it is easy to install it, but some people are having problems making it work under apache, that’s because it needs configuration. I presume you already have LAMP installed and configured on your machine, if not, please read this post – Install and Configure LAMP on Ubuntu first.

Just in case you haven’t installed phpMyAdmin yet, type the following line in the Terminal:
apt-get install phpmyadmin

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:
gksudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf

 

Now restart Apache:
sudo /etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin, you should be able to see the phpMyAdmin landing page now!

Install Lamp stack on Ubuntu linux

To install lamp stack on ubuntu linux, follow the following steps

1. Hit Ctrl+alt+t – This will open up a terminal window

2. Enter sudo apt-get install tasksel

3. sudo  tasksel

4. A window will open

5. Select lamp by clicking space

6. Hit enter, and will will install LAMP stack

Install and Enable mod_python 

Python is installed by default on the machine. However, to be able to use python with your web server, you must install the Apache module mod_python with the following command:
apt-get install libapache2-mod-python

To enable python support for the example site “ducklington.org”, you need to add the following to the site’s VirtualHost entry in that site’s configuration file:

File excerpt: /etc/apache2/sites-available/ducklington.org

AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On

If you need support for MySQL you must also install python-mysqldb which you can accomplish with:
apt-get install python-mysqldb

Restart Apache

Finally, restart Apache to make sure everything is loaded correctly:

/etc/init.d/apache2 restart

%d bloggers like this: