Setting up Joomla! on Google Compute Engine

Setting up Joomla! on Google Compute Engine

Submitted by @jimtravis Jan 17, 2017

Get Joomla! running on a virtual machine instance on Google Compute Engine easily in just a few minutes. Follow the detailed tutorial to configure Joomla! on a Debian virtual machine instance with the LAMP stack installed and root access.

Objectives

  • Setting up the virtual machine
  • Downloading Joomla!
  • Setting up the database
  • Running the web-based setup
  • Viewing your Joomla! site
  • Sending email from Joomla!

Setting up the virtual machine

First, automatically deploy the LAMP development stack by using Cloud Launcher.

When done, make a note of the MySQL administrator password. You can always return to the Click to Deploy page in the Google Cloud Platform Console to see the password or any other deployment information at any time.

Next, open port 80 to allow HTTP traffic to your server. Follow these steps:

  1. View your virtual machine instances in the Compute Engine instances page.
  2. In the External IP column, click the external IP address for your LAMP server name.
  3. In the dialog box that opens, select the Allow HTTP traffic check box.
  4. Click Apply to close the dialog box.

Downloading Joomla!

Download the Joomla! package file to your virtual machine instance, unpack the files, and change the required ownership and permissions settings.

  1. Use the Google Cloud Platform Console to connect to your virtual machine instance over SSH.

  2. In the SSH console window, change directory to the web root.

     
    cd /var/www/html
    
  3. Remove the default index.html file. This step will leave a robots.txt file.

     
    sudo rm index.html
    
  4. Enter the following command to download the package for Joomla! version 3.3.6.

     
    sudo wget http://joomlacode.org/gf/download/frsrelease/19822/161255/Joomla_3.3.6-Stable-Full_Package.tar.gz
    

    If you want to use a different version, you can find the links to available versions on the JoomlaCode page.

  5. Extract the files from the archive that you downloaded.

     
    sudo tar -xvzf Joomla_VERSION-Stable-Full_Package.tar.gz
    

    replacing VERSION with the version of Joomla! that you downloaded.

  6. Change the ownership of the web server root directory so that Apache can access files.

     
    sudo chown -R www-data:www-data /var/www/
    
  7. Change the permissions on the files and directories. These settings enable owners to read and write files and to read, write, and execute in the directories. Non-owners can read files and and read and execute in the directories.

     
    sudo find . -type f -exec chmod 644 {} \;
    sudo find . -type d -exec chmod 755 {} \;
    

Setting up the database

Create a MySQL database for Joomla! and then grant permissions to a non-root user account that Joomla! can use to access the database. You can see MySQL administrator password on the Click to Deploy setup page after your LAMP stack is deployed.

  1. Create the new database. For example, you can name the database "joomla".

     
    mysqladmin -u root -p create joomla
    
  2. Log in to the MySQL console. Enter the MySQL administrator password, when prompted.

     
    mysql -u root -p
    
  3. Set the permissions on the database for the MySQL user account used by Joomla!.

     
    GRANT ALL ON YOUR_DATABASE_NAME.* TO 'YOUR_USERNAME'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
    

    replacing YOUR_DATABASE_NAMEYOUR_USERNAME, and YOUR_PASSWORD with your values.

  4. Exit the MySQL console.

     
    exit
    

Running the web-based setup

You can complete the Joomla! setup in your browser.

  1. Browse to the Joomla! setup page by entering the external IP address for your site. Alternatively, you can click the IP address link for your virtual machine instance in the virtual machine instance in the Cloud Platform Console.
  2. Enter the required information on the Configuration tab and then click Next.
  3. On the Database tab, enter the information about the MySQL account that you previously created. Be sure to use the same account name, password, and database name that you provided when you set the database permissions. Click Next when you're done.
  4. On the Overview tab, select an option for sample data. For a production site, you'll probably want to accept the default value of None.
  5. In the Email configuration setting, click Yes if you want Joomla! to send you an email containing your site settings.
  6. To complete the setup, click Install.
  7. When the setup is done, click Remove installation folder to clean up the setup files.

Viewing your Joomla! site

You can browse to your Joomla! site by entering the IP address for your site. Alternatively, you can click the external IP address link for your virtual machine instance in the Cloud Platform Console.

Sending email from Joomla!

Google Compute Engine doesn't allow outbound connections on ports 25, 465, and 587. To send email from your instances, you must use a partner service, such as SendGrid. SendGrid offers customers of Google Compute Engine free or paid packages with costs that vary by monthly email volume.

Getting a SendGrid account

Use SendGrid's Google partner page to create an account. Note that Google will be compensated for customers who sign up for a paid package.

For more details about sending email, see Sending Email from an Instance.

Configuring Joomla! to use SendGrid

Use the Joomla! control panel to configure email settings in Joomla!.

  1. To browse to the control panel, enter your site's external IP address and append /administrator to the URL. You might need to log in.
  2. In the left-side navigation menu, click Global Configuration.
  3. In the Mail Settings section, verify that Send mail is set to Yes.
  4. In the Mailer list, select SMTP.
  5. Change From email to contain a valid email address from your site's domain.
  6. In SMTP Authentication select Yes.
  7. In SMTP Port enter 2525.
  8. Enter the username and password for your SendGrid account.
  9. In SMTP Host enter smtp.sendgrid.net.
  10. Click Save & Close.

Sending a test email

You can send an email from Joomla! to test your SendGrid integration. You must create a user and then send a private message to the user.

  1. In the Joomla! control panel main page, in the left-side navigation, click User Manager.
  2. On the User Manager page, click New.
  3. Use the form to provide details about the user. The email address must be different from the one you used for your administrator account.
  4. On the Assigned User Groups tab, select Administrator.
  5. Click Save & Close.
  6. In the menu bar, select Components > Messaging > New Private Message.
  7. For Recipient, click the button and then select the new user that you added previously.
  8. Enter a subject and a message and then click Send.

If sending the email fails, log in to SendGrid website and verify that your SendGrid account is active. It's possible that activating the account can take some time. You can also check SendGrid's email activity page to see whether your email was blocked for some reason.

 

Setting up DNS

After you have set up your software stack and transferred your files, you might want to map your own domain name to your site. If you want complete control of your own DNS system, you can use Google Cloud DNS to serve as your domain name service (DNS) provider. If you need instructions that are specific to Cloud DNS, see the quickstart.

This tutorial walks you through the more-common scenario of setting up DNS through a third-party provider, such as your domain registrar.

If you have an existing DNS provider that you want to use, you need to create a couple of records with that provider. This lesson assumes that you are mapping example.com and www.example.com to point to your website hosted on Compute Engine.

For the example.com domain name, create an A record with your DNS provider. For the www.example.com sub-domain, create a CNAME record for www to point it to the example.com domain. The A record maps a host name to an IP address. The CNAME record creates an alias for the A record. This lesson assumes you want example.com and www.example.com to map to the same IP address.

  1. Get your external IP address for your instance. You can look up the IP address from the VM instances page in the Cloud Platform Console.
  2. Sign in to your provider's DNS management interface and find the domain that you want to manage. Refer to your DNS provider's documentation for specific steps.
  3. Create an A record and set the value to your external IP address. The name or host field can be set to @, which represents the naked domain. For more information, the Google Apps support page provides help for completing various DNS tasks.
  4. Create a CNAME record, set the name to www, and set the value to @ or to your hostname followed by a period:example.com.. Read the Google Apps support for help creating the A record with various providers.
  5. If appropriate for your provider, increment the serial number in your SOA record to reflect that changes have been made so that your records will propagate.

Verify your DNS changes

If your domain name registrar, such as Google Domains, is also your DNS provider, you're probably all set. If you use separate providers for registration and DNS, make sure that your domain name registrar, has the correct name servers associated with your domain.

After making your DNS changes, the record updates will take some time to propagate depending on your time-to-live (TTL) values in your zone. If this is a new hostname, the changes should go into effect quickly because the DNS resolvers will not have cached previous values and will contact the DNS provider to get the necessary information to route requests.

Cleaning up

After you've finished the LAMP tutorial, you can clean up the resources you created on Google Cloud Platform so you won't be billed for them in the future. The following sections describe how to delete or turn off these resources.

Deleting the project

The easiest way to eliminate billing is to delete the project you created for the tutorial. If you don't want to delete the project, delete the individual instances, as described in the next section.

Warning: Deleting a project has the following consequences:

  • If you used an existing project, you'll also delete any other work you've done in the project.
  • You can't reuse the project ID of a deleted project. If you created a custom project ID that you plan to use in the future, you should delete the resources inside the project instead. This ensures that URLs that use the project ID, such as an appspot.com URL, remain available.

If you are exploring multiple tutorials and quickstarts, reusing projects instead of deleting them prevents you from exceeding project quota limits.

To delete the project:

  1. In the Cloud Platform Console, go to the Projects page.
  2. In the project list, select the project you want to delete and click Delete project. After selecting the checkbox next to the project name, click Delete project.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

Deleting instances

To delete a Compute Engine instance:

  1. In the Cloud Platform Console, go to the VM Instances page.
  2. Click the checkbox next to your lamp-tutorial instance.
  3. Click the Delete button at the top of the page to delete the instance.

Next steps

  • By default, the web server document root is owned by the root user. You might want to configure your document root for another user or want to change the directory location in the Apache configuration file.

  • Debian/Ubuntu: The web server document root is at /var/www/html and the Apache configuration file is at /etc/apache2/sites-available/default.

  • CentOS: The web server document root is at /var/www/html and the Apache configuration file is at /etc/httpd/conf/httpd.conf.

  • Learn more about serving websites on Cloud Platform.


列印   Email