Base de connaissances
How to Install WordPress On AlmaLinux 9 VPS Imprimer cet article
How to Install WordPress on a VPS Running AlmaLinux 9
Installing WordPress on a Virtual Private Server (VPS) running AlmaLinux 9 is an excellent choice for creating a flexible and powerful website. This tutorial will walk you through the entire process from setting up your server to installing WordPress.
Prerequisites
Before you start, ensure you have the following:
- A VPS running AlmaLinux 9 with root access.
- Basic knowledge of Linux commands.
- A domain name pointed to your server’s IP address (optional but recommended).
Step 1: Update Your System
First, it’s essential to ensure that your system is up to date. Connect to your server using SSH:
ssh root@your_vps_ip
Once connected, update the package index and upgrade installed packages:
dnf update -y
Step 2: Install Required Packages
To install WordPress, you will need to install a web server (Apache), PHP, and a database server (MySQL or MariaDB). You can install these using the following command:
Install Apache
dnf install httpd -y
Install MariaDB
dnf install mariadb-server -y
Install PHP and Extensions
Next, install PHP along with necessary extensions:
dnf install php php-mysqlnd php-fpm php-xml php-gd php-curl php-mbstring -y
Start and Enable Services
Enable and start the Apache and MariaDB services:
systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb
Configure the Firewall
Allow HTTP and HTTPS traffic through the firewall:
dnf install firewalld -y
systemctl start firewalld
systemctl enable firewalld
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Step 3: Secure MariaDB
After starting MariaDB, run the security script to improve the security of your installation:
mysql_secure_installation
Follow the prompts, which will allow you to set a root password, remove anonymous users, disallow remote root login, and remove test databases.
Log into MariaDB
Now, log in to MariaDB:
mysql -u root -p
Step 4: Create a Database and User for WordPress
Create a new database and user for your WordPress installation:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Make sure to replace 'your_password' with a secure password.
Step 5: Download WordPress
Change to the /var/www/html directory (the default document root for Apache) and download WordPress:
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
mv wordpress/* ./
rmdir wordpress
rm -f latest.tar.gz
Step 6: Configure WordPress
Copy the sample configuration file and edit it:
cp wp-config-sample.php wp-config.php
nano wp-config.php
Update the database settings in the wp-config.php file to match what you created earlier:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
Save the file and exit the editor.
Step 7: Set Permissions
Set the correct permissions for the WordPress files:
chown -R apache:apache /var/www/html/*
chmod -R 755 /var/www/html/*
Step 8: Configure Apache for WordPress
Create a new Apache configuration file for your WordPress site:
nano /etc/httpd/conf.d/wordpress.conf
Add the following configuration:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName your_domain.com
<Directory /var/www/html>
AllowOverride All
</Directory>
</VirtualHost>
Replace your_domain.com with your actual domain name. Save and exit the editor.
Test the Apache Configuration
Make sure that the configuration is correct:
httpd -t
If there are no errors, restart Apache to apply the changes:
systemctl restart httpd
Step 9: Install WordPress Through the Web Browser
Now that everything is set up, navigate to your domain in your web browser:
http://your_domain.com
You should see the WordPress installation wizard. Follow the prompts to select your language, provide your site title, username, password, and email, and finish the installation process.
Step 10: Complete the Installation
Once the installation is complete, you can log in to the WordPress admin dashboard at:
http://your_domain.com/wp-admin
Enter the username and password you set during the installation process.
Cette réponse était-elle pertinente ?
Articles connexes
Hi Thank you for choosing service from Host4Fun . Go to run > cmd > slmgr.vbs /rearm and...
By default Windows Server 2008 firewall blocks ping requests. To enable please follow the...
By default Windows Server 2012 firewall blocks ping requests. To enable please follow the below...
Hi , Thank you for choosing Service from Host4Fun.Com. When we run command "yum update" on our...
For Guide Visit :...