<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LEMP Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/lemp/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/lemp/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Tue, 12 Aug 2025 17:39:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>LEMP Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/lemp/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>One-Click WordPress on Ubuntu 24.04 for Small Business Sites</title>
		<link>https://serverstadium.com/knowledge-base/simple-wordpress-ubuntu-24-04-dedicated-servers/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 12 Aug 2025 17:32:21 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=12181</guid>

					<description><![CDATA[<p>Introduction This guide will walk you through installing WordPress on a ServerStadium VM or a ServerStadium dedicated server running Ubuntu 24.04. We’ll cover both Apache (LAMP) and Nginx (LEMP), free SSL with Let’s Encrypt, and simple backup &#38; update routines—everything a small business needs to get online quickly with great performance. Prerequisites A ServerStadium VM&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/simple-wordpress-ubuntu-24-04-dedicated-servers/">One-Click WordPress on Ubuntu 24.04 for Small Business Sites</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">This guide will walk you through installing WordPress on a <a href="https://serverstadium.com/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium VM</a> or a <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> running Ubuntu 24.04. We’ll cover both Apache (LAMP) and Nginx (LEMP), free SSL with Let’s Encrypt, and simple backup &amp; update routines—everything a small business needs to get online quickly with great performance.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<ul class="wp-block-list">
  <li>A <a href="https://serverstadium.com/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium VM</a> or <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">dedicated server</a> with Ubuntu 24.04 and a domain pointed to your server’s IP.</li>
  <li>SSH access with a sudo-capable user.</li>
  <li>An email address for Let’s Encrypt notifications (recommended).</li>
</ul>



<h2 class="wp-block-heading">Option A: LAMP (Apache) Quick Install</h2>



<p class="wp-block-paragraph">This path uses Apache + PHP + MySQL and enables HTTPS via the Certbot Apache plugin.</p>



<p class="wp-block-paragraph"><strong>1) Update and install packages</strong></p>


<pre><code>sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 mysql-server php php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl unzip
sudo a2enmod rewrite
sudo systemctl enable --now apache2 mysql
</code></pre>


<p class="wp-block-paragraph"><strong>2) Secure MySQL &amp; create the WordPress database</strong></p>


<pre><code>sudo mysql_secure_installation
sudo mysql -e "CREATE DATABASE wpdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;"
sudo mysql -e "CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'ChangeThisStrongPassword!';"
sudo mysql -e "GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES;"
</code></pre>


<p class="wp-block-paragraph"><strong>3) Download &amp; place WordPress</strong></p>


<pre><code>cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo rsync -a wordpress/ /var/www/html/
sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
</code></pre>


<p class="wp-block-paragraph"><strong>4) Configure Apache vHost</strong> (replace <code>example.com</code> with your domain)</p>


<pre><code>sudo tee /etc/apache2/sites-available/wordpress.conf >/dev/null <<'EOF'
&lt;VirtualHost *:80&gt;
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html

    &lt;Directory /var/www/html&gt;
        AllowOverride All
        Require all granted
    &lt;/Directory&gt;

    ErrorLog ${APACHE_LOG_DIR}/wp_error.log
    CustomLog ${APACHE_LOG_DIR}/wp_access.log combined
&lt;/VirtualHost&gt;
EOF

sudo a2ensite wordpress.conf
sudo systemctl reload apache2
</code></pre>


<p class="wp-block-paragraph"><strong>5) Create <code>wp-config.php</code> and add secure keys</strong></p>


<pre><code>cd /var/www/html
cp wp-config-sample.php wp-config.php
sed -i "s/database_name_here/wpdb/g; s/username_here/wpuser/g; s/password_here/ChangeThisStrongPassword!/g" wp-config.php
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee /tmp/wp.keys >/dev/null
sudo awk 'BEGIN{print "[MARK]"}1' wp-config.php | sed -e "/\[MARK\]/r /tmp/wp.keys" -e "/\[MARK\]/d" | sudo tee wp-config.php.new >/dev/null
sudo mv wp-config.php.new wp-config.php
sudo chown www-data:www-data wp-config.php
</code></pre>


<p class="wp-block-paragraph"><strong>6) Enable HTTPS (Let’s Encrypt)</strong></p>


<pre><code>sudo apt -y install certbot python3-certbot-apache
sudo certbot --apache -d example.com -d www.example.com --redirect -m you@example.com --agree-tos -n
</code></pre>


<h2 class="wp-block-heading">Option B: LEMP (Nginx) Quick Install</h2>



<p class="wp-block-paragraph">Prefer Nginx? Use PHP-FPM + Nginx + MySQL, then secure with Certbot’s Nginx plugin.</p>



<p class="wp-block-paragraph"><strong>1) Install Nginx, PHP-FPM, MySQL</strong></p>


<pre><code>sudo apt update
sudo apt -y install nginx mysql-server php-fpm php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl unzip
sudo systemctl enable --now nginx mysql
</code></pre>


<p class="wp-block-paragraph"><strong>2) Database (same as LAMP)</strong> — reuse the MySQL commands above to create <code>wpdb</code>/<code>wpuser</code>.</p>



<p class="wp-block-paragraph"><strong>3) Download &amp; set permissions</strong> (same as LAMP), but place WordPress at <code>/var/www/wordpress</code> for clarity:</p>


<pre><code>sudo mkdir -p /var/www/wordpress
sudo rsync -a /tmp/wordpress/ /var/www/wordpress/
sudo chown -R www-data:www-data /var/www/wordpress
</code></pre>


<p class="wp-block-paragraph"><strong>4) Nginx server block</strong> (replace <code>example.com</code>):</p>


<pre><code>sudo tee /etc/nginx/sites-available/wordpress >/dev/null <<'EOF'
server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/wordpress;

    index index.php index.html;
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

    location ~* \.(png|jpg|jpeg|gif|ico|css|js)$ {
        expires max;
        log_not_found off;
    }
}
EOF

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
sudo nginx -t &#038;&#038; sudo systemctl reload nginx
</code></pre>


<p class="wp-block-paragraph"><strong>5) Create <code>wp-config.php</code> and salts</strong> (same as LAMP, but in <code>/var/www/wordpress</code>):</p>


<pre><code>cd /var/www/wordpress
cp wp-config-sample.php wp-config.php
sed -i "s/database_name_here/wpdb/g; s/username_here/wpuser/g; s/password_here/ChangeThisStrongPassword!/g" wp-config.php
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee -a wp-config.php >/dev/null
sudo chown www-data:www-data wp-config.php
</code></pre>


<p class="wp-block-paragraph"><strong>6) Enable HTTPS (Let’s Encrypt)</strong></p>


<pre><code>sudo apt -y install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com --redirect -m you@example.com --agree-tos -n
</code></pre>


<h2 class="wp-block-heading">Finish Setup in the Browser</h2>



<p class="wp-block-paragraph">Visit <code>https://example.com</code> to complete the WordPress installer (site title, admin user). After logging in, go to <em>Settings → Permalinks</em> and click <em>Save</em> once to ensure pretty URLs work.</p>



<h2 class="wp-block-heading">Performance &amp; Security Basics</h2>



<ul class="wp-block-list">
  <li><strong>Permalinks &amp; rewrites:</strong> Apache needs <code>AllowOverride All</code> and Nginx uses the <code>try_files</code> rule shown above.</li>
  <li><strong>PHP modules:</strong> We installed commonly needed modules (curl, xml, gd, zip, mbstring, intl) for plugin/theme compatibility.</li>
  <li><strong>Auto-renew TLS:</strong> Certbot installs a timer by default. Verify with <code>systemctl status certbot.timer</code>.</li>
  <li><strong>Admin hygiene:</strong> Use strong passwords, enable two-factor for wp-admin, and keep plugins/themes minimal.</li>
</ul>



<h2 class="wp-block-heading">Simple Backups (Files + Database)</h2>



<p class="wp-block-paragraph">Create a quick backup script and schedule it with cron.</p>


<pre><code>sudo mkdir -p /opt/wp-backups
sudo tee /opt/wp-backups/backup.sh >/dev/null <<'EOF'
#!/usr/bin/env bash
set -e
TS=$(date +%F-%H%M)
SITE_ROOT="/var/www/html"   # or /var/www/wordpress for Nginx option
DB_NAME="wpdb"
DB_USER="wpuser"
DB_PASS="ChangeThisStrongPassword!"

mkdir -p /opt/wp-backups/${TS}
mysqldump -u ${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > /opt/wp-backups/${TS}/db.sql.gz
tar -czf /opt/wp-backups/${TS}/wp-files.tgz -C "${SITE_ROOT}" .
find /opt/wp-backups -type d -mtime +14 -exec rm -rf {} \; 2>/dev/null || true
EOF

sudo chmod +x /opt/wp-backups/backup.sh
echo "0 3 * * * root /opt/wp-backups/backup.sh" | sudo tee /etc/cron.d/wp-backup >/dev/null
</code></pre>


<h2 class="wp-block-heading">Keeping WordPress Updated</h2>



<ul class="wp-block-list">
  <li><strong>Core/plugin/theme updates:</strong> In <em>Dashboard → Updates</em>, apply updates weekly.</li>
  <li><strong>CLI (optional):</strong> Install WP-CLI for scripted updates: <code>curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && php wp-cli.phar --info</code>.</li>
  <li><strong>Backups first:</strong> Run your backup script before major updates or theme changes.</li>
</ul>



<h2 class="wp-block-heading">One-Click Installer (Optional)</h2>



<p class="wp-block-paragraph">Prefer a single command? This script asks for your domain, email, and stack (LAMP or LEMP), then installs WordPress with HTTPS automatically.</p>


<pre><code>cat <<'SCRIPT' > ~/oneclick-wp.sh
#!/usr/bin/env bash
set -euo pipefail
read -rp "Domain (e.g., example.com): " DOMAIN
read -rp "Email for Let's Encrypt: " EMAIL
read -rp "Stack [lamp|lemp]: " STACK
DB_NAME="wpdb"; DB_USER="wpuser"; DB_PASS="$(tr -dc A-Za-z0-9_@%+ | head -c 20)"

sudo apt update
if [[ "$STACK" == "lamp" ]]; then
  sudo apt -y install apache2 mysql-server php php-mysql php-fpm php-curl php-xml php-gd php-zip php-mbstring php-intl unzip certbot python3-certbot-apache
  sudo a2enmod rewrite
  sudo systemctl enable --now apache2 mysql
  sudo mysql -e "CREATE DATABASE ${DB_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;"
  sudo mysql -e "CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASS}'; GRANT ALL ON ${DB_NAME}.* TO '${DB_USER}'@'localhost'; FLUSH PRIVILEGES;"
  cd /tmp && curl -LO https://wordpress.org/latest.tar.gz && tar -xzf latest.tar.gz
  sudo rsync -a wordpress/ /var/www/html/
  sudo chown -R www-data:www-data /var/www/html
  sudo tee /etc/apache2/sites-available/wordpress.conf >/dev/null <<EOF
&lt;VirtualHost *:80&gt;
  ServerName ${DOMAIN}
  ServerAlias www.${DOMAIN}
  DocumentRoot /var/www/html
  &lt;Directory /var/www/html&gt;AllowOverride All&lt;/Directory&gt;
&lt;/VirtualHost&gt;
EOF
  sudo a2ensite wordpress.conf &#038;&#038; sudo systemctl reload apache2
  cd /var/www/html &#038;&#038; cp wp-config-sample.php wp-config.php
  sudo sed -i "s/database_name_here/${DB_NAME}/; s/username_here/${DB_USER}/; s/password_here/${DB_PASS}/" wp-config.php
  curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee -a wp-config.php >/dev/null
  sudo certbot --apache -d "${DOMAIN}" -d "www.${DOMAIN}" --redirect -m "${EMAIL}" --agree-tos -n
else
  sudo apt -y install nginx mysql-server php-fpm php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl unzip certbot python3-certbot-nginx
  sudo systemctl enable --now nginx mysql
  sudo mysql -e "CREATE DATABASE ${DB_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;"
  sudo mysql -e "CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PASS}'; GRANT ALL ON ${DB_NAME}.* TO '${DB_USER}'@'localhost'; FLUSH PRIVILEGES;"
  cd /tmp && curl -LO https://wordpress.org/latest.tar.gz && tar -xzf latest.tar.gz
  sudo mkdir -p /var/www/wordpress && sudo rsync -a wordpress/ /var/www/wordpress/
  sudo chown -R www-data:www-data /var/www/wordpress
  sudo tee /etc/nginx/sites-available/wordpress >/dev/null <<EOF
server {
  listen 80;
  server_name ${DOMAIN} www.${DOMAIN};
  root /var/www/wordpress;
  index index.php index.html;
  location / { try_files \$uri \$uri/ /index.php?\$args; }
  location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php-fpm.sock; }
}
EOF
  sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
  sudo nginx -t &#038;&#038; sudo systemctl reload nginx
  cd /var/www/wordpress &#038;&#038; cp wp-config-sample.php wp-config.php
  sudo sed -i "s/database_name_here/${DB_NAME}/; s/username_here/${DB_USER}/; s/password_here/${DB_PASS}/" wp-config.php
  curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee -a wp-config.php >/dev/null
  sudo certbot --nginx -d "${DOMAIN}" -d "www.${DOMAIN}" --redirect -m "${EMAIL}" --agree-tos -n
fi
echo "DB: ${DB_NAME}  USER: ${DB_USER}  PASS: ${DB_PASS}"
echo "Open https://${DOMAIN} to finish WordPress setup."
SCRIPT

chmod +x ~/oneclick-wp.sh
bash ~/oneclick-wp.sh
</code></pre>


<h2 class="wp-block-heading">Troubleshooting</h2>



<ul class="wp-block-list">
  <li><strong>White page / 502 errors:</strong> Check PHP-FPM/Apache status: <code>systemctl status php*-fpm apache2 nginx</code>.</li>
  <li><strong>Permalinks not working (Apache):</strong> Confirm <code>AllowOverride All</code> and that <code>mod_rewrite</code> is enabled.</li>
  <li><strong>SSL issuance fails:</strong> Confirm DNS A/AAAA records point to your server and re-run Certbot with <code>--apache</code> or <code>--nginx</code>.</li>
</ul>



<p class="wp-block-paragraph">Need a faster start? Choose a low-cost, instant <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">ServerStadium dedicated server</a> and be online today.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">That’s it—your small business WordPress site is live with modern PHP, a secure database, and free SSL on high-performance ServerStadium hardware. For more help or information about ServerStadium services, visit our <a href="https://serverstadium.com/knowledge-base/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">knowledge base</a> or the <a href="https://serverstadium.com/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">ServerStadium website</a>.</p>

<p>The post <a href="https://serverstadium.com/knowledge-base/simple-wordpress-ubuntu-24-04-dedicated-servers/">One-Click WordPress on Ubuntu 24.04 for Small Business Sites</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Installing LAMP in Ubuntu</title>
		<link>https://serverstadium.com/knowledge-base/installing-lamp-in-ubuntu/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 15 Sep 2020 07:14:56 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=188</guid>

					<description><![CDATA[<p>LAMP (Linux, Apache, MySQL, PHP) is a software stack that is quite popular for Ubuntu users to host dynamic websites and web applications written in PHP. To use LAMP properly, we must install Apache, MySQL, and PHP packages individually. Here are the steps for installing and configuring LAMP in the ServerStadium Virtual Machine that uses&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-lamp-in-ubuntu/">Installing LAMP in Ubuntu</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">LAMP (Linux, Apache, MySQL, PHP) is a software stack that is quite popular for Ubuntu users to host dynamic websites and web applications written in PHP.</p>



<p class="wp-block-paragraph">To use LAMP properly, we must install Apache, MySQL, and PHP packages individually. Here are the steps for installing and configuring LAMP in the ServerStadium Virtual Machine that uses the Ubuntu operating system.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 1 &#8211; Installing Apache2</strong></h2>



<p class="wp-block-paragraph">Apache2 is the most famous web server with the most users worldwide. Therefore, it still is a great choice for hosting a website.<br />To begin with, update the Ubuntu repository with the command :</p>



<pre class="wp-block-code"><code># apt update</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="313" height="20" class="wp-image-196" src="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2.png 313w, https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-300x19.png 300w" sizes="(max-width: 313px) 100vw, 313px" /></figure>



<p class="wp-block-paragraph">Then, install the Apache2 package with the command :</p>



<pre class="wp-block-code"><code># apt install apache2</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="489" height="21" class="wp-image-197" src="https://serverstadium.com/wp-content/uploads/2020/09/002_ver2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/002_ver2.png 489w, https://serverstadium.com/wp-content/uploads/2020/09/002_ver2-300x13.png 300w" sizes="(max-width: 489px) 100vw, 489px" /></figure>



<p class="wp-block-paragraph"><mark class="has-inline-color has-vivid-red-color" style="background-color: rgba(0, 0, 0, 0);">Don&#8217;t forget</mark> to add <mark class="has-inline-color has-vivid-cyan-blue-color" style="background-color: rgba(0, 0, 0, 0);">port 80</mark> to the Network Security Profile. For example, I&#8217;m allowing all IP Addresses to access <mark class="has-inline-color has-vivid-cyan-blue-color" style="background-color: rgba(0, 0, 0, 0);">port 80</mark> on this Virtual Machine.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="780" height="78" class="wp-image-194" src="https://serverstadium.com/wp-content/uploads/2020/09/003-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/003-1.png 780w, https://serverstadium.com/wp-content/uploads/2020/09/003-1-300x30.png 300w, https://serverstadium.com/wp-content/uploads/2020/09/003-1-768x77.png 768w" sizes="(max-width: 780px) 100vw, 780px" /></figure>



<p class="wp-block-paragraph">After that, access the Virtual Machine Public IP Address with a web browser. If the installation succeeds, it should display the Apache2 Ubuntu Default Page, as shown below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="823" height="301" class="wp-image-207" src="https://serverstadium.com/wp-content/uploads/2020/09/004_ver2-4.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/004_ver2-4.png 823w, https://serverstadium.com/wp-content/uploads/2020/09/004_ver2-4-300x110.png 300w, https://serverstadium.com/wp-content/uploads/2020/09/004_ver2-4-768x281.png 768w" sizes="(max-width: 823px) 100vw, 823px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 2 &#8211; Installing MySQL</strong></h2>



<p class="wp-block-paragraph">If Apache2 is a web server, MySQL acts as RDBMS (Relational Database Management System) on LAMP. MySQL is a Database Management System that is quite popular for the PHP programming language.<br />To install MySQL on Ubuntu, type the command :</p>



<pre class="wp-block-code"><code># apt install mysql-server</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="540" height="22" class="wp-image-213" src="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-1.png 540w, https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-1-300x12.png 300w" sizes="(max-width: 540px) 100vw, 540px" /></figure>



<p class="wp-block-paragraph">After the installation process is complete, running a series of processes aimed at improving MySQL security is recommended. To run the process, type the command :</p>



<pre class="wp-block-code"><code># mysql_secure_installation</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="397" height="30" class="wp-image-216" src="https://serverstadium.com/wp-content/uploads/2020/09/002.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/002.png 397w, https://serverstadium.com/wp-content/uploads/2020/09/002-300x23.png 300w" sizes="(max-width: 397px) 100vw, 397px" /></figure>



<p class="wp-block-paragraph">A new message will pop up; there is an option if you want to enable the &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">VALIDATE PASSWORD</span>&#8221; feature.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="487" height="164" class="wp-image-219" src="https://serverstadium.com/wp-content/uploads/2020/09/003-2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/003-2.png 487w, https://serverstadium.com/wp-content/uploads/2020/09/003-2-300x101.png 300w" sizes="(max-width: 487px) 100vw, 487px" /></figure>



<p class="wp-block-paragraph">This tool checks the password strength and allows MySQL users to set only those passwords which are secure enough. There is 3 level :</p>



<pre class="wp-block-code"><code>- LOW --&gt; Length &gt;= 8
- MEDIUM --&gt; Length &gt;= 8, numeric, mixed case, and special characters
- STRONG --&gt; Length &gt;= 8, numeric, mixed case, special characters, and dictionary</code></pre>



<p class="wp-block-paragraph">Press y / Y if you want to use &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">VALIDATE PASSWORD</span>&#8221; or press n / N if you don&#8217;t want to use it.</p>



<p class="wp-block-paragraph">Set the <span class="has-inline-color has-vivid-cyan-blue-color">root</span> MySQL user password by filling in these prompts with your desired password.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="276" height="75" class="wp-image-220" src="https://serverstadium.com/wp-content/uploads/2020/09/004.png" alt="" /></figure>



<p class="wp-block-paragraph">Removing the &#8220;anonymous&#8221; MySQL users before moving into a production state is advised. Press y / Y to remove the &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">anonymous</span>&#8221; MySQL user on the next pop-up.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="478" height="131" class="wp-image-221" src="https://serverstadium.com/wp-content/uploads/2020/09/005.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/005.png 478w, https://serverstadium.com/wp-content/uploads/2020/09/005-300x82.png 300w" sizes="(max-width: 478px) 100vw, 478px" /></figure>



<p class="wp-block-paragraph">Then, to secure MySQL from a remote connection. Root login by remote access has to disable on the next pop-up.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="520" height="93" class="wp-image-222" src="https://serverstadium.com/wp-content/uploads/2020/09/006.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/006.png 520w, https://serverstadium.com/wp-content/uploads/2020/09/006-300x54.png 300w" sizes="(max-width: 520px) 100vw, 520px" /></figure>



<p class="wp-block-paragraph">Same with the anonymous MySQL user, it is advised to remove &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">test</span>&#8221; named database before moving into a production state. Press y / Y to remove &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">test</span>&#8221; named database on the next pop-up message.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="581" height="108" class="wp-image-223" src="https://serverstadium.com/wp-content/uploads/2020/09/007.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/007.png 581w, https://serverstadium.com/wp-content/uploads/2020/09/007-300x56.png 300w" sizes="(max-width: 581px) 100vw, 581px" /></figure>



<p class="wp-block-paragraph">Press y / Y to reload the privilege tables so the several configurations above will apply.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="512" height="71" class="wp-image-224" src="https://serverstadium.com/wp-content/uploads/2020/09/008.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/008.png 512w, https://serverstadium.com/wp-content/uploads/2020/09/008-300x42.png 300w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<p class="wp-block-paragraph">To test the MySQL <span class="has-inline-color has-vivid-cyan-blue-color">root</span> user locally, test it by typing the command :</p>



<pre class="wp-block-code"><code># mysql -u root -p</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="333" height="22" class="wp-image-225" src="https://serverstadium.com/wp-content/uploads/2020/09/009.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/009.png 333w, https://serverstadium.com/wp-content/uploads/2020/09/009-300x20.png 300w" sizes="(max-width: 333px) 100vw, 333px" /></figure>



<p class="wp-block-paragraph">Then, fill in the password on the password prompt that appears.<br />The MySQL prompt will appear and be ready to use if the credential is correct.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="564" height="201" class="wp-image-226" src="https://serverstadium.com/wp-content/uploads/2020/09/010.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/010.png 564w, https://serverstadium.com/wp-content/uploads/2020/09/010-300x107.png 300w" sizes="(max-width: 564px) 100vw, 564px" /></figure>



<p class="wp-block-paragraph"><mark class="has-inline-color has-vivid-red-color" style="background-color: rgba(0, 0, 0, 0);">Remember</mark>, if you want to use the MySQL remote connection, add <mark class="has-inline-color has-vivid-cyan-blue-color" style="background-color: rgba(0, 0, 0, 0);">port 3306</mark> to the Network Security Profile that the Virtual Machine uses.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="771" height="65" class="wp-image-227" src="https://serverstadium.com/wp-content/uploads/2020/09/011.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/011.png 771w, https://serverstadium.com/wp-content/uploads/2020/09/011-300x25.png 300w, https://serverstadium.com/wp-content/uploads/2020/09/011-768x65.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 3 &#8211; Installing PHP</strong></h2>



<p class="wp-block-paragraph">We have Apache2 and MySQL installed as a part of the LAMP installation. PHP is needed in this 3rd step as a scripting language for LAMP. According to <a href="https://w3techs.com/technologies/details/pl-php" target="_blank" rel="noreferrer noopener">w3techs data</a>, PHP is used by <strong>78,9%</strong> of websites on the internet. This makes PHP a good choice for a server-side programming language for your website.</p>



<p class="wp-block-paragraph">Install PHP by typing the command :</p>



<pre class="wp-block-code"><code># apt install php php-mysql libapache2-mod-php</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="601" height="18" class="wp-image-234" src="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-2.png 601w, https://serverstadium.com/wp-content/uploads/2020/09/001_ver2-2-300x9.png 300w" sizes="(max-width: 601px) 100vw, 601px" /></figure>



<p class="wp-block-paragraph">Explanation :</p>



<pre class="wp-block-code"><code>- php : php core package
- php-mysql : PHP module that allows PHP to communicate with MySQL-based database
- libapache2-mod-php : PHP module that enable Apache2 to handle PHP files</code></pre>



<p class="wp-block-paragraph">After PHP is installed, you can check the PHP version by typing the command :</p>



<pre class="wp-block-code"><code># php -v</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="462" height="79" class="wp-image-237" src="https://serverstadium.com/wp-content/uploads/2020/09/002-1.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/002-1.png 462w, https://serverstadium.com/wp-content/uploads/2020/09/002-1-300x51.png 300w" sizes="(max-width: 462px) 100vw, 462px" /></figure>



<p class="wp-block-paragraph">To test the PHP installation and see the installed PHP&#8217;s complete info, make a new PHP file on <span class="has-inline-color has-vivid-cyan-blue-color">/var/www/html</span> directory with any text editor and name it <span class="has-inline-color has-vivid-red-color">info.php</span>. The content of the info.php must be like below :</p>



<pre class="wp-block-code"><code>&lt;?php
        phpinfo();
?&gt;</code></pre>



<p class="wp-block-paragraph">Save the file, and then access it from the web browser by URL :</p>



<pre class="wp-block-code"><code>http://YOUR_VM_IP_ADDRESS/info.php</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="947" height="678" class="wp-image-239" src="https://serverstadium.com/wp-content/uploads/2020/09/003-3.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/09/003-3.png 947w, https://serverstadium.com/wp-content/uploads/2020/09/003-3-300x215.png 300w, https://serverstadium.com/wp-content/uploads/2020/09/003-3-768x550.png 768w" sizes="(max-width: 947px) 100vw, 947px" /></figure>



<p class="wp-block-paragraph">As we can see info.php file displayed complete information for PHP that was installed on the Ubuntu ServerStadium Virtual Machine.</p>



<p class="wp-block-paragraph">Congratulations! You have now configured a LAMP stack on Ubuntu ServerStadium Virtual Machine.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Conclusion</strong></h2>



<p class="wp-block-paragraph">In this guideline, we have installed and configured LAMP stack on the Ubuntu Virtual Machine ServerStadium environment for serving PHP websites and applications using Apache2 as a web server and MySQL as a database management system.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-lamp-in-ubuntu/">Installing LAMP in Ubuntu</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
