EC2 Wordpress


  1. Update your ubuntu system 20.04.
  2. Install apache2.
  3. Install mysql database server.
  4. 
    sudo apt-get install mysql-server
    sudo systemctl status mysql # active
    sudo -s # be root user root@...
    mysql_secure_installation # pwd: YNNNN
    sudo systemctl start mysql
    sudo systemctl enable mysql
    sudo mysql -u root -p
    CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    CREATE USER wordpress IDENTIFIED WITH mysql_native_password BY 'abcdf';
    GRANT ALL ON wordpress.* TO 'wordpress'@'%';
        
  5. Install PHP.
  6. 
    sudo apt install php libapache2-mod-php php-mysql
    sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
        
  7. Download and install wordpress.
  8. 
    curl -O https://wordpress.org/latest.tar.gz
    tar -xzvf latest.tar.gz
    sudo cp -R wordpress/* /var/www/html/random.com
    sudo chown -R www-data:www-data /var/www/html/random.com
    sudo chmod -R 775 /var/www/html/random.com
    cd /var/www/html/random.com
    sudo mv wp-config-sample.php wp-config.php
        
  9. Edit wp-config.php file.
  10. 
    DB_NAME = wordpress
    DB_USER = wordpress
    DB_PASSWORD = abcdf
        
  11. Create VirtualHost for wordpress site /etc/apache2/sites-available/random.com.conf.
  12. 
    <VirtualHost *:80>
    ServerAdmin admin@random.com
    ServerName random.com
    DocumentRoot /var/www/html/random.com
    ErrorLog ${APACHE_LOG_DIR}/random.com_error.log
    CustomLog ${APACHE_LOG_DIR}/random.com_access.log combined
    </VirtualHost>
        
  13. Enable, activate and restart new config with apache2.
  14. 
    sudo a2ensite dev.rcg.re5q.ai.conf
    sudo systemctl restart apache2
    sudo systemctl enable apache2
    sudo systemctl start mysql
    sudo systemctl enable mysql
        
  15. Add DNS record to resolver. You should be able to browse it after 10 mins? http://random.com/wp-admin
  16. 
    random.com -> public_ip
        

References


  1. Build a Website from Start to Finish using WordPress [Full Course]
  2. How To Make a Website With WordPress - 2021 (Beginners Tutorial)