Created
December 25, 2024 12:14
-
-
Save xiarahman/e39d8ef9b95b4f0f3104257a7a654dc0 to your computer and use it in GitHub Desktop.
Install WordPress on Ubuntu 24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To install a WordPress site with the domain `webralis.com` on the same computer, follow these steps: | |
| --- | |
| ### **Step 1: Set Up Prerequisites** | |
| 1. **Update System Packages**: | |
| ```bash | |
| sudo apt update && sudo apt upgrade -y | |
| ``` | |
| 2. **Install Required Software**: | |
| - Apache Web Server: | |
| ```bash | |
| sudo apt install apache2 -y | |
| sudo systemctl start apache2 | |
| sudo systemctl enable apache2 | |
| ``` | |
| - MySQL Server: | |
| ```bash | |
| sudo apt install mysql-server -y | |
| sudo mysql_secure_installation | |
| ``` | |
| - PHP and Extensions: | |
| ```bash | |
| sudo apt install php php-mysql libapache2-mod-php php-xml php-curl php-mbstring php-zip php-gd -y | |
| ``` | |
| --- | |
| ### **Step 2: Set Up a MySQL Database** | |
| 1. Log in to MySQL: | |
| ```bash | |
| sudo mysql -u root -p | |
| ``` | |
| 2. Create a database and user for WordPress: | |
| ```sql | |
| CREATE DATABASE wordpress; | |
| CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'secure_password'; | |
| GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress_user'@'localhost'; | |
| FLUSH PRIVILEGES; | |
| EXIT; | |
| ``` | |
| --- | |
| ### **Step 3: Download and Configure WordPress** | |
| 1. Navigate to the web root directory: | |
| ```bash | |
| cd /var/www/html | |
| ``` | |
| 2. Download the latest WordPress: | |
| ```bash | |
| wget https://wordpress.org/latest.tar.gz | |
| ``` | |
| 3. Extract WordPress: | |
| ```bash | |
| tar -xzvf latest.tar.gz | |
| ``` | |
| 4. Move WordPress files to the `webralis.com` directory: | |
| ```bash | |
| sudo mv wordpress webralis.com | |
| ``` | |
| 5. Set permissions: | |
| ```bash | |
| sudo chown -R www-data:www-data /var/www/html/webralis.com | |
| sudo chmod -R 775 /var/www/html/webralis.com | |
| ``` | |
| 6. Configure WordPress: | |
| - Rename the sample configuration file: | |
| ```bash | |
| sudo mv /var/www/html/webralis.com/wp-config-sample.php /var/www/html/webralis.com/wp-config.php | |
| ``` | |
| - Edit the configuration file: | |
| ```bash | |
| sudo nano /var/www/html/webralis.com/wp-config.php | |
| ``` | |
| Update the database settings: | |
| ```php | |
| define('DB_NAME', 'wordpress'); | |
| define('DB_USER', 'wordpress_user'); | |
| define('DB_PASSWORD', 'secure_password'); | |
| define('DB_HOST', 'localhost'); | |
| ``` | |
| --- | |
| ### **Step 4: Configure Apache for the Domain** | |
| 1. Create a new Apache virtual host configuration file: | |
| ```bash | |
| sudo nano /etc/apache2/sites-available/webralis.com.conf | |
| ``` | |
| 2. Add the following configuration: | |
| ```apache | |
| <VirtualHost *:80> | |
| ServerName webralis.com | |
| ServerAlias www.webralis.com | |
| DocumentRoot /var/www/html/webralis.com | |
| <Directory /var/www/html/webralis.com> | |
| AllowOverride All | |
| Require all granted | |
| </Directory> | |
| ErrorLog ${APACHE_LOG_DIR}/webralis_error.log | |
| CustomLog ${APACHE_LOG_DIR}/webralis_access.log combined | |
| </VirtualHost> | |
| ``` | |
| 3. Enable the site and Apache modules: | |
| ```bash | |
| sudo a2ensite webralis.com.conf | |
| sudo a2enmod rewrite | |
| sudo systemctl restart apache2 | |
| ``` | |
| --- | |
| ### **Step 5: Map the Domain to Your Local Server** | |
| 1. Edit the hosts file: | |
| ```bash | |
| sudo nano /etc/hosts | |
| ``` | |
| 2. Add the following line to map `webralis.com` to your local server (assuming your local IP is `127.0.0.1`): | |
| ```plaintext | |
| 127.0.0.1 webralis.com | |
| ``` | |
| --- | |
| ### **Step 6: Complete the WordPress Installation** | |
| 1. Open a browser and navigate to `http://webralis.com`. | |
| 2. Follow the on-screen instructions: | |
| - Choose a language. | |
| - Enter the site title, admin username, password, and email address. | |
| - Complete the setup. | |
| --- | |
| ### **Step 7: Access WordPress** | |
| - Frontend: Visit `http://webralis.com`. | |
| - Admin Panel: Visit `http://webralis.com/wp-admin`. | |
| --- | |
| You now have a WordPress site set up with the domain `webralis.com` on your computer! Let me know if you encounter any issues. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://drive.google.com/file/d/1bU29FDs2NXQzc_DJkH8leLsU5pnBIl3S/view?usp=drive_link