How to install WordPress from https://wordpress.org/ on Alpine Linux Latest
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.
Prerequisites
Before starting with the installation process, make sure that you have the following:
- A VPS or dedicated server running Alpine Linux Latest
- Root access or sudo privileges on your server
- MySQL or MariaDB installed on your server
- PHP 7.3 or later installed on your server
- Apache or Nginx web server installed on your server
Step 1: Download and extract WordPress
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.gzExtract the downloaded file by running the following command:
tar -xf latest.tar.gzMove 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
wordpressdirectory by running the following command:rm -rf latest.tar.gz wordpress
Step 2: Create a MySQL database and user for WordPress
Log in to the MySQL shell by running the following command:
mysql -u root -pEnter 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_passwordwith 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
Step 3: Configure WordPress
Open the terminal on your server.
Rename the
wp-config-sample.phpfile towp-config.phpby running the following command:cd /var/www/html/ mv wp-config-sample.php wp-config.phpEdit the
wp-config.phpfile by running the following command:nano wp-config.phpReplace 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, andEnter.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/
Step 4: Configure the virtual host
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.confAdd 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.comwith your domain name.Save and exit the file by pressing
CTRL+X,Y, andEnter.Restart the Apache or Nginx web server by running the following command:
service apache2 restartIf you are using Nginx, use the following command instead:
service nginx restart
Step 5: Complete the WordPress installation
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.
Conclusion
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.