Im Durchschnitt wird dieses Tutorial Install a LAMP server with PHP 7 and Apache 2.4 on Ubuntu mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 1101 Besucher eine Bewertung abgegeben.
1101 0

Install a LAMP server with PHP 7 and Apache 2.4 on Ubuntu

from gridscale Team LAMP Stack Ubuntu WebServer
tutorial - how to install a LAMP server with PHP 7 and Apache 2.4 on Ubuntu 16.04

What is a LAMP server?

A LAMP server is probably the best known server installation, as it is set up with with Linux, Apache, MySQL and PHP – the ideal starting situation for the most widespread CMS systems, such as WordPress, Drupal or Typo3.

Before you can start the installation, you have to create a cloud server with Ubuntu 16.04.

First you create a server with at least one public IP address and usually 2 CPUs and 4 GB of RAM (our recommendation). We are using the gridscale environment to serve as an example.

gridscale Server erstellen


Parallel to this, you create another storage. You should set the size here so that your project has enough space. But in case of need you can adjust the size of the hard drive also later in the operation. Resize Storage on-the-fly (German only)

Create Storage

As a template you select our gridscale Ubuntu 16.04 template. Here you can optionally assign a root password or use an SSH key. Once you have made your settings, you can create the storage and connect it directly to the server using drag & drop.

GUI with Server

Updating the Ubuntu Server

Your server should start within a few seconds. You can connect to the server via SSH and, if you have a password, log in as root:

ssh root@185.102.XX.XXX

gridscale LAMP Login

Now we make sure that all installed packages are updated and upgraded.

apt-get update
apt-get upgrade

Installing an Apache Web Server

First we install the web server. We can also do this with a command:

apt-get -y install apache2

The -y stands for confirming all options directly, since we want a standard installation.

Once the installation is finished after a few seconds / minutes, you can test it directly by entering the IP address of the server in the browser.

gridscale Apache2.4 Installed

Installing a MariaDB Database

Instead of MySQL, we install MariaDB in this guide. MariaDB is a MySQL-Fork managed by the original MySQL developer team, which is compatible with MySQL and has some interesting new features.

The server and client can be installed using the following commands:

apt-get -y install mariadb-server mariadb-client

As soon as the installation is finished, we should directly assign a root password for the database and make a few security settings. You can do this with the following command:

mysql_secure_installation

You are now asked a few questions. It starts with the password and ends with the question, if you want to load the currently used settings directly. Here are our answers to the individual questions:

Enter current password for root (enter for none): <== Your Root Password
Set root password? [Y/n] <== y (yes)
New password: <== Here you have to enter your new password
Re-enter new password: <== Confirm Password
Remove anonymous users? [Y/n] <== Yes, delete
Disallow root login remotely? [Y/n] <==Yes, prohibit
Remove test database and access to it? [Y/n] <== Yes, we do not need the test table
Reload privilege tables now? [Y/n] <== Yes, reload

If you want to test briefly whether everything has worked out, you can do this with the following command:

mysql -u root -p

gridscale MariaDB installed

With exit you can leave the MySQL client again

Installing PHP 7

You can also install PHP 7 with the command:

apt-get -y install php7.0 libapache2-mod-php7.0

Now restart the web server and then everything should work:

systemctl restart apache2

However, in order to check whether PHP 7 is actually installed and working, create an infotype .php file and display the current PHP settings.

To do this, go to the Apache Standard Web Root folder:

cd /var/www/html/
nano info.php

Write the following in the info.php file:

<?php phpinfo(); ?>

Use Ctrl + X to save and close the file.

If you now add /info.php to our IP address in the browser, you can see if PHP 7 has been installed and if everything has worked out.

gridscale PHP7 installed

What is still missing is the MariaDB / MySQL package for PHP. We can also install this with a command:

apt-get -y install php7.0-mysql

When the installation is finished, you should restart the web server again:

systemctl restart apache2

Now the MySQL package should also appear in the info.php file. Search for„mysql“ in the /info.php page.

Finished! Wasn’t that a quick LAMP server install? 🙂


PS: If you often use LAMP servers, you can save the installation at gridscale as a template by first creating a snapshot from the storage and then converting it to a template.

Create Snapshot

What is a LAMP server? A LAMP server is probably the best known server installation, as it is set up with with Linux, Apache, MySQL and PHP – the ideal starting situation for the most widespread CMS systems, such as WordPress, Drupal or Typo3. Before you can start the installation, you have to create a […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema Install WordPress on Ubuntu or Debian?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you