AWS

Install Google Chrome on AWS EC2 Linux 2 for Selenium TestingStep by Step Guaide

To install Google Chrome on an AWS EC2 instance running Amazon Linux 2, follow these steps. This will allow you to use Chrome for Selenium testing.

Step 1: Update the System

bash

Copy code

sudo yum update -y

For Assistance 

Step 2: Add Google Chrome Repository

Create a repository file for Google Chrome:

bash

Copy code

sudo nano /etc/yum.repos.d/google-chrome.repo

Add the following content to the file:

bash

Copy code

[google-chrome]

name=google-chrome

baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64

enabled=1

gpgcheck=1

gpgkey=https://dl.google.com/linux/linux_signing_key.pub

Save the file (Ctrl+O, then Enter) and exit (Ctrl+X).

Step 3: Install Google Chrome

Install Google Chrome using the following command:

bash

Copy code

sudo yum install -y google-chrome-stable

Step 4: Verify Chrome Installation

To check if Chrome is installed successfully:

bash

Copy code

google-chrome –version

Step 5: Install Dependencies for Chrome

Ensure all dependencies required for Chrome to run are installed:

bash

Copy code

sudo yum install -y atk cups-libs libX11 libXcomposite libXcursor libXdamage libXext libXi libXrandr libXScrnSaver libXtst pango alsa-lib

Step 6: Install ChromeDriver

  1. Download ChromeDriver:
    Check the Chrome version installed and download the matching ChromeDriver version:

bash

Copy code

google-chrome –version

Visit the ChromeDriver Downloads page and note the version matching your Chrome version.

Example (replace VERSION with the matching version):

bash

Copy code

wget https://chromedriver.storage.googleapis.com/VERSION/chromedriver_linux64.zip

  1. Extract ChromeDriver:

bash

Copy code

unzip chromedriver_linux64.zip

  1. Move ChromeDriver to a PATH directory:

bash

Copy code

sudo mv chromedriver /usr/local/bin/

  1. Verify ChromeDriver Installation:

bash

Copy code

chromedriver –version

For Assistance 

Step 7: Configure Selenium

Ensure Selenium is installed in your Python environment:

bash

Copy code

pip install selenium

Step 8: Test Selenium with Chrome

Here’s a sample Python script to verify Selenium and Chrome integration:

python

Copy code

from selenium import webdriver

 

options = webdriver.ChromeOptions()

options.add_argument(‘–headless’)  # Run Chrome in headless mode

options.add_argument(‘–no-sandbox’)

options.add_argument(‘–disable-dev-shm-usage’)

 

driver = webdriver.Chrome(options=options)

driver.get(“https://www.google.com”)

print(“Page Title is:”, driver.title)

 

driver.quit()

Run the script:

bash

Copy code

python3 your_test_script.py

Troubleshooting

  • If Chrome fails to start, ensure –no-sandbox and –disable-dev-shm-usage options are used, as these are needed for environments like EC2.
  • Use a lightweight EC2 instance type (e.g., t3.medium) to handle Chrome dependencies efficiently.

For Assistance 

WordPress Website Migration from Amazon LightSail to Bluehost

Migrating a WordPress website from Amazon Lightsail to Bluehost involves several steps. Here’s a step-by-step guide to ensure a smooth migration:

 

Step 1: Prepare Your Bluehost Account

  • Login to Bluehost: Access your Bluehost account dashboard.
  • Set up Hosting: Ensure your hosting environment is ready with a new domain or subdomain for the WordPress website.
  • Install WordPress: Use Bluehost’s one-click WordPress installer to create a fresh installation.

Step 2: Backup Your Lightsail WordPress Site

  1. Log in to Lightsail: Access your Lightsail console and identify the instance hosting your WordPress site.
  2. Access Your Instance via SSH: Open the terminal and connect to your Lightsail instance via SSH.

bash

Copy code

ssh -i Lightsail-Key.pem ubuntu@<Public-IP>

  1. Export Your Database:
    • Locate your database credentials in the wp-config.php file.
    • Run the following command to export your database:

bash

Copy code

mysqldump -u <DB_USER> -p <DB_NAME> > wordpress_db.sql

  1. Compress WordPress Files:
    • Navigate to the WordPress directory, usually /var/www/html.
    • Compress your WordPress files:

bash

Copy code

sudo tar -czvf wordpress_files.tar.gz /var/www/html

  1. Download the Backup Files:
    • Use SCP to transfer the files to your local machine:

bash

Copy code

scp -i Lightsail-Key.pem ubuntu@<Public-IP>:~/wordpress_files.tar.gz .

scp -i Lightsail-Key.pem ubuntu@<Public-IP>:~/wordpress_db.sql .

Step 3: Upload Files to Bluehost

  1. Log in to cPanel on Bluehost.
  2. Upload the Files:
    • Use the File Manager or an FTP client (e.g., FileZilla) to upload wordpress_files.tar.gz to the Bluehost directory (e.g., /public_html).
  3. Extract the Files:
    • Navigate to the File Manager, locate the uploaded file, and extract it.
  4. Import the Database:
    • In cPanel, go to phpMyAdmin.
    • Create a new database.
    • Import the wordpress_db.sql file into this database.

Step 4: Update Configuration

  1. Modify wp-config.php:
    • Update database credentials in the wp-config.php file:

php

Copy code

define(‘DB_NAME’, ‘new_database_name’);

define(‘DB_USER’, ‘new_database_user’);

define(‘DB_PASSWORD’, ‘new_password’);

define(‘DB_HOST’, ‘localhost’);

  1. Update Site URL:
    • Access phpMyAdmin and update the siteurl and home values in the wp_options table to match your new Bluehost domain.

Step 5: Test Your Website

  1. Preview Your Site:
    • Temporarily use Bluehost’s preview URL or modify your local hosts file to map the domain to Bluehost’s IP.
  2. Fix Any Issues:
    • Verify functionality, including plugins, themes, and permalinks.
    • Re-save permalinks under WordPress Settings > Permalinks.

Step 6: Update DNS

  1. Update Domain Nameservers:
  2. Wait for Propagation:
    • DNS changes can take up to 48 hours to propagate globally.

Step 7: Secure Your Site

  1. Enable SSL:
    • Use Bluehost’s SSL tool to enable a free SSL certificate.
    • Update the WordPress URL to use HTTPS.

Step 8: Final Testing

  • Verify the site works as expected.
  • Check for broken links or missing resources.
  • Monitor performance and traffic to ensure smooth operation.

Let me know if you need help with specific steps!

For further Assistance

https://www.upwork.com/freelancers/bilalkmk