mirror of
https://github.com/clearlinux/clear-linux-documentation.git
synced 2026-11-21 19:15:51 +00:00
Merge pull request #133 from deb-intel/webserverinstall-edits
Webserverinstall edits
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 27 KiB |
@@ -1,91 +1,77 @@
|
||||
.. _web-server-install:
|
||||
|
||||
Creating a Clear Linux based web server
|
||||
Create a Clear Linux based web server
|
||||
#######################################
|
||||
|
||||
Prerequisites
|
||||
*************
|
||||
This tutorial shows you how to create a LAMP server on |CL| and how to use
|
||||
phpMyAdmin to manage an associated database.
|
||||
|
||||
In order to create a web server using |CL| as the host OS your host
|
||||
system must be running |CL|. Therefore, this tutorial assumes you have
|
||||
already gone through the :ref:`bare metal installation<bare-metal-install>`
|
||||
instructions.
|
||||
In order to create a web server using |CL| as the host OS, your host system must be running |CL|. This tutorial assumes you have successfully installed :ref:`Clear Linux on bare metal<bare-metal-install>`.
|
||||
|
||||
Before installing any new packages, update the |CL| OS with the
|
||||
console command:
|
||||
Before you install new packages, update the |CL| OS with the following console command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo swupd update
|
||||
|
||||
Creating a LAMP Server
|
||||
Create a LAMP Server
|
||||
**********************
|
||||
|
||||
A server with Linux\*, Apache\*, MySQL\*, and PHP\* installed is known as a
|
||||
LAMP server, allows you to set up a fully functional web server, and enables
|
||||
you to host your own website. This tutorial walks you through the process of
|
||||
creating a LAMP server by installing and configuring each component. In place
|
||||
of MySQL, we will be installing MariaDB which is a drop- in replacement for
|
||||
MySQL. Once the LAMP server component installations are complete, we add
|
||||
phpMyAdmin to manage your MariaDB databases.
|
||||
A LAMP server uses Linux\*, Apache\*, MySQL\*, and PHP\* to set up a fully functional web server and host a website. Note that this tutorial installs MariaDB, which is a drop-in replacement for MySQL.
|
||||
|
||||
Installing Apache
|
||||
This tutorial follows these steps:
|
||||
|
||||
* Install Apache.
|
||||
* Change the default configuration and data directory.
|
||||
* Install PHP.
|
||||
* Install MariaDB.
|
||||
* Install phpMyAdmin and create a database.
|
||||
|
||||
Install Apache
|
||||
*****************
|
||||
|
||||
Apache is an open source HTTP web server application. It can run on several
|
||||
operating systems, including |CL|. Alternatively, you could install
|
||||
NGINX but this tutorial focuses on implementing an Apache server.
|
||||
Go to https://httpd.apache.org/ to learn more about it.
|
||||
Apache is an open source HTTP web server application that can run on several operating systems, including |CL|. Go to the `Apache HTTP Server Project`_ for more information.
|
||||
|
||||
Install the web-server-basic bundle
|
||||
===================================
|
||||
|
||||
The web-server-basic bundle contains the packages needed to install the
|
||||
Apache software bundle on |CL|.
|
||||
The web-server-basic bundle contains the packages needed to install the Apache software bundle on |CL|.
|
||||
|
||||
To install the bundle, enter the following command:
|
||||
#. To install the bundle, enter the following command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo swupd bundle-add web-server-basic
|
||||
sudo swupd bundle-add web-server-basic
|
||||
|
||||
|
||||
To start the Apache service, enter the following commands:
|
||||
#. To start the Apache service, enter the following commands:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo systemctl enable httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
sudo systemctl enable httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
|
||||
|
||||
To verify that the Apache server application is running, go to your web
|
||||
browser and navigate to: http://localhost
|
||||
#. To verify that the Apache server application is running, open a web browser and navigate to: http://localhost.
|
||||
|
||||
If the service is running you will see the message "This web server is
|
||||
operational from host." on your browser as shown in figure 1.
|
||||
If the service is running, a confirmation message appears, as shown in figure 1.
|
||||
|
||||
.. figure:: figures/web-server-install-1.png
|
||||
:alt: This web server is operational from host.
|
||||
:scale: 50%
|
||||
:alt: This web server is operational from host.
|
||||
:scale: 50%
|
||||
|
||||
Confirmation the Apache service is running.
|
||||
`Figure 1: Confirmation that the Apache service is running.`
|
||||
|
||||
The :file:`index.html` file is located in the :file:`/var/www/html`
|
||||
directory of your host system. We will copy this file into a new location
|
||||
after we modify the configuration.
|
||||
.. note::
|
||||
|
||||
The :file:`index.html` file is located in the :file:`/var/www/html` directory of your host system. You will copy this file into a new location after you modify the configuration in the next step.
|
||||
|
||||
Change the default configuration and data directory
|
||||
***************************************************
|
||||
|
||||
|CL| is designed to be a stateless operating system which means that you will
|
||||
need to create an optional configuration file to make changes over the default
|
||||
values. The default location of the Apache configuration file,
|
||||
:file:`httpd.conf`, is located in the :file:`/usr/share/defaults/httpd`
|
||||
directory. |CL| can overwritte this directory as part of the stateless
|
||||
paradigm. This default :file:`.conf` file includes the following directives
|
||||
that allow for additional locations of configuration definitions:
|
||||
|CL| is designed to be a stateless operating system which means that you must create an optional configuration file to make changes over the default values. The default location of the Apache configuration file, :file:`httpd.conf`, is located in the :file:`/usr/share/defaults/httpd` directory. |CL| can overwrite this directory as part of the stateless paradigm. This default :file:`.conf` file includes the following directives that allow for additional locations of configuration definitions:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
# Virtual hosts
|
||||
IncludeOptional /usr/share/defaults/httpd/conf.d/*.conf
|
||||
@@ -93,387 +79,348 @@ that allow for additional locations of configuration definitions:
|
||||
IncludeOptional /etc/httpd/conf.d/*.conf
|
||||
IncludeOptional /etc/httpd/conf.modules.d/*.conf
|
||||
|
||||
For this tutorial, we will create the directory structure for :file:`/etc/httpd/conf.d`
|
||||
and then create the :file:`httpd.conf` file within :file:`/etc/httpd/conf.d` directory and
|
||||
include the variable ``DocumentRoot``.
|
||||
This tutorial follows these steps:
|
||||
|
||||
Using your favorite editor, copy the content listed below into the new file
|
||||
:file:`/etc/httpd/conf.d/httpd.conf`.
|
||||
* Create the directory structure for :file:`/etc/httpd/conf.d`.
|
||||
* Create the :file:`httpd.conf` file within :file:`/etc/httpd/conf.d` directory.
|
||||
* Add the ``DocumentRoot`` variable to :file:`httpd.conf`.
|
||||
|
||||
.. code-block:: console
|
||||
Open a text editor and perform the following:
|
||||
|
||||
#
|
||||
# Set a new location for DocumentRoot
|
||||
#
|
||||
DocumentRoot "/var/www/tutorial"
|
||||
|
||||
#
|
||||
# Relax access to content within /var/www/tutorial for this example
|
||||
#
|
||||
<Directory "/var/www/tutorial">
|
||||
AllowOverride none
|
||||
Require all granted
|
||||
</Directory>
|
||||
#. Copy the content listed below into the new file :file:`/etc/httpd/conf.d/httpd.conf`.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#
|
||||
# Set a new location for DocumentRoot
|
||||
#
|
||||
DocumentRoot "/var/www/tutorial"
|
||||
|
||||
#
|
||||
# Relax access to content within /var/www/tutorial for this example
|
||||
#
|
||||
<Directory "/var/www/tutorial">
|
||||
AllowOverride none
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
|
||||
Finally, let’s create the new ``DocumentRoot`` directory structure and copy the
|
||||
:file:`index.html` file from :file:`/var/www/html` directory to
|
||||
:file:`/var/www/tutorial`.
|
||||
#. Create a new ``DocumentRoot`` directory structure and copy the :file:`index.html` file from :file:`/var/www/html` directory to :file:`/var/www/tutorial`.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo mkdir –p /var/www/tutorial
|
||||
cd /var/www/tutorial
|
||||
sudo cp /var/www/html/index.html .
|
||||
sudo mkdir –p /var/www/tutorial
|
||||
cd /var/www/tutorial
|
||||
sudo cp /var/www/html/index.html .
|
||||
|
||||
|
||||
To make sure that we have everything set correctly, let’s edit the new
|
||||
:file:`index.html` file with your editor and change the text from
|
||||
"This web server is operational from host." to
|
||||
"This web server is operational from its new location.".
|
||||
#. To ensure a successful setup, edit the new :file:`index.html` file. Change the original text from
|
||||
|
||||
With the new configuration files in place, you will need to stop and then
|
||||
restart the ``httpd.service``.
|
||||
"This web server is operational from host."
|
||||
|
||||
.. code-block:: console
|
||||
to
|
||||
|
||||
sudo systemctl stop httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
"This web server is operational from its new location."
|
||||
|
||||
#. Stop and then restart ``httpd.service``.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo systemctl stop httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
|
||||
|
||||
Now when you go to http://localhost you should see your new screen.
|
||||
#. Go to http://localhost to view the new screen.
|
||||
|
||||
To continue, we must change the configuration back to the default
|
||||
:file:`/var/www/html` location. To do this, edit the
|
||||
:file:`/etc/httpd/conf.d/httpd.conf` file again and replace any instance of
|
||||
/var/www/tutorial with /var/www/html.
|
||||
#. Change the configuration back to the default :file:`/var/www/html` location. To do this, edit the :file:`/etc/httpd/conf.d/httpd.conf` file again and replace any instance of /var/www/tutorial with /var/www/html.
|
||||
|
||||
Then, stop and then restart the ``httpd.service``.
|
||||
#. Stop and then restart ``httpd.service``.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo systemctl stop httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
sudo systemctl stop httpd.service
|
||||
sudo systemctl start httpd.service
|
||||
|
||||
On http://localhost, you should see the default screen again.
|
||||
#. Go to http://localhost and verify that you can see the default screen again.
|
||||
|
||||
Optionally, remove the /var/www/tutorial directory previously created.
|
||||
Optionally, remove the /var/www/tutorial directory you previously created.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo rm /var/www/tutorial/index.html
|
||||
sudo rmdir /var/www/tutorial
|
||||
sudo rm /var/www/tutorial/index.html
|
||||
sudo rmdir /var/www/tutorial
|
||||
|
||||
Installing PHP
|
||||
Install PHP
|
||||
**************
|
||||
|
||||
With Apache installed, you can display static web pages. However, enabling
|
||||
PHP allows dynamic webpages to be generated and displayed. To add this
|
||||
functionality to your web server we need to install PHP on your system.
|
||||
An Apache installation allows you to display static web pages. Enabling PHP allows you to generate and display dynamic web pages. To add this functionality to your web server, install PHP on your system.
|
||||
|
||||
To get the php components, enter the following command:
|
||||
#. To get the php components, enter the following command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo swupd bundle-add php-basic
|
||||
sudo swupd bundle-add php-basic
|
||||
|
||||
To enable PHP, enter the following commands:
|
||||
#. To enable PHP, enter the following commands:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo systemctl enable php-fpm.service
|
||||
sudo systemctl start php-fpm.service
|
||||
sudo systemctl restart httpd.service
|
||||
sudo systemctl enable php-fpm.service
|
||||
sudo systemctl start php-fpm.service
|
||||
sudo systemctl restart httpd.service
|
||||
|
||||
After restarting the Apache service, we can test our PHP installation.
|
||||
After restarting the Apache service, test your PHP installation.
|
||||
|
||||
1. Create a file named :file:`phpinfo.php` in the
|
||||
:file:`/var/www/html/` directory using your editor.
|
||||
#. Create a file named :file:`phpinfo.php` in the
|
||||
:file:`/var/www/html/` directory using a text editor.
|
||||
|
||||
2. Add the following line to the file:
|
||||
#. Add the following line to the file:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?PHP phpinfo() ?>
|
||||
|
||||
3. Go to http://localhost/phpinfo.php using your browser.
|
||||
#. Go to http://localhost/phpinfo.php.
|
||||
|
||||
The PHP information screen should appear, see figure 2:
|
||||
#. Verify that the PHP information screen appears, as shown in figure 2:
|
||||
|
||||
.. figure:: figures/web-server-install-2.png
|
||||
:alt: PHP information screen
|
||||
:width: 600
|
||||
|
||||
The PHP information screen.
|
||||
`Figure 2: The PHP information screen.`
|
||||
|
||||
If the PHP information screen is displayed, you have successfully installed
|
||||
the PHP components and are now ready to add your database application to
|
||||
complete your LAMP server implementation.
|
||||
If the PHP information screen is displayed, you have successfully installed the PHP components and are now ready to add your database application to complete your LAMP server implementation.
|
||||
|
||||
Installing MariaDB
|
||||
Install MariaDB
|
||||
******************
|
||||
|
||||
Most web applications require a database to store their content. Therefore,
|
||||
we must install MariaDB to fulfill this need. MariaDB is a drop-in
|
||||
replacement for MySQL and is available in the database-basic |CL|
|
||||
bundle.
|
||||
Install MariaDB to store content. MariaDB is a drop-in replacement for MySQL and is available in the database-basic |CL| bundle.
|
||||
|
||||
To install the database-basic bundle, enter the following command:
|
||||
#. To install the database-basic bundle, enter the following command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo swupd bundle-add database-basic
|
||||
sudo swupd bundle-add database-basic
|
||||
|
||||
Once MariaDB is installed, we need to start the service and check its status.
|
||||
#. To start MariaDB after it is installed, enter the following commands:
|
||||
|
||||
To start MariaDB, enter the following commands:
|
||||
.. code-block:: bash
|
||||
|
||||
.. code-block:: console
|
||||
sudo systemctl enable mariadb
|
||||
sudo systemctl start mariadb
|
||||
|
||||
sudo systemctl enable mariadb
|
||||
sudo systemctl start mariadb
|
||||
#. To check the status of MariaDB, enter the following command:
|
||||
|
||||
To check the status of MariaDB, enter the following command:
|
||||
.. code-block:: bash
|
||||
|
||||
.. code-block:: console
|
||||
sudo systemctl status mariadb
|
||||
|
||||
sudo systemctl status mariadb
|
||||
Security Hardening
|
||||
------------------
|
||||
|
||||
With the MariaDB service running, we can perform some basic security
|
||||
hardening.
|
||||
With the MariaDB service running, we can perform some basic security hardening.
|
||||
|
||||
To add a basic layer of security, enter the following command and answer the
|
||||
questions presented:
|
||||
#. To add a basic layer of security, enter the following command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
mysql_secure_installation
|
||||
mysql_secure_installation
|
||||
|
||||
.. note:: We have included the answers after each question.
|
||||
#. Respond to the questions that appear in the script below. Note that our suggested responses follow each question.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
Enter current password for root (enter for none):
|
||||
Enter current password for root (enter for none):
|
||||
|
||||
In order to secure the MariaDB, we need the current password for the root
|
||||
user. For a newly installed MariaDB without a set root password, the
|
||||
password is blank. Just press enter to continue.
|
||||
In order to secure MariaDB, we need the current password for the root user. For a newly installed MariaDB without a set root password, the password is blank. Thus, press enter to continue.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
OK, successfully used password, moving on...
|
||||
OK, successfully used password, moving on...
|
||||
|
||||
Set root password? [Y/n]
|
||||
Set root password? [Y/n]
|
||||
|
||||
.. _set-password:
|
||||
.. _set-password:
|
||||
|
||||
Setting the root password ensures nobody can log into the MariaDB
|
||||
as a root user without the proper authorization.
|
||||
Set the root password to prevent unauthorized MariaDB root user logins. To set a root password, type 'y'.
|
||||
|
||||
To set a root password, type 'y'.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
New password:
|
||||
|
||||
Type the desired password for the root user.
|
||||
Type the desired password for the root user.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
Re-enter new password:
|
||||
Re-enter new password:
|
||||
|
||||
Re-type the desired password for the root user.
|
||||
Re-type the desired password for the root user.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
Password updated successfully!
|
||||
Reloading privilege tables..
|
||||
... Success!
|
||||
Password updated successfully!
|
||||
Reloading privilege tables..
|
||||
... Success!
|
||||
|
||||
Remove anonymous users? [Y/n]
|
||||
Remove anonymous users? [Y/n]
|
||||
|
||||
By default, a MariaDB installation has an anonymous user allowing anyone to
|
||||
log into MariaDB without a user account. This anonymous user is intended only
|
||||
for testing and for a smoother the installation.
|
||||
By default, a MariaDB installation includes an anonymous user that allows anyone to log in to MariaDB without a user account. This anonymous user is intended only for testing and for a smoother installation. To remove the anonymous user and make your database more secure, type 'y'.
|
||||
|
||||
To remove the anonymous user and make your database more secure, type 'y'.
|
||||
.. code-block:: bash
|
||||
|
||||
.. code-block:: console
|
||||
... Success!
|
||||
Disallow root login remotely? [Y/n]
|
||||
|
||||
... Success!
|
||||
Disallow root login remotely? [Y/n]
|
||||
Normally, root should only be allowed to connect from the 'localhost'. This ensures that someone cannot guess the root password from the network. To block any remote root login, type 'y'.
|
||||
|
||||
Normally, root should only be allowed to connect from the 'localhost'.
|
||||
This ensures that someone cannot guess at the root password from the network.
|
||||
.. code-block:: bash
|
||||
|
||||
To block any remote root login, type 'y'.
|
||||
... Success!
|
||||
Remove test database and access to it? [Y/n]
|
||||
|
||||
.. code-block:: console
|
||||
By default, MariaDB includes a database named 'test' which anyone can access. This database is also intended only for testing and should be removed. To remove the test database, type 'y'.
|
||||
|
||||
... Success!
|
||||
Remove test database and access to it? [Y/n]
|
||||
.. code-block:: bash
|
||||
|
||||
By default, MariaDB comes with a database named 'test' which anyone can
|
||||
access. This database is also intended only for testing and should be
|
||||
removed.
|
||||
- Dropping test database...
|
||||
... Success!
|
||||
- Removing privileges on test database...
|
||||
... Success!
|
||||
Reload privilege tables now? [Y/n]
|
||||
|
||||
To remove the test database, type 'y'.
|
||||
Reloading the privilege tables ensures all changes made so far take effect immediately. To reload the privilege tables, type 'y'.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
- Dropping test database...
|
||||
... Success!
|
||||
- Removing privileges on test database...
|
||||
... Success!
|
||||
Reload privilege tables now? [Y/n]
|
||||
... Success!
|
||||
|
||||
Reloading the privilege tables ensures all changes made so far take effect
|
||||
immediately.
|
||||
|
||||
To reload the privilege tables, type 'y'.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
... Success!
|
||||
|
||||
Cleaning up...
|
||||
Cleaning up...
|
||||
|
||||
All done! If you've completed all of the above steps, your MariaDB
|
||||
installation should now be secure.
|
||||
|
||||
Thanks for using MariaDB!
|
||||
|
||||
The MariaDB installation is complete and we can now install phpMyAdmin to
|
||||
manage the databases.
|
||||
The MariaDB installation is complete and we can now install phpMyAdmin to manage the databases.
|
||||
|
||||
Installing phpMyAdmin
|
||||
Install phpMyAdmin
|
||||
*********************
|
||||
|
||||
The web-based tool phpMyAdmin is a straight-forward way to manage MySQL or
|
||||
MariaDB databases. Visit https://www.phpmyadmin.net for the complete
|
||||
discussion regarding phpMyAdmin, its documentation, the latest downloads, and
|
||||
other useful information.
|
||||
The web-based tool phpMyAdmin is a straightforward way to manage MySQL or MariaDB databases. Visit the `phpMyAdmin`_ website for the complete discussion regarding phpMyAdmin, its documentation, the latest downloads, and other useful information.
|
||||
|
||||
This tutorial uses the latest English version of phpMyAdmin to install it on
|
||||
our |CL| host system.
|
||||
This tutorial uses the latest English version of phpMyAdmin to install it on our |CL| host system.
|
||||
|
||||
1. Download the :file:`phpMyAdmin-<version>-english.tar.gz` file to your
|
||||
#. Download the :file:`phpMyAdmin-<version>-english.tar.gz` file to your
|
||||
:file:`~/Downloads` directory. Here, <version> refers to the current
|
||||
version available at https://www.phpmyadmin.net/downloads.
|
||||
|
||||
.. note:: This example downloads and uses version 4.6.4.
|
||||
.. note::
|
||||
|
||||
2. Once the file has been successfully downloaded and verified, uncompress
|
||||
the file and directories into the apache web server document root
|
||||
This example downloads and uses version 4.6.4.
|
||||
|
||||
#. Once the file has been successfully downloaded and verified, uncompress
|
||||
the file and directories into the Apache web server document root
|
||||
directory. Use the following commands:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
cd /var/www/html
|
||||
sudo tar –xzvf ~/Downloads/phpMyAdmin-4.6.4-english.tar.gz
|
||||
cd /var/www/html
|
||||
sudo tar –xzvf ~/Downloads/phpMyAdmin-4.6.4-english.tar.gz
|
||||
|
||||
3. To keep things simple, rename the newly created
|
||||
#. To keep things simple, rename the newly created
|
||||
:file:`phpMyAdmin-4.6.4-english` directory to :file:`phpMyAdmin` with the
|
||||
following command:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: bash
|
||||
|
||||
sudo mv phpMyAdmin-4.6.4-english phpMyAdmin
|
||||
sudo mv phpMyAdmin-4.6.4-english phpMyAdmin
|
||||
|
||||
Using phpMyAdmin to Manage Databases
|
||||
Use phpMyAdmin to Manage Databases
|
||||
====================================
|
||||
|
||||
If you have successfully installed all of the components for your LAMP
|
||||
server, you should be able to point your browser to
|
||||
http://localhost/phpMyAdmin and see the screen shown in figure 3 in your
|
||||
browser window.
|
||||
You can use the phpMyAdmin web-based tool to manage your databases. Follow the steps below for setting up a database called Wordpress.
|
||||
|
||||
.. figure:: figures/web-server-install-3.png
|
||||
:alt: phpMyAdmin login page
|
||||
:width: 600
|
||||
#. Verify that a successful installation of all LAMP server components by going to http://localhost/phpMyAdmin. See figure 3.
|
||||
|
||||
The `phpMyAdmin` login page after successful installation.
|
||||
#. Log in with your root userid and the password you set up when you ran the :ref:`mysql_secure_installation command <set-password>`. Enter your credentials and select :guilabel:`Go` to log in:
|
||||
|
||||
.. figure:: figures/web-server-install-3.png
|
||||
:alt: phpMyAdmin login page
|
||||
:width: 600
|
||||
|
||||
`Figure 3: The phpMyAdmin login page.`
|
||||
|
||||
|
||||
Log in with your root userid and the password you set up when you ran the
|
||||
:ref:`mysql_secure_installation command <set-password>`. Enter your
|
||||
credentials and select :guilabel:`Go` to log in:
|
||||
#. Verify a successful login by confirming that the main phpMyAdmin page displays, as shown in figure 4:
|
||||
|
||||
Once logged in the main phpMyAdmin page is displayed as shown on figure 4:
|
||||
.. figure:: figures/web-server-install-4.png
|
||||
:alt: phpMyAdmin dashboard
|
||||
:width: 600
|
||||
|
||||
.. figure:: figures/web-server-install-4.png
|
||||
:alt: phpMyAdmin dashboard
|
||||
:width: 600
|
||||
`Figure 4: The phpMyAdmin dashboard.`
|
||||
|
||||
The `phpMyAdmin` dashboard after successful login.
|
||||
|
||||
Our next step is to set up our first database. For example, we can call
|
||||
our new database WordPress.
|
||||
#. Set up a database by selecting the :guilabel:`Databases` tab, as shown in figure 5.
|
||||
|
||||
1. Select the :guilabel:`Databases` tab in the phpMyAdmin main screen to go
|
||||
to the Databases page. Figure 5 shows the databases tab.
|
||||
|
||||
.. figure:: figures/web-server-install-5.png
|
||||
:alt: Databases tab
|
||||
:width: 600
|
||||
|
||||
The `Databases` tab of `phpMyAdmin`.
|
||||
|
||||
2. Enter 'WordPress'. in the text field below the :guilabel:`Create database`
|
||||
#. Enter `WordPress` in the text field below the :guilabel:`Create database`
|
||||
label.
|
||||
|
||||
3. Pick the :guilabel:`utf8_unicode_ci` option from the collation drop-down
|
||||
menu beside the text field.
|
||||
#. Select the :guilabel:`utf8_unicode_ci` option from the :guilabel:`Collation` drop-down menu beside the text field.
|
||||
|
||||
4. Press the :guilabel:`Create` button.
|
||||
#. Click :guilabel:`Create`.
|
||||
|
||||
Once the database is created, we need to set up the user permissions.
|
||||
.. figure:: figures/web-server-install-5.png
|
||||
:alt: Databases tab
|
||||
:width: 600
|
||||
|
||||
1. Select the WordPress database in the left panel.
|
||||
`Figure 5: The Databases tab.`
|
||||
|
||||
2. Select the :guilabel:`Privileges` tab. Figure 6 shows the contents of the
|
||||
tab.
|
||||
|
||||
#. Set up user permissions by selecting the :guilabel:`WordPress` database located in the left panel. See figure 6.
|
||||
|
||||
#. Select the :guilabel:`Privileges` tab. Figure 6 shows its contents.
|
||||
|
||||
.. figure:: figures/web-server-install-6.png
|
||||
:alt: Privileges tab
|
||||
:width: 600
|
||||
:alt: Privileges tab
|
||||
:width: 600
|
||||
|
||||
The `Privileges` tab of `phpMyAdmin`
|
||||
`Figure 6: The Privileges tab.`
|
||||
|
||||
3. Click on :guilabel:`Add user account`
|
||||
#. Click :guilabel:`Add user account` located at the bottom of the :guilabel:`Privileges` tab. The `Add user account` page appears, as shown in figure 7.
|
||||
|
||||
.. figure:: figures/web-server-install-7.png
|
||||
:alt: User accounts tab
|
||||
:width: 600
|
||||
:alt: User accounts tab
|
||||
:width: 600
|
||||
|
||||
The `User accounts` tab showing all the required information entered
|
||||
in the next steps.
|
||||
`Figure 7: The User accounts tab.`
|
||||
|
||||
4. Enter the following information in the corresponding fields:
|
||||
#. Enter the following information in the corresponding fields that appear in figure 7 above:
|
||||
|
||||
User name: wordpressuser
|
||||
* User name: wordpressuser
|
||||
|
||||
Password: wp-example
|
||||
* Password: wp-example
|
||||
|
||||
Re-type: wp-example
|
||||
* Re-type: wp-example
|
||||
|
||||
5. In the Database for user account section, select the option
|
||||
:guilabel:`Grant all privileges on database “WordPress”.`
|
||||
#. In the `Database for user account` section, select :guilabel:`Grant all privileges on database “WordPress”.`
|
||||
|
||||
6. At the bottom of the page and select :guilabel:`Go`.
|
||||
#. At the bottom of the page, click :guilabel:`Go`.
|
||||
|
||||
If successful, you should see the screen shown in figure 8:
|
||||
|
||||
.. figure:: figures/web-server-install-8.png
|
||||
:alt: User added successfully
|
||||
:width: 600
|
||||
:alt: User added successfully
|
||||
:width: 600
|
||||
|
||||
The user **wordpressuser** was added successfully.
|
||||
`Figure 8: The user wordpressuser is successfully added.`
|
||||
|
||||
Congratulations!
|
||||
**Congratulations!**
|
||||
|
||||
You have now created a fully functional LAMP server along with a WordPress-
|
||||
ready database using |CL|.
|
||||
You have now created a fully functional LAMP server along with a WordPress-ready database using |CL|.
|
||||
|
||||
As a next step, you could :ref:`create a WordPress server <wp-install>`
|
||||
and present it to the world.
|
||||
As a next step, you could :ref:`create a WordPress server <wp-install>` and present it to the world.
|
||||
|
||||
|
||||
.. _Apache HTTP Server Project: https://httpd.apache.org/
|
||||
.. _phpMyAdmin: https://www.phpmyadmin.net/
|
||||
Reference in New Issue
Block a user