Documentation
    Amazon Web Services
    Microsoft Azure
    RapidAPI
    APILayer
Last Update: 2024-02-19

Lighthouse Website Analytics on Headless Ubuntu


Table of Content


Launch Lighthouse Website Analytics on Headless Ubuntu
Connect to your VM via SSH
Run our sample code and develop your own scripts
Deploy files on your VM remotely
Run Scripts in the Background After Closing the SSH Window

Launch Lighthouse Website Analytics on Headless Ubuntu

Navigate to our listing page on the AWS Marketplace and click 'Continue to Subscribe'.

On the subsequent page, review and accept our terms by selecting 'Accept Terms'.

Once the subscription process is complete, select 'Continue to Configuration'.

Choose the region where you wish to deploy the virtual machine, then click 'Continue to Launch'.

On the final page, select the instance type you wish to use (the recommended instance type is pre-selected) and review the other launch options. Then, click 'Launch'.

After launching, you can view your instance in the EC2 Management Console.

Connect to your VM via SSH


Please see the official documentation for detailed instructions on how to connect to a virtual machine with SSH.

Go to the EC2 Management Console and select the virtual machine to obtain its Public IPv4 address.

Open a Command Prompt / Terminal window and navigate to the directory where your created .pem key file is located. You can connect to your VM with the user 'ubuntu' by executing the following command:

ssh -i <name-of-key-file.pem> ubuntu@<public-ip>

Run our sample code and develop your own scripts


Connect to the terminal via SSH and log in as the user 'ubuntu'.

Navigate to the /etc/lighthouse directory by entering:

cd /etc/lighthouse

Run the demo code with the command:

node demo.js

You can find the created reports by using the command:

ls

Edit the demo script by entering:

nano demo.js

Alternatively, you can deploy your script files remotely.

Test against your own website by replacing the URLs in the array on line 5.

Deploy files on your VM remotely

Download and install WinSCP or any other SCP client of your choice.

Choose 'SFTP' as the file protocol and enter the public IP address of your instance, using 'ubuntu' as the username.

Click on 'Advanced'.

In the left-side menu, select 'Authentication'. Under Authentication parameters, select the key file you created when you launched the virtual machine. When prompted, convert the .pem key file to PuTTY format.

Close the Authentication window by clicking on 'OK', and connect to the virtual machine by clicking on 'Login'.

Run Scripts in the Background After Closing the SSH Window


Connect to the terminal via SSH by logging in with your created user account (the default username is 'azureuser'). For guidance, refer to the chapter titled 'Connect to Your VM via SSH'.

Start a new tmux session by entering the following command:

tmux

Start the script you wish to run in the background.

To detach the tmux session while keeping your script running in the background, press CTRL+b followed by d. You can now safely close the SSH session; your script will continue to run inside tmux.

To resume your tmux session at any time, use the command:

tmux attach