In this article, we will be showing you how to set up a WordPress server. According to W3Techs, WordPress powers over 40% of all the websites on the Internet. More than one in three websites that you visit are likely powered by WordPress. For CMS, or content management systems, almost every 2 out of 3 CMS websites uses WordPress. In order to install WordPress, you need a web server stack. In this article, we will go through setting up a LAMP web stack.
The first thing we need to set up WordPress is a web server stack. A web server stack, also called a web application stack, is a combination of software set up to implement websites and web applications. The term, stack, refers to the fact that the system’s individual components are built upon one another. The basic requirements necessary to construct a web stack include: an operating system, a webserver, a database, and a script interpreter. The most popular software combination is the open source bundle LAMP, which is composed of Linux, Apache, MySQL, and PHP. LAMP stands for Linux, Apache, MySQL, PHP. It is a software development framework that is open source and uses Linux, operating system, Apache web server, MySQL database ( or MariaDB ), and PHP. LAMP is the most popular web server stack.
The first component of a web stack is the operating system. An operating system (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers. Some popular Operating Systems include Linux, Windows, and MacOS. Since we will be using LAMP, we will be installing the Linux operating system. We have several choices in what distribution of Linux we can use. A Linux distribution, often shortened to Linux distro, is an operating system compiled from components developed by various open source projects and programmers. Each distribution includes the Linux kernel, the GNU shell utilities, a package management system, an installer and other services. Many components are developed independently from each other and are distributed in source code form. Distros can also include an internet browser, management tools and other software. A single Linux distribution may contain thousands of software packages, utilities and applications. There are commercially backed distributions, such as Red Hat, openSUSE and Ubuntu, and entirely community distributions, such as Debian, Slackware, Gentoo and Arch Linux. Most distributions come ready to use and pre-compiled for a specific CPU architecture. Some distributions are distributed mostly in source code form and compiled locally during installation. Some commercial distributions charge users a fee for support and customer development services. Open source licensing prohibits charging for open source software. e server.
In this article, we will be using Ubuntu but you can use any of the distributions. According to W3Techs, almost 35% of Linux powered websites use Ubuntu. Before installing Ubuntu, make sure that your hardware meets the requirements:
2 GHz dual core processor 4 GiB RAM 25 GB hard-drive space VGA capable of 1024x768 screen resolution Either a CD/DVD drive or a USB port for the installer media Internet access
Since we will be installing LAMP and WordPress, at least 1GB of disk space is required and would double the ram to 8GB so the website isn’t too slow.
In order to install Ubuntu, you will need the Ubuntu image file and an installation media such as a recordable DVD or thumb drive that has at least 4GB. First, you need to download the Ubuntu image. You can download an Ubuntu image from Ubuntu’s download page ( https://ubuntu.com/download/desktop). Save the image to a location that you can remember. We will use this image to create a bootable usb thumb drive. In this example, we will use BalenaEtcher to create the bootable drive. BalenaEtcher can be downloaded from their homepage, https://www.balena.io/etcher/. Once you have BalenaEtcher installed, plug in the thumb drive to the USB port, and open BalenaEtcher. When the program opens, choose flash from file and select the Ubuntu image that was downloaded. FOr the destination, use the drive letter of the thumb drive that you inserted. Once the thumb drive is created, properly eject the thumb drive and connect to the computer where you will be installing Linux.
Once you have the bootable media, we have to enter the target computer’s BIOS to have it boot from the thumb drive ( or DVD ). Once the computer is booted from the thumb drive, you will see an option to try or install. Select install. During the install, there will be prompts for options. The first of the options is to choose the keyboard layout. The keyboard layout is defaulted for English( US ). The next option is for normal installation which includes productivity software or minimal install. FOr our purposes, we will be choosing minimal install. Next, comes the disk partitioning. You will be presented with an Installation Type dialog. You can wipe the hard drive clean prior to installing Ubuntu by clicking Erase disk and install Ubuntu or you can choose to edit Advanced Features to customize partitions. In our case, we will wipe out and use the recommended partitioning. Once the system formats the disk partitions, you will be prompted to set a time zone, click on the nearest city and click Continue. Next, we will need to configure a user account. Fill in the following fields:
Name: Your name. Computer name: The hostname or network name. Username: The user account name you want to use. Password: Enter and confirm a password – the installer will automatically evaluate your password strength. Log in automatically: Require my password to log in: Click Continue to install Ubuntu.
Once the installer is done, you will be prompted to remove the installation media and reboot. It will now reboot to a fresh copy of Ubuntu.
The next step is installing Apache web server software. Apache is a web server software that is responsible for accepting requests from visitors and sending them back the requested information in the form of web pages. It allows visitors to view content on your website. Apache is responsible for ensuring that the server your website is stored on can communicate with the device a visitor is using. Without web server software, your website will not work. A lot of large, well known companies use Apache including LinkedIn, Facebook, and eBay.
Before we set up Apache, we will need to set a static ip for the Linux box. An IP address is a unique number assigned to every device on a network. IP addresses identify computers and devices and lets them communicate with each other. The Internet uses the Domain Name System ( DNS ) as an internet address book. When you type a URL into your web browser, it uses DNS to look up the IP address for that domain. For example, if you type www.ames-pc.com into your browser, DNS returns an IP address, such as 18.104.22.168. Think of it as a phone book, when you look for John Doe, you can get the phone number to John Doe. A static IP address is an address that doesn’t change. Once your device is assigned a static IP address, that number stays the same. Static IP addresses generally are used by servers or other important equipment. WHen Ubuntu is installed, the default setting is for DHCP, or dynamic ip address where the IP address of the machine can change.
The easiest way to set the machine to a static ip is through the Activities screen in the desktop manager. In the activities screen, search for “settings” and click on the icon. This will open the settings window. Click on the Network tab. To open the interface settings, click on the gear icon next to the interface name. In the “IPV4 Method” tab, select Manual and enter your static IP address, Netmask and Gateway. Once done, click on the Apply button. The IP address should be unique for your network.
Make sure your system is up to date and patched. After the system updated with the latest patches, we can install Apache. After installing Apache, We will enable the apache2.service so Apache loads whenever the system boots.
sudo apt update sudo apt upgrade sudo apt install apache2 sudo systemctl enable apache2.service
Once Apache is setup, we will have to modify the firewall settings to allow outside access to the default web ports. During installation, Apache registers itself with UFW to provide a few application profiles that can be used to enable or disable access to Apache through the firewall. To make sure that Apache has been registered correctly, list the ufw application profiles by typing:
sudo ufw app list Output Available applications: Apache Apache Full Apache Secure OpenSSH
Now enable Apache in the firewall with the command:
sudo ufw allow Apache
To test apache installation from another computer, we can use the curl command, curl -I http://COMPUTER_IP or open up a browser and go to http://COMPUTER_IP. If Apache is set up correctly and the firewall is configured to allow Apache, you will get a response from the server
The next step is to install a database for Linux. In our case, we will be installing MariaDB. MariaDB is a fork of the MySQL database management system. MySQL was one of the first open-source database available in the market. MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS) that is free and open-source software under the GNU General Public License. Development is led by some of the original developers of MySQL, who forked it when MySQL was bought by Oracle Corporation.
To install MariaDB, we need to add MariaDB repository on to the system. Then the installation of MariaDB will be done from the APT repository. First, we need to updated the system and install the software-properties-common package. The next step is to install the MariaDB database server. Next, you have to secure the MariaDB server by running the MySQL hardening script. After running the script, we can check the status of the database. Finally, we can test login by using the mysql command.
sudo apt update && sudo apt upgrade sudo apt -y install software-properties-common sudo apt install mariadb-server mariadb-client sudo mysql_secure_installation systemctl status mysql mysql -u root -p
Since we are using Apache as our web server, we will run the following commands to install PHP and Apache PHP modules and restart Apache with the modules enabled.
sudo apt update sudo apt install php libapache2-mod-php sudo systemctl restart apache2
We can now download WordPress and set up our site. The document root for our site will be in the /var/www/html directory. We will replace the default Apache welcome page. First, we need to download WordPress from their site. For security concerns and other changes, always download the latest version. Enter the following command to change into the writable temporary directory. Once it is downloaded, we will need to unzip it into the /var/www/html directory. Once that is done, WordPress is installed and you can get to the WordPress Admin site by entering the IP address of the server.
Having a great website matters. It’s how you connect with your visitors and create a positive first impression. The good news is creating your own website doesn’t have to be a daunting process with WordPress. The easy-to-use CMS offers completely customizable plans suitable for all needs. With no prior knowledge necessary, you can start building your own site for your business, blog, portfolio, or online store immediately.
 https://w3techs.com/technologies/details/cm-wordpress “Usage statistics and market share of WordPress”
 https://kinsta.com/wordpress-market-share/ “In that case, WordPress holds”
 https://w3techs.com/technologies/details/os-linux 2nd paragraph
 https://help.ubuntu.com/community/Installation/SystemRequirements “Installation/SystemRequirements”
 https://stack.g2.com/apache-server “Apache Server”