Instructions for installing LAMP on Ubuntu for beginners

In this article, we will show you how to install a LAMP system.LAMP includes L inux, A pache, M ySQL, P HP. This tutorial is primarily for people who have only a little knowledge of Linux use.

Install Apache

To get started we will guide installing Apache.

1. Open the Terminal section ( Applications > Accessories > Terminal )

2. Copy / Paste the following line of code into Terminal and press enter:

sudo apt-get install apache2

3. Terminal will ask for your password, enter it and press enter.

Check Apache

To make sure everything is installed correctly, we will proceed to check Apache to make sure it works properly.

1. Open the browser and then enter the following web address in the address box:

http:/// localhost /

2. You will see a folder named apache2-default /. Open that folder, you will get a message saying ' It works! 'and you succeeded.

Install PHP

Next we will proceed to install PHP 5.

Step 1: Re-open the Terminal section ( Applications > Accessories > Terminal )

Step 2: Copy / Paste the following command line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3: Valid for PHP to work and compatible with Apache and we must restart it. Enter the following statement in Terminal to do this:

sudo /etc/init.d/apache2 restart

Check PHP again

To make sure there are no problems with PHP, check it out using the following steps:

Step 1: In Terminal, copy and paste the following command and press enter:

sudo gedit /var/www/testphp.php

This command will open a file named phptest.php .

Step 2: Copy / Paste the following command line into the phptest file:

Step 3: Save and close the file

Step 4: Open your web browser and enter the following address:

http:///localhost/testphp.php

You will see the following interface:

Instructions for installing LAMP on Ubuntu for beginners Picture 1

The installation of both Apache and PHP has been successful!

Install MySQL

Finally, installing MySQL

Step 1: Again open Terminal and enter the following command:

sudo apt-get install mysql-server

Step 2 (optional): For other computers on the network to see the server you created, you must first edit the 'Bind Address'. Start by opening Terminal to edit the file my.cnf .

gksudo gedit /etc/mysql/my.cnf

At the line

bind-address = 127.0.0.1

Change 127.0.0.1 address to your IP address

Step 3: This is an important step, enter the following command into Terminal:

mysql -u root

And copy / paste the following command:

mysql> SET PASSWORD FOR 'root' @ 'localhost' = PASSWORD ('yourpassword');

(Please change yourpassword with the password you choose)

Step 4: Now we will proceed to install phpMyAdmin, this is a simple tool to edit your database. Copy / paste the following command line into Terminal:

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

After installing everything, the next step is to make PHP work with MySQL. To do this, we need to open the php.ini file by entering the following command:

gksudo gedit /etc/php5/apache2/php.ini

In this file, we need to remove the comment in the following line by removing the first semicolon ( ; ):

; extension = mysql.so

Change it to the following:

extension = mysql.so

Now you can restart Apache and complete the entire installation process!

sudo /etc/init.d/apache2 restart

5 ★ | 1 Vote

May be interested

  • Instructions for installing Ubuntu on VMware Workstation - Part 1Instructions for installing Ubuntu on VMware Workstation - Part 1
    for some reason, can't you continue to use windows (royalties)? you want to discover a certain operating system that is enough to replace the already familiar windows? you just need 1 software, some operating system to meet the needs of working very simple? check out the free and completely open source ubuntu operating system.
  • 5 things to do after upgrading to Ubuntu 22.04 LTS5 things to do after upgrading to Ubuntu 22.04 LTS
    ubuntu 22.04 lts jammy jellyfish is the latest version of the popular open source operating system ubuntu. installing a fresh copy on a freshly wiped hard drive will give you a great computing experience.
  • Should buy a bathroom heating lamp of the best company?Should buy a bathroom heating lamp of the best company?
    if you are planning to buy a bathroom heating lamp for your family, you should choose your bathroom heating lamp: hichiko, heizen, hans, sunhouse, kottmann.
  • Does the bathroom heating lamp cost electricity?Does the bathroom heating lamp cost electricity?
    a bath heater that uses a lot of electricity is not a question of many people. just want the bathroom to be warm in the winter and still save electricity, don't miss the article below of quantrimang!
  • Tips and tricks after installing UbuntuTips and tricks after installing Ubuntu
    ubuntu is one of the completely free open source operating systems. this is a distribution (distro) of linux with the second highest amount of traffic after linux mint.
  • What's New in Ubuntu 21.10?What's New in Ubuntu 21.10?
    version 21.10 is the latest release of ubuntu and although canonical is turning more attention to the cloud and developers, ubuntu 'impish indri' still comes with some notable changes for those users use the ubuntu desktop every day.
  • Detailed instructions on how to install Windows 7 for beginnersDetailed instructions on how to install Windows 7 for beginners
    for many people, installing windows on a computer is a very complicated process. but with the following instructions, installing win is as easy as eating candy even if you do not know how to install it.
  • Instructions for installing Ubuntu parallel to Windows 10 easilyInstructions for installing Ubuntu parallel to Windows 10 easily
    ubuntu is an open operating system familiar to many programmers, as well as it people.
  • Instructions for installing Microsoft Office 2007 in Ubuntu 9.04Instructions for installing Microsoft Office 2007 in Ubuntu 9.04
    in the field of handling office work, microsoft office has almost no competitors with many outstanding features, the ability to handle smart and convenient jobs. however, for people using open source operating systems like ubuntu, using microsoft office suite is indeed a problem.
  • Instructions for downloading Ubuntu - Download the latest UbuntuInstructions for downloading Ubuntu - Download the latest Ubuntu
    instructions for downloading ubuntu - download the latest ubuntu. ubuntu is free and open source software, which means that users can freely run, copy, distribute, research, change and improve the software. that's one reason why software developers or developers often use this ubuntu operating system.