?? Deploying WordPress on an Ubuntu Server ??
Krishantha Bandara
IT Assistant @phoenix pvt ltd BSc (Hons) Computer Science and Software Engineering Degree (Grade - First Class)
Deploying WordPress on an Ubuntu server is a powerful way to manage your website independently. Here’s a step-by-step guide:
??? Step 1: Update Your Server Update your packages: Type sudo apt update && sudo apt upgrade -y
?? Step 2: Install LAMP Stack (Linux, Apache, MySQL, PHP) Install Apache, MySQL, and PHP: Type sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql -y
?? Step 3: Configure MySQL Secure MySQL, then create a WordPress database and user: Type sudo mysql_secure_installation and follow the prompts.
Then, log in to MySQL: Type mysql -u root -p
In MySQL, set up a database: Type CREATE DATABASE wordpress; Then create a user and set a password: Type CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password'; Grant permissions to the user: Type GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; Finally, apply the changes: Type FLUSH PRIVILEGES; Exit MySQL: Type EXIT;
?? Step 4: Download and Configure WordPress Download and set up WordPress: Type wget https://wordpress.org/latest.tar.gz Extract the file: Type tar -xvzf latest.tar.gz Move it to the Apache directory: Type sudo mv wordpress /var/www/html
Then change ownership and permissions: Type sudo chown -R www-data:www-data /var/www/html/wordpress Set permissions: Type sudo chmod -R 755 /var/www/html/wordpress
领英推荐
?? Step 5: Configure Apache for WordPress Create an Apache configuration file for WordPress: Type sudo nano /etc/apache2/sites-available/wordpress.conf
In the file, add:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName example.com
<Directory /var/www/html/wordpress/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the new site and the rewrite module: Type sudo a2ensite wordpress Type sudo a2enmod rewrite Restart Apache: Type sudo systemctl restart apache2
?? Step 6: Finalize WordPress Installation In your browser, navigate to https://your_server_ip and complete the WordPress setup by entering database details and creating an admin account.
That’s it! Your WordPress site is now live and fully configured on Ubuntu.
#Linux #Ubuntu #WordPress #WebDevelopment #LAMPStack #SystemAdmin #OpenSource #CloudComputing #DevOps