WordPress is an open-source blogging platform and content management system (CMS) that powers over 40% of websites on the internet. Alpine Linux is a lightweight Linux distribution that is designed for security, simplicity, and resource efficiency. In this tutorial, we will guide you on how to install WordPress on Alpine Linux Latest.
Before starting with the installation process, make sure that you have the following:
Open the terminal on your server.
Download the latest version of WordPress from the official website by running the following command:
wget https://wordpress.org/latest.tar.gz
Extract the downloaded file by running the following command:
tar -xf latest.tar.gz
Move the extracted files to your web server root directory by running the following command:
mv wordpress/* /var/www/html/
Delete the downloaded file and the empty wordpress
directory by running the following command:
rm -rf latest.tar.gz wordpress
Log in to the MySQL shell by running the following command:
mysql -u root -p
Enter your MySQL root password when prompted.
Create a new database for WordPress by running the following command:
CREATE DATABASE wp_database;
Create a new user for WordPress by running the following command:
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'strong_password';
Replace strong_password
with a strong password of your choice.
Grant all privileges to the new user on the database by running the following command:
GRANT ALL PRIVILEGES ON wp_database.* TO 'wp_user'@'localhost';
Flush the privileges by running the following command:
FLUSH PRIVILEGES;
Exit the MySQL shell by running the following command:
exit
Open the terminal on your server.
Rename the wp-config-sample.php
file to wp-config.php
by running the following command:
cd /var/www/html/
mv wp-config-sample.php wp-config.php
Edit the wp-config.php
file by running the following command:
nano wp-config.php
Replace the following values with your own values:
define('DB_NAME', 'wp_database');
define('DB_USER', 'wp_user');
define('DB_PASSWORD', 'strong_password');
define('DB_HOST', 'localhost');
Save and exit the file by pressing CTRL+X
, Y
, and Enter
.
Change the ownership of the WordPress installation directory to the web server user by running the following command:
chown -R www-data:www-data /var/www/html/
If you are using Nginx, use the following command instead:
chown -R nginx:nginx /var/www/html/
Open the terminal on your server.
Navigate to the virtual host directory by running the following command:
cd /etc/apache2/conf.d/
If you are using Nginx, navigate to the virtual host directory by running the following command:
cd /etc/nginx/conf.d/
Create a new virtual host configuration file by running the following command:
nano wordpress.conf
Add the following lines to the configuration file:
server {
listen 80;
server_name your_domain.com;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Replace your_domain.com
with your domain name.
Save and exit the file by pressing CTRL+X
, Y
, and Enter
.
Restart the Apache or Nginx web server by running the following command:
service apache2 restart
If you are using Nginx, use the following command instead:
service nginx restart
Open your web browser and navigate to http://your_domain.com
.
Select your preferred language and click Continue
.
Enter your WordPress site title, username, password, and email address, and click Install WordPress
.
Congratulations! You have successfully installed WordPress on Alpine Linux Latest.
In this tutorial, we have covered how to install WordPress from https://wordpress.org/ on Alpine Linux Latest. By following these steps, you can easily set up a WordPress site on your Alpine Linux server.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!