Logo
  • PHP
    • HipHop / HHVM
    • Modern PHP
    • PHPStorm
    • LAMP
    • Laravel
    • Composer
    • PDO
  • JavaScript
    • node.js
    • AngularJS
  • CSS
    • SASS
    • “CSS4” (CSS level 4)
  • HTML
  • Git
  • LAMP
  • Vagrant
  • UI / UX
  • Architecture of …
  • Off-Topic
With ♥ from Berlin
How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 12.04 or Debian 7.0/7.1

How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 12.04 or Debian 7.0/7.1

This little tutorial shows how to setup Apache, MySQL and PHP on a Linux server, in this case Ubuntu 12.04

September 1, 2013
Chris
Debian, LAMP, Linux, PHP, Ubuntu
2
PreviousNext

This little tutorial shows how to setup Apache, MySQL and PHP on a Linux server, in this case Ubuntu 12.04 LTS (by the way, if you want to know what LTS means, have a look into the wikipedia article) or Debian 7.0/7.1.

Most tutorials are making it overcomplicated, and beside that most commands (like apache restarting etc.) are not necessary anymore today. Log into your server…

1. Do an update and an upgrade to keep everything up-to-date:

sudo apt-get update
sudo apt-get upgrade

2. Install Apache:

sudo apt-get install apache2

3. Install PHP:

sudo apt-get install php5

4. Install MySQL, mysql module for PHP and PDO stuff:

sudo apt-get install mysql-server
sudo apt-get install php5-mysql

Provide a new mysql root password when asked. Then restart the server:

sudo service apache2 restart

By the way, then you think you messed something up while installing a package then you can remove the package and its config files via

sudo apt-get autoremove phpmyadmin

 

Have a look on your server to make sure Apache runs:

lamp apache mysql php on ubuntu 12.04

Cool ! Now let’s install PHPMyAdmin to make sure PHP and the MySQL server run and work together:

sudo apt-get install phpmyadmin

Select “apache2” when asked, select with SPACE and confirm with ENTER. Press ENTER when asked for auto-configuration and provide a new password for the phpmyadmin root user and mysql root passwords when asked for password (I use the same for this, to keep things simple). You don’t need to restart anything and there’s no need to config anything right now.

Have a look on PHPMyAdmin via

http://YOUR_IP/phpmyadmin/

and you’ll see the phpmyadmin login screen. Log in to prove that everything runs fine.

Done!

NOTE: in a real live application you should not log into the server as the root user, not provide the root password to phpmyadmin and in general not have phpmyadmin available on the live server, but for a development server that’s totally okay.

 

This article was written quite a while ago (9 years), please keep this in mind when using the information written here. Links, code and commands might be outdated or broken.

Random articles

  • How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 14.04 LTSHow to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 14.04 LTS
  • [RePost] Goodbye LAMP: Going Nginx, NoSQL, HHVM (41min conference talk with Arne Blankerts)[RePost] Goodbye LAMP: Going Nginx, NoSQL, HHVM (41min conference talk with Arne Blankerts)
  • Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)
  • Generate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one clickGenerate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one click
  • Install Laravel 4 on Ubuntu 12.04 LTS (a how-to tutorial)Install Laravel 4 on Ubuntu 12.04 LTS (a how-to tutorial)
  • How to setup a local server (in a virtual machine) with Vagrant in PHPStormHow to setup a local server (in a virtual machine) with Vagrant in PHPStorm
  • How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPetHow to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet
  • PHPMyAdmin not found after installation ? Here’s a fix (Ubuntu 12.04) !PHPMyAdmin not found after installation ? Here’s a fix (Ubuntu 12.04) !
  • EOL lists of Ubuntu, Debian and CentOS for your server planningsEOL lists of Ubuntu, Debian and CentOS for your server plannings
apachedebianLAMPMySQLPHPphpmyadminUbuntu
Share this

2 Comments

  • Brian
    November 22, 2013 10:48 am

    Hey, it’s a good idea to learn what elements are needed for a LAMP server but there are two easier ways that i think people should know about.

    First is installing LAMP straight from the apt-get command:
    sudo apt-get install lamp-server^

    This will automatically install everything needed for LAMP, i can’t remember if it install PhpMyAdmin though.

    The second is to install ‘tasksel’, this is a tool that can be used to install features from different types of ubuntu includes server.

    Installing:
    sudo apt-get install tasksel

    run:
    tasksel

    here is a tutorial:
    http://www.unixmen.com/install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat/

    You’ll see a list of other servers of ubuntu here so if you fancy the Kubuntu Desktop then you could do that as well.

    I haven’t tested these on Debian however.

    I just thoguht this might be a good tip, changes a bunch of commands into 1 or two, i find it very handy.

    Reply
    • Chris
      December 16, 2013 1:55 am

      NEVER EVER use tasksel! This horrible tool will install lamp, yes, but also deinstall everything else on your machine. This is the most useless tool ever. The tutorial you linked is full of angry comments from people who just lost everything on their machines.

      Reply

Leave A Comment Cancel reply

Frontend Ops Conf 2014 – Sarah Goff-Dupont: Git, Continuous Integration and Making It Pretty (31min video)

This article was written quite a while ago (8 years), please keep this in mind when using the information written

digitalocean coupon

DigitalOcean VPS coupon codes for december 2013 and early 2014

Some (working!) coupon codes for DigitalOcean, the low-cost VPS server/hosting provider of the year. They are for NEW customers, but

O’Reilly sells EVERY ebook for -50% right now!

A good chance to grab some IT books: O’Reilly sells every single book in their portfolio with a -50% discount

php ide

Sitepoint asks for your favourite PHP IDE – take part!

Bruno Skvorc ask for your favourite PHP IDE in this new article on Sitepoint. If you use one, then take

[Link] Improving Smashing Magazine’s Performance: A Case Study

The title says it all: A very interesting guide through the optimization process on one of the largest blogs in

offf-2014

Europeans: Get ready for OFFF conference / festival in Barcelona, May 2014

Designers and frontend guys, this is for you: If you live or simply are in western Europe in May 2014,

Soundcloud’s “VP of Engineering” about using SSDs

Excellent [german] statement from Alexander Grosse (Soundcloud’s Vice President of Engineering) about using SSDs for the main application (music data

increase-your-pagespeed-score

Increase your PageSpeed score (10min video with Matt Gaunt)

Compact and clever information for dramatic speed increases. Definitly worth watching. This article was written quite a while ago (8

A quick history of Comic Sans, the most wrongly used font ever

Excellent 10min presentation every frontend developer should see. Yes, even if you never touched Photoshop and never chose a font,

(Links) How to fix an extremely slow Symfony inside a Vagrant box

When you work with Vagrant (if not – try it!) on a Windows or Mac machine (which is an excellent

1/4

Categories

Search

php uk conference
PHP Opcache Explained by Julien Pauli (video from PHP UK Conference 2014)
Create a fast, perfect and bootable 1:1 Windows backup (full clone of HDD) for SSD migration
mod-rewrite-ubuntu-14-04-lts
EOL lists of Ubuntu, Debian and CentOS for your server plannings
october cms
October CMS, built on top of Laravel, is beautiful, clever and on the way to be the new #1 CMS
Berlin, prepare for TOA conference (15th – 17th of July)
composer
The difference between “composer install” and “composer update” – nailed on the head
vagrant
A super-simple Vagrant LAMP stack bootstrap (installable with one command)
ubuntu-14-04-lts lamp
How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 14.04 LTS
cheap cloud server php
DigitalOcean rolls out interesting feature: Transfering server snapshots directly to the client’s account
php
How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)
mod-rewrite-ubuntu-14-04-lts
How to install / setup PHP 5.5.x on Ubuntu 12.04 LTS
First look on Gitter, the chat for GitHub
dev coding cards deck
Nice gifts for devs: Nerdy playing-cards decks
hiphop php
PHP’s HipHop outperforms PHP 5.5 with Zend OPCache and Nginx by 15-20 times
[Link] Redesigning SoundCloud by Evan Simoni

Tags

apache bash centos composer conference coupon CSS debian fonts framework git GitHub hack HHVM HipHop HTML HTML5 IDE JavaScript JS LAMP laravel linux mod_rewrite MVC MySQL Nginx optimization PHP PHP 5.5 PHP 5.6 phpmyadmin PHPStorm security server SSD Ubuntu UI UX vagrant video virtual machine voucher VPS wordpress
Side-Project: Wordle-Solver:
www.wordle-helper.info

Pages

  • Privacy Policy
 
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT