Find a step-by-step process of installing WordPress site on Alpine Linux using the Lighttpd server. This post is a feeder or add-on post to my previously published blog post on How to install and configure WordPress site on a Lighttpd server. If the two posts are read in conjunction, it might benefit you the most. However, each post is adequate in its own form, hope you will find the below instructions useful.

Prerequisites

Before we begin, make sure you have the following:
• A server or virtual machine running Alpine Linux
• Root access or sudo privileges
• Basic knowledge of the command line interface


How to install WordPress site on Alpine Linux and Lighttpd server

Tip: Read a companion post: How to install and configure WordPress on a Lighttpd server.

WordPress site on Alpine Linux and Lighttpd server

Step 1: Update System Packages

First, let’s update the system packages on your Alpine Linux server. Open the terminal and run the following command:

sudo apk update && sudo apk upgrade

This will ensure that your system is up to date with the latest security patches and bug fixes.

Step 2: Install Lighttpd Server

Next, we need to install the Lighttpd server. Run the following command in the terminal:

sudo apk add lighttpd

Once the installation is complete, start the Lighttpd service by running:
sudo rc-service lighttpd start

You can verify if Lighttpd is running by accessing your server’s IP address in a web browser. You should see a default page indicating that Lighttpd is successfully installed.

Logo of Lighttpd Server . Blog post on WordPress site on Alpine Linux and Lighttpd server

Logo of Lighttpd Server

Step 3: Install PHP 8.1 8.3

WordPress requires PHP to run. Let’s install PHP 8.1 PHP 8.3 and its dependencies by running these commands:

sudo apk add php8 php8-fpm php8-mysqli php8-json php8-curl php8-zlib
sudo rc-update add php-fpm8 default
sudo service php-fpm start

To test if PHP is installed correctly, create a info.php file in your document root directory (/var/www/localhost/htdocs/) with the following content:
<?php phpinfo(); ?>
Access this file in your web browser by visiting https://your_server_ip/info.php. You should see the PHP information page.

Step 4: Create a MySQL Database

WordPress requires a database to store its data. Let’s create a MySQL database and user for WordPress. Run the following commands: 

sudo apk add mariadb mariadb-client
sudo rc-service mariadb start
sudo mysql_secure_installation
mysql -u root -p

Once you’re logged into the MySQL shell, run these commands:

CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
EXIT;

Replace ‘your_password’ with a strong password of your choice.

Step 5: Download and Configure WordPress

Now, let’s download and configure WordPress. Run these commands: 

cd /var/www/localhost/htdocs/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo chown -R lighttpd:lighttpd /var/www/localhost/htdocs/wordpress/
mv wp-config-sample.php wp-config.php
nano wp-config.php

In the wp-config.php file, update the database details to match the MySQL database you created earlier. Save and exit the file.

Step 6: Set Permissions

To ensure that WordPress can read and write files properly, we need to set the correct permissions. Run these commands:

sudo chown -R lighttpd:lighttpd /var/www/localhost/htdocs/wordpress/ 

find /var/www/localhost/htdocs/wordpress/ -type d -exec chmod 755 {} \; 

find /var/www/localhost/htdocs/wordpress/ -type f -exec chmod 644 {} \;

Step 7: Complete the Installation

Finally, let’s complete the installation process. Open your web browser and visit https://your_server_ip/wordpress.

Follow the on-screen instructions to set up your WordPress site.That’s it! You have successfully installed WordPress on Alpine Linux using the Lighttpd server. Enjoy building your website with this lightweight and efficient setup!If you encounter any issues during the installation process, refer to the official documentation for Alpine Linux, Lighttpd server, and WordPress for troubleshooting guidance. Happy blogging!


About Alpine Linux

When I decided to write about installing WordPress on LIghttpd server, Alpine Linux came to mind right away. After reading the below section, I am sure you might concue that WordPress site on Alpine Linux and Lighttpd server is an unconventional but an effective combination.

Alpine Linux is a small, lightweight Linux distribution. It is designed with a focus on security, efficiency, and simplicity, making it a popular choice for server installations. It has limited user base and knowledge base among Linux and open-source users compared to CentOS or Ubuntu, two of the most common server operating systems.It is designed with a focus on security, efficiency, and simplicity, making it a popular choice for server installations. Below are some reasons why it is popular.

alpine linux logo dec2020

Logo of Alpine LInux

Features and Advantages of Alpine Linux

  1. Small Size: Alpine Linux is famous for its small size, which makes it ideal for use in containers and embedded devices. It has one of the fastest boot times of any operating system, and its small size also makes it more secure. It is one of the smallest Linux distributions available. This makes it ideal for use in embedded systems, virtual machines, and containers.
  2. Security: Alpine Linux is designed to be secure, with features like musl as its minimalist libc, BusyBox as core utilities, and userland binaries compiled as Position Independent Executables (PIE) with stack smashing protection. These features make it less vulnerable to attacks.
  3. Lightweight: Alpine Linux uses musl, BusyBox, and OpenRC instead of the more commonly used glibc, GNU Core Utilities, and systemd, respectively. This makes it more lightweight and faster than other Linux distributions. Due to its small size and minimalistic approach, Alpine Linux is incredibly fast and efficient. It has a quick boot time and uses fewer system resources, making it an ideal choice for low-end hardware or resource-constrained environments.
  4. Flexibility: Alpine Linux can operate on bare-metal hardware, in a VM, or even on a Raspberry Pi. It is non-commercial and evolved for embedded and server-based workloads, although desktop OS use is possible.
  5. Containerization: Alpine Linux is a popular OS choice for running containers, although it was not designed specifically for that task. Container environments have a small footprint, and Alpine Linux’s small size and rapid startup make it commonly used in containers providing quick boot-up times, on virtual machines as well as on real hardware in embedded devices, such as routers, servers, and NAS.
  6. Package management: Alpine Linux uses the apk package manager, which is simple, fast, and reliable. It uses a source-based package management system, which allows for easy customization and optimization of packages for specific use cases.
  7. Easy to use: Despite its focus on simplicity, Alpine Linux is still user-friendly. It has a minimalistic and straightforward approach, making it easy for beginners to use and understand.

Alpine Linux has a steeper learning curve than other Linux distributions or OSes.

 Limitations of Alpine Linux

1. Limited software availability: Due to its small size and focus on security, Alpine Linux has a limited number of packages available compared to other distributions. This can be a disadvantage for users who require a wide range of software for their server.

2. Learning curve: While Alpine Linux is user-friendly, it may still have a learning curve for those who are used to other Linux distributions. Users may need to familiarize themselves with the apk package manager and the musl libc library.

3. Lack of graphical user interface: Alpine Linux does not come with a graphical user interface by default. This can be a limitation for users who prefer a GUI for managing their system.

Installation size and server disk space

The installation size of Alpine Linux is around 130MB, which is significantly smaller than other server operating systems. This small size makes it quick and easy to install. On the other hand, Ubuntu Server minimal install or CentOS are more traditional server operating systems that offer a wider range of features and functionality compared to Alpine Linux. The installation size of Ubuntu Server minimal install is around 500MB, while CentOS is slightly larger at 800MB.

The minimal install of both these server operating systems takes over a gigabyte of disk space. This difference in size is due to the fact that these operating systems come with a larger set of pre-installed packages and libraries, making them more suitable for a wider range of use cases.


This post on How to Setup a WordPress site on Alpine Linux and Lighttpd server was updated substantially in March 2024

Categories: Notes Blog