mirror of
https://github.com/clearlinux/clear-linux-documentation.git
synced 2026-04-29 03:23:42 +00:00
588 lines
33 KiB
HTML
588 lines
33 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>LAMP Web Server — Documentation for Clear Linux* project</title>
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/bizstyle.css?v=5283bb3d" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
|
||
|
||
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
|
||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="../_static/copybutton.js?v=a56c686a"></script>
|
||
<script src="../_static/bizstyle.js"></script>
|
||
<link rel="canonical" href="https://clearlinux.github.io/clear-linux-documentation/tutorials/lamp-server.html" />
|
||
<link rel="icon" href="../_static/favicon.ico"/>
|
||
<link rel="author" title="About these documents" href="../about.html" />
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="Mirror Upstream Clear Linux OS Update Server" href="mirror-upstream-server.html" />
|
||
<link rel="prev" title="Kubernetes* Best Practices" href="kubernetes-bp.html" />
|
||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||
<!--[if lt IE 9]>
|
||
<script src="_static/css3-mediaqueries.js"></script>
|
||
<![endif]-->
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="mirror-upstream-server.html" title="Mirror Upstream Clear Linux OS Update Server"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="kubernetes-bp.html" title="Kubernetes* Best Practices"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Documentation for Clear Linux* project</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Tutorials</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">LAMP Web Server</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="lamp-web-server">
|
||
<span id="lamp-server-install"></span><h1>LAMP Web Server<a class="headerlink" href="#lamp-web-server" title="Link to this heading">¶</a></h1>
|
||
<p>This tutorial provides instructions on how to set up a
|
||
<abbr title="Linux*, Apache*, MySQL*, PHP">LAMP</abbr> web server on Clear Linux* OS and how
|
||
to use phpMyAdmin* to manage an associated database. Note that this
|
||
tutorial installs MariaDB*, which is a drop-in replacement for MySQL*.</p>
|
||
<p>In order to create a web server using Clear Linux OS as the host OS, your host system
|
||
must be running Clear Linux OS. This tutorial assumes you have installed Clear Linux OS on your
|
||
host system. For detailed instructions on installing Clear Linux OS on a bare metal
|
||
system, visit <a class="reference internal" href="../get-started/bare-metal-install-desktop.html#bare-metal-install-desktop"><span class="std std-ref">Install Clear Linux* OS from the live desktop</span></a>.</p>
|
||
<p>This tutorial covers:</p>
|
||
<nav class="contents local" id="contents">
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="#install-apache" id="id9">Install Apache</a></p></li>
|
||
<li><p><a class="reference internal" href="#change-the-default-configuration-and-data-directory" id="id10">Change the default configuration and data directory</a></p></li>
|
||
<li><p><a class="reference internal" href="#install-php" id="id11">Install PHP</a></p></li>
|
||
<li><p><a class="reference internal" href="#install-mariadb" id="id12">Install MariaDB</a></p></li>
|
||
<li><p><a class="reference internal" href="#install-phpmyadmin" id="id13">Install phpMyAdmin</a></p></li>
|
||
<li><p><a class="reference internal" href="#use-phpmyadmin-to-manage-a-database" id="id14">Use phpMyAdmin to manage a database</a></p></li>
|
||
<li><p><a class="reference internal" href="#next-steps" id="id15">Next steps</a></p></li>
|
||
</ul>
|
||
</nav>
|
||
<section id="install-apache">
|
||
<h2><a class="toc-backref" href="#id9" role="doc-backlink">Install Apache</a><a class="headerlink" href="#install-apache" title="Link to this heading">¶</a></h2>
|
||
<p>Apache is an open source HTTP web server application that can run on several
|
||
operating systems, including Clear Linux OS. Go to the <a class="reference external" href="https://httpd.apache.org/">Apache HTTP Server Project</a>
|
||
for more information.</p>
|
||
<section id="install-the-httpd-bundle">
|
||
<h3>Install the httpd bundle<a class="headerlink" href="#install-the-httpd-bundle" title="Link to this heading">¶</a></h3>
|
||
<p>The <strong>httpd</strong> bundle contains the packages needed to install the
|
||
Apache software bundle on Clear Linux OS.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Before you install new packages, update the Clear Linux OS with the following
|
||
console command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>update
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<ol class="arabic">
|
||
<li><p>To install the bundle, enter the following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>httpd
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Start the Apache service and set it start automatically on boot,
|
||
enter the following commands:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>--now<span class="w"> </span>httpd.service
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To verify that the Apache server application is running, open a web
|
||
browser and navigate to: http://localhost.</p>
|
||
<p>If the service is running, a confirmation message will appear, similar to the
|
||
message shown in figure 1.</p>
|
||
<figure class="dropshadow align-default" id="id1">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-1.png"><img alt="This web server is operational from host." src="../_images/web-server-install-1.png" style="width: 640.5px; height: 136.5px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 1: Confirmation that the Apache service is running.</cite></span><a class="headerlink" href="#id1" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The <code class="file docutils literal notranslate"><span class="pre">index.html</span></code> file is located in the <code class="file docutils literal notranslate"><span class="pre">/var/www/html</span></code> directory
|
||
of your host system. You will copy this file into a new location after you
|
||
modify the configuration in the next step.</p>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
</section>
|
||
<section id="change-the-default-configuration-and-data-directory">
|
||
<h2><a class="toc-backref" href="#id10" role="doc-backlink">Change the default configuration and data directory</a><a class="headerlink" href="#change-the-default-configuration-and-data-directory" title="Link to this heading">¶</a></h2>
|
||
<p>Clear Linux OS is designed to be a <a class="reference internal" href="../guides/clear/stateless.html#stateless"><span class="std std-ref">Stateless</span></a> operating system which means that you
|
||
must create an optional configuration file to override the default values.
|
||
The default location of the Apache configuration file, <code class="file docutils literal notranslate"><span class="pre">httpd.conf</span></code>,
|
||
is located in the <code class="file docutils literal notranslate"><span class="pre">/usr/share/defaults/httpd</span></code> directory. Clear Linux OS can
|
||
override this directory as part of the stateless paradigm. This default
|
||
<code class="file docutils literal notranslate"><span class="pre">.conf</span></code> file includes the following directives that allow for additional
|
||
locations of configuration definitions:</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"># </span>Virtual<span class="w"> </span>hosts
|
||
<span class="go">IncludeOptional /usr/share/defaults/httpd/conf.d/*.conf</span>
|
||
<span class="go">IncludeOptional /usr/share/defaults/httpd/conf.modules.d/*.conf</span>
|
||
<span class="go">IncludeOptional /etc/httpd/conf.d/*.conf</span>
|
||
<span class="go">IncludeOptional /etc/httpd/conf.modules.d/*.conf</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>In this section you will define your own httpd.conf file to override the
|
||
default values, and define a custom DocumentRoot for your web server.</p>
|
||
<ol class="arabic">
|
||
<li><p>Create the directory structure for <code class="file docutils literal notranslate"><span class="pre">/etc/httpd/conf.d</span></code>.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/etc/httpd/conf.d
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Create and open the <code class="file docutils literal notranslate"><span class="pre">httpd.conf</span></code> file in your new <code class="file docutils literal notranslate"><span class="pre">/etc/httpd/conf.d</span></code>
|
||
directory.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>nano<span class="w"> </span>/etc/httpd/conf.d/httpd.conf
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Add the <code class="docutils literal notranslate"><span class="pre">DocumentRoot</span></code> variable to <code class="file docutils literal notranslate"><span class="pre">httpd.conf</span></code>. Copy the content
|
||
listed below into the new <code class="file docutils literal notranslate"><span class="pre">/etc/httpd/conf.d/httpd.conf</span></code> file.</p>
|
||
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">#</span>
|
||
<span class="gp"># </span>Set<span class="w"> </span>a<span class="w"> </span>new<span class="w"> </span>location<span class="w"> </span><span class="k">for</span><span class="w"> </span>DocumentRoot
|
||
<span class="gp">#</span>
|
||
<span class="go">DocumentRoot "/var/www/tutorial"</span>
|
||
|
||
<span class="gp">#</span>
|
||
<span class="gp"># </span>Relax<span class="w"> </span>access<span class="w"> </span>to<span class="w"> </span>content<span class="w"> </span>within<span class="w"> </span>/var/www/tutorial<span class="w"> </span><span class="k">for</span><span class="w"> </span>this<span class="w"> </span>example
|
||
<span class="gp">#</span>
|
||
<span class="go"><Directory "/var/www/tutorial"></span>
|
||
<span class="go"> AllowOverride none</span>
|
||
<span class="go"> Require all granted</span>
|
||
<span class="go"></Directory></span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Create a new <code class="docutils literal notranslate"><span class="pre">DocumentRoot</span></code> directory structure and copy the
|
||
<code class="file docutils literal notranslate"><span class="pre">index.html</span></code> file from <code class="file docutils literal notranslate"><span class="pre">/var/www/html</span></code> directory to
|
||
<code class="file docutils literal notranslate"><span class="pre">/var/www/tutorial</span></code>.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mkdir<span class="w"> </span>–p<span class="w"> </span>/var/www/tutorial
|
||
<span class="nb">cd</span><span class="w"> </span>/var/www/tutorial
|
||
sudo<span class="w"> </span>cp<span class="w"> </span>/var/www/html/index.html<span class="w"> </span>.
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To ensure a successful setup, edit the new <code class="file docutils literal notranslate"><span class="pre">index.html</span></code> file with an
|
||
obvious change.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>nano<span class="w"> </span>index.html
|
||
</pre></div>
|
||
</div>
|
||
<p>For example, we changed the default message</p>
|
||
<p>“It works!”</p>
|
||
<p>to</p>
|
||
<p>“It works from its new location!”</p>
|
||
</li>
|
||
<li><p>Restart <code class="docutils literal notranslate"><span class="pre">httpd.service</span></code>.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>restart<span class="w"> </span>httpd.service
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Go to http://localhost to view the new screen. You should see your updated
|
||
default message from step 5.</p></li>
|
||
<li><p>Change the configuration back to the default <code class="file docutils literal notranslate"><span class="pre">/var/www/html</span></code>
|
||
location. To do this, edit the <code class="file docutils literal notranslate"><span class="pre">/etc/httpd/conf.d/httpd.conf</span></code> file
|
||
again and replace any instance of /var/www/tutorial with /var/www/html.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>nano<span class="w"> </span>/etc/httpd/conf.d/httpd.conf
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Restart <code class="docutils literal notranslate"><span class="pre">httpd.service</span></code>.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>restart<span class="w"> </span>httpd.service
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Go to http://localhost and verify that you can see the default screen
|
||
again.</p></li>
|
||
<li><p>Optionally, remove the /var/www/tutorial directory you previously created.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>rm<span class="w"> </span>/var/www/tutorial/index.html
|
||
sudo<span class="w"> </span>rmdir<span class="w"> </span>/var/www/tutorial
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="install-php">
|
||
<h2><a class="toc-backref" href="#id11" role="doc-backlink">Install PHP</a><a class="headerlink" href="#install-php" title="Link to this heading">¶</a></h2>
|
||
<p>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.</p>
|
||
<ol class="arabic">
|
||
<li><p>To get the php components, enter the following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>php-basic
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To enable PHP and set it to start automatically on boot, enter the
|
||
following commands:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>--now<span class="w"> </span>php-fpm.service
|
||
sudo<span class="w"> </span>systemctl<span class="w"> </span>restart<span class="w"> </span>httpd.service
|
||
</pre></div>
|
||
</div>
|
||
<p>After restarting the Apache service, test your PHP installation.</p>
|
||
</li>
|
||
<li><p>Create and open a file named <code class="file docutils literal notranslate"><span class="pre">phpinfo.php</span></code> in the <code class="file docutils literal notranslate"><span class="pre">/var/www/html/</span></code>
|
||
directory using a text editor.</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>nano<span class="w"> </span>/var/www/html/phpinfo.php
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Add the following line to the file:</p>
|
||
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="cp"><?PHP</span> <span class="nb">phpinfo</span><span class="p">()</span> <span class="cp">?></span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Go to http://localhost/phpinfo.php.</p></li>
|
||
<li><p>Verify that the PHP information screen appears, similar to figure 2:</p>
|
||
<figure class="dropshadow align-default" id="id2">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-2.png"><img alt="PHP information screen" src="../_images/web-server-install-2.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 2: The PHP information screen.</cite></span><a class="headerlink" href="#id2" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
</ol>
|
||
<p>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.</p>
|
||
</section>
|
||
<section id="install-mariadb">
|
||
<h2><a class="toc-backref" href="#id12" role="doc-backlink">Install MariaDB</a><a class="headerlink" href="#install-mariadb" title="Link to this heading">¶</a></h2>
|
||
<p>Install MariaDB to store content. MariaDB is a drop-in replacement for MySQL
|
||
and is available in the database-basic Clear Linux OS bundle.</p>
|
||
<ol class="arabic">
|
||
<li><p>To install the database-basic bundle, enter the following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>swupd<span class="w"> </span>bundle-add<span class="w"> </span>mariadb
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To start MariaDB after it is installed and set it to start automatically on
|
||
boot, enter the following commands:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>--now<span class="w"> </span>mariadb
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To check the status of MariaDB, enter the following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>status<span class="w"> </span>mariadb
|
||
</pre></div>
|
||
</div>
|
||
<p>Press <kbd class="kbd docutils literal notranslate">Ctrl</kbd> + <kbd class="kbd docutils literal notranslate">c</kbd> or <kbd class="kbd docutils literal notranslate">q</kbd> to exit.</p>
|
||
</li>
|
||
</ol>
|
||
<section id="security-hardening">
|
||
<h3>Security hardening<a class="headerlink" href="#security-hardening" title="Link to this heading">¶</a></h3>
|
||
<p>With the MariaDB service running, we can perform some basic security
|
||
hardening.</p>
|
||
<ol class="arabic">
|
||
<li><p>To add a basic layer of security, enter the following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mysql_secure_installation
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Respond to the questions that appear in the script below.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>Our suggested responses follow each question.</p>
|
||
</div>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Enter current password for root (enter for none):
|
||
</pre></div>
|
||
</div>
|
||
<p>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.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>OK, successfully used password, moving on...
|
||
|
||
Set root password? [Y/n]
|
||
</pre></div>
|
||
</div>
|
||
<p id="set-password">Set the root password to prevent unauthorized MariaDB root user logins.
|
||
To set a root password, type ‘y’.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>New password:
|
||
</pre></div>
|
||
</div>
|
||
<p>Type the desired password for the root user.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Re-enter new password:
|
||
</pre></div>
|
||
</div>
|
||
<p>Re-type the desired password for the root user.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Password updated successfully!
|
||
Reloading privilege tables..
|
||
... Success!
|
||
|
||
Remove anonymous users? [Y/n]
|
||
</pre></div>
|
||
</div>
|
||
<p>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’.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>... Success!
|
||
Disallow root login remotely? [Y/n]
|
||
</pre></div>
|
||
</div>
|
||
<p>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’.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>... Success!
|
||
Remove test database and access to it? [Y/n]
|
||
</pre></div>
|
||
</div>
|
||
<p>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’.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>- Dropping test database...
|
||
... Success!
|
||
- Removing privileges on test database...
|
||
... Success!
|
||
Reload privilege tables now? [Y/n]
|
||
</pre></div>
|
||
</div>
|
||
<p>Reloading the privilege tables ensures all changes made so far take
|
||
effect immediately. To reload the privilege tables, type ‘y’.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>... Success!
|
||
|
||
Cleaning up...
|
||
</pre></div>
|
||
</div>
|
||
<p>All done! If you’ve completed all of the above steps, your MariaDB
|
||
installation should now be secure.</p>
|
||
<p>Thanks for using MariaDB!</p>
|
||
</li>
|
||
</ol>
|
||
<p>The MariaDB installation is complete, and we can now install phpMyAdmin to
|
||
manage the databases.</p>
|
||
</section>
|
||
</section>
|
||
<section id="install-phpmyadmin">
|
||
<h2><a class="toc-backref" href="#id13" role="doc-backlink">Install phpMyAdmin</a><a class="headerlink" href="#install-phpmyadmin" title="Link to this heading">¶</a></h2>
|
||
<p>The web-based tool phpMyAdmin is a straightforward way to manage MySQL or
|
||
MariaDB databases. Visit the <a class="reference external" href="https://www.phpmyadmin.net/">phpMyAdmin</a> website for the complete
|
||
discussion regarding phpMyAdmin, its documentation, the latest downloads,
|
||
and other useful information.</p>
|
||
<p>In this tutorial, we use the latest English version of phpMyAdmin.</p>
|
||
<ol class="arabic">
|
||
<li><p>Download the <code class="file docutils literal notranslate"><span class="pre">phpMyAdmin-<version>-english.tar.gz</span></code> file to your
|
||
<code class="file docutils literal notranslate"><span class="pre">~/Downloads</span></code> directory. Here, <version> refers to the current
|
||
version available at <a class="reference external" href="https://www.phpmyadmin.net/downloads">https://www.phpmyadmin.net/downloads</a>.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This example downloads and uses version 4.6.4.</p>
|
||
</div>
|
||
</li>
|
||
<li><p>Once the file has been successfully downloaded and verified, decompress
|
||
the file and directories into the Apache web server document root
|
||
directory. Use the following commands:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>/var/www/html
|
||
sudo<span class="w"> </span>tar<span class="w"> </span>–xzvf<span class="w"> </span>~/Downloads/phpMyAdmin-4.6.4-english.tar.gz
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>To keep things simple, rename the newly created
|
||
<code class="file docutils literal notranslate"><span class="pre">phpMyAdmin-4.6.4-english</span></code> directory to <code class="file docutils literal notranslate"><span class="pre">phpMyAdmin</span></code> with the
|
||
following command:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>mv<span class="w"> </span>phpMyAdmin-4.6.4-english<span class="w"> </span>phpMyAdmin
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="use-phpmyadmin-to-manage-a-database">
|
||
<h2><a class="toc-backref" href="#id14" role="doc-backlink">Use phpMyAdmin to manage a database</a><a class="headerlink" href="#use-phpmyadmin-to-manage-a-database" title="Link to this heading">¶</a></h2>
|
||
<p>You can use the phpMyAdmin web-based tool to manage your databases. Follow the
|
||
steps below for setting up a database called “WordPress”.</p>
|
||
<ol class="arabic">
|
||
<li><p>Verify that a successful installation of all LAMP server components by
|
||
going to http://localhost/phpMyAdmin. See figure 3.</p></li>
|
||
<li><p>Log in with your root userid and the password you set up when you ran the
|
||
<a class="reference internal" href="#set-password"><span class="std std-ref">mysql_secure_installation command</span></a>. Enter your
|
||
credentials and select <span class="guilabel">Go</span> to log in:</p>
|
||
<figure class="dropshadow align-default" id="id3">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-3.png"><img alt="phpMyAdmin login page" src="../_images/web-server-install-3.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 3: The phpMyAdmin login page.</cite></span><a class="headerlink" href="#id3" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
<li><p>Verify a successful login by confirming that the main phpMyAdmin page
|
||
displays, as shown in figure 4:</p>
|
||
<figure class="dropshadow align-default" id="id4">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-4.png"><img alt="phpMyAdmin dashboard" src="../_images/web-server-install-4.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 4: The phpMyAdmin dashboard.</cite></span><a class="headerlink" href="#id4" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
<li><p>Set up a database by selecting the <span class="guilabel">Databases</span> tab, as shown in
|
||
figure 5.</p></li>
|
||
<li><p>Enter <cite>WordPress</cite> in the text field below the <span class="guilabel">Create database</span>
|
||
label.</p></li>
|
||
<li><p>Select the <span class="guilabel">utf8_unicode_ci</span> option from the
|
||
<span class="guilabel">Collation</span> drop-down menu beside the text field.</p></li>
|
||
<li><p>Click <span class="guilabel">Create</span>.</p>
|
||
<figure class="dropshadow align-default" id="id5">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-5.png"><img alt="Databases tab" src="../_images/web-server-install-5.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 5: The Databases tab.</cite></span><a class="headerlink" href="#id5" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
<li><p>Set up user permissions by selecting the <span class="guilabel">WordPress</span> database
|
||
located in the left panel. See figure 6.</p></li>
|
||
<li><p>Select the <span class="guilabel">Privileges</span> tab. Figure 6 shows its contents.</p>
|
||
<figure class="dropshadow align-default" id="id6">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-6.png"><img alt="Privileges tab" src="../_images/web-server-install-6.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 6: The Privileges tab.</cite></span><a class="headerlink" href="#id6" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
<li><p>Click <span class="guilabel">Add user account</span> located at the bottom of the
|
||
<span class="guilabel">Privileges</span> tab. The <cite>Add user account</cite> page appears, as shown
|
||
in figure 7.</p>
|
||
<figure class="dropshadow align-default" id="id7">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-7.png"><img alt="User accounts tab" src="../_images/web-server-install-7.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 7: The User accounts tab.</cite></span><a class="headerlink" href="#id7" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
</li>
|
||
<li><p>Enter the following information in the corresponding fields that appear
|
||
in figure 7 above:</p>
|
||
<ul class="simple">
|
||
<li><p>User name: wordpressuser</p></li>
|
||
<li><p>Password: wp-example</p></li>
|
||
<li><p>Re-type: wp-example</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p>In the <cite>Database for user account</cite> section, select
|
||
<span class="guilabel">Grant all privileges on database “WordPress”.</span></p></li>
|
||
<li><p>At the bottom of the page, click <span class="guilabel">Go</span>.</p></li>
|
||
</ol>
|
||
<p>If successful, you should see the screen shown in figure 8:</p>
|
||
<figure class="dropshadow align-default" id="id8">
|
||
<a class="reference internal image-reference" href="../_images/web-server-install-8.png"><img alt="User added successfully" src="../_images/web-server-install-8.png" style="width: 600px;" />
|
||
</a>
|
||
<figcaption>
|
||
<p><span class="caption-text"><cite>Figure 8: The user wordpressuser is successfully added.</cite></span><a class="headerlink" href="#id8" title="Link to this image">¶</a></p>
|
||
</figcaption>
|
||
</figure>
|
||
<p><strong>Congratulations!</strong></p>
|
||
<p>You have now created a fully functional LAMP server along with a
|
||
WordPress*-ready database using Clear Linux OS.</p>
|
||
</section>
|
||
<section id="next-steps">
|
||
<h2><a class="toc-backref" href="#id15" role="doc-backlink">Next steps</a><a class="headerlink" href="#next-steps" title="Link to this heading">¶</a></h2>
|
||
<p>Next, add the WordPress components needed to host a WordPress website with <a class="reference internal" href="wordpress.html#wp-install"><span class="std std-ref">WordPress* Server</span></a>.</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/clearlinux.png" alt="Logo of Clear Linux* Project Docs"/>
|
||
</a></p>
|
||
<div>
|
||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">LAMP Web Server</a><ul>
|
||
<li><a class="reference internal" href="#install-apache">Install Apache</a><ul>
|
||
<li><a class="reference internal" href="#install-the-httpd-bundle">Install the httpd bundle</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#change-the-default-configuration-and-data-directory">Change the default configuration and data directory</a></li>
|
||
<li><a class="reference internal" href="#install-php">Install PHP</a></li>
|
||
<li><a class="reference internal" href="#install-mariadb">Install MariaDB</a><ul>
|
||
<li><a class="reference internal" href="#security-hardening">Security hardening</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#install-phpmyadmin">Install phpMyAdmin</a></li>
|
||
<li><a class="reference internal" href="#use-phpmyadmin-to-manage-a-database">Use phpMyAdmin to manage a database</a></li>
|
||
<li><a class="reference internal" href="#next-steps">Next steps</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="kubernetes-bp.html"
|
||
title="previous chapter">Kubernetes* Best Practices</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="mirror-upstream-server.html"
|
||
title="next chapter">Mirror Upstream Clear Linux OS Update Server</a></p>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/tutorials/lamp-server.rst.txt"
|
||
rel="nofollow">Show Source</a></li>
|
||
</ul>
|
||
</div>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="mirror-upstream-server.html" title="Mirror Upstream Clear Linux OS Update Server"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="kubernetes-bp.html" title="Kubernetes* Best Practices"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Documentation for Clear Linux* project</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="index.html" >Tutorials</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">LAMP Web Server</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2022 Intel Corporation. All Rights Reserved..
|
||
Last updated on Nov 04, 2024.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
|
||
</div>
|
||
</body>
|
||
</html> |