How to Install LAMP on Ubuntu and Linux Mint 18

In this academic we will teach you a way to install LAMP stack earlier than progressing to Install WordPress

Step 1: Install Apache Web Server

Install the Apache web server and sort inside the command shown under.

$ sudo apt-get install apache2 apache2-utils

You will want to enable Apache2 net server for it to start up at system boot time and, as nicely, startup the provider as follows.

$ sudo systemctl enable apache2
$ sudo systemctl start apache2

To take a look at if the server is strolling, open up your browser and input the subsequent: ‘http://server_address’. The Apache2 default web page will show up if the net server is up and strolling. Remember: The Apache default root listing is positioned in ‘/var/www/html’, and all of your internet documents will be saved in this listing.

Step 2: Install MySQL Database Server

For this subsequent step, you ought to deploy the MySQL database server by typing within the following command.

$ sudo apt-get install mysql-client mysql-server

While the package deal is being set up, you will be induced to pick the basis person password for MySQL. Type in a relaxed password earlier than pressing the OK button twice to maintain similarly. The database server deployment isn’t always quite secure but. For that cause, type inside the beneath command to maximize its safety.

$ sudo mysql_secure_installation

First, you’ll be requested to install the ‘validate_password’ plugin. You will need to type in ‘Y/Yes’ and press Enter in addition to selecting the default password electricity level. It is essential to note that, in case you do now not want to alternate the basis password, type ’N/No’ while requested to do so. Answer ‘Y/Yes’ for the subsequent next questions.

Step 3: Install LAMP,Install PHP and Modules

For this step, set up PHP and some other modules in order for it to work with the web and database servers the usage of the below command.

$ sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-cli php7.0-cgi php7.0-gd

Next, to test if personal home page is working in conjunction with the internet server, you will ought to create an ‘information.Personal home page’ document interior ‘/var/www/html’.

$ sudo vi /var/www/html/info.php

Copy & paste the subsequent command into the document, save it and go out.

<?php
phpinfo();
?>

When you’re done with that, open the web browser and sort in the address ‘http://your_server_address/data.Personal home page’. You will be capable of view the php data web page underneath as affirmation.

Step 4: Install LAMP,Install WordPress CMS

In this step you will need to download the contemporary WordPress bundle and extract it by way of typing the following commands into the terminal.

$ wget -c http://wordpress.org/latest.tar.gz
$ tar -xzvf latest.tar.gz

Next, flow the WordPress documents from the extracted folder to the Apache default root directory ‘/var/www/html/‘. Then, set the proper permissions on the internet site directory so one can give ownership of the WordPress documents to the net server as shown inside the following command.

$ sudo chown -R www-data:www-data /var/www/html/
$ sudo chmod -R 755 /var/www/html/

Step 5: Create WordPress Database

Type in the command below and the root person password, then press Enter to pass to the MySQL shell.

$ mysql -u root -p

In the MySQL shell, you will need to kind in the underneath commands before pressing ‘Enter’ after every line of a MySQL command. Do not forget to use your personal, accurate, values for ‘database_name’, ‘databaseuser’, as well using a sturdy and comfortable password as opposed to ‘databaseuser_password’.

mysql> CREATE DATABASE wp_myblog;
mysql> GRANT ALL PRIVILEGES ON wp_myblog.* TO 'your_username_here'@'localhost' IDENTIFIED BY 'your_chosen_password_here';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Move to the ‘/var/www/html/‘ listing and rename the present. Wp-config-sample.Hypertext Preprocessor to wp-config.Php:

$ sudo mv wp-config-sample.php wp-config.php

Then, update your database facts inside the MySQL settings segment.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Next, restart the web server and MySQL service with the following command.

$ sudo systemctl restart apache2.service
$ sudo systemctl restart mysql.service

Open your browser and visit your server cope with: ‘http://server-deal with’ and you may get the welcome web page. Read the web page and then click on ‘Let’s go!’ to head further and fill all requested information.