Update your system:
sudo apt update
sudo apt upgrade
Install LAMP stack (Linux, Apache, MySQL, PHP):
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql
Secure MySQL:
sudo mysql_secure_installation
Follow the prompts to set a root password and secure your MySQL installation.
Create a database and user for WordPress:
sudo mysql -u root -p
sql
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace 'your_password' with a strong password.
Download and extract WordPress:
cd /tmp
wget https:
tar -zxvf latest.tar.gz
sudo mv wordpress /var/www/html/
Configure WordPress:
sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
sudo nano /var/www/html/wordpress/wp-config.php
Update the database connection settings with the database name, username, and password you created earlier.
Set permissions:
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
Configure Apache:
sudo nano /etc/apache2/sites-available/wordpress.conf
Add the following configuration: CSS Code
<Directory /var/www/html/wordpress/>
AllowOverride All
</Directory>
Enable the configuration:
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
Restart Apache:
sudo systemctl restart apache2
Complete the WordPress installation:
Open your web browser and navigate to http:
Finish the setup:
After the installation, log in to your WordPress admin panel, and you're ready to start building your website.
Remember to replace 'your_server_ip' with the actual IP address of your Ubuntu server. Additionally, always ensure that your server's firewall settings allow traffic on the necessary ports (typically 80 for HTTP and 443 for HTTPS).