Trending November 2023 # How To Add Swap Space On Ubuntu 18.04 – Google Cloud # Suggested December 2023 # Top 19 Popular

You are reading the article How To Add Swap Space On Ubuntu 18.04 – Google Cloud updated in November 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested December 2023 How To Add Swap Space On Ubuntu 18.04 – Google Cloud

How to Add Swap Space on Ubuntu 18.04 on Google Cloud. Swap Space is a space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.

Swap space can help machines with a small amount of RAM. In case you choose a VM instance with 600 MB RAM, then your memory will get exhausted and you will get cannot allocate memory.

This guide provides the steps required to add swap space on Ubuntu 18.04.

Not using Ubuntu 18.04? Choose a different OS:


A running Compute Engine, see Setting up Compute Engine Instance with Ubuntu 18.04.

Check Swap Space

Check whether your Ubuntu server already has a swap space available. More often virtual machines don’t have a swap space enabled by default. Check swap space with the following command.

sudo swapon --show

If you don’t get any output, then your server don’t have any swap space. It’s time to add swap memory.

01. Creating a Swap File

Now you can create a swap file to add 1 GB (1G) space. You can also increase the amount of space you need.

sudo fallocate -l 1G /swapfile 02. Set up Swap File Permissions

Now you have a swap file of correct size and can be enabled as swap space.

Proceed by setting up correct permissions.

sudo chmod 600 /swapfile 03. Set up a Swap Space

You can now mark the file as swap space with the mkswap command.

sudo mkswap /swapfile

You will receive the output similar to this.

04. Enable Swap Space

Enable the swap space and allow the system to utilise the space.

sudo swapon /swapfile

Verify that the swap is available by typing:

sudo swapon --show

You can check the output of the free utility again.

free -h 05. Making the Swap File Permanent

Now swap space is only created for the current session. If you reboot the server the current changes will be gone. So you can make this setting permanent by adding the swap file to our /etc/fstab file.

sudo nano /etc/fstab

Add the following at the end of the file.

/swapfile swap swap defaults 0 0 Configure Swappiness Value

The swappiness parameter allow to configure how often your system swaps data out of RAM to the swap space.

This value will be between 0 to 100 in percentage. The values close to zero, the kernel will not swap data to the disk unless absolutely necessary. The higher the value that are closer to 100 will try to put more data into swap in an effort to keep more RAM space free.

So, telling the system not to rely on the swap much will generally make your system faster.

You can see the current swappiness value by typing:

cat /proc/sys/vm/swappiness

Now set the value to 10 with the following command.

sudo sysctl vm.swappiness=


You can make this value permanent by adding the line to your /etc/sysctl.conf file.

At the bottom, add the following line.


Hit Ctrl+X followed by Y and Enter to save and close the file.

Removing Swap Space

Finally, delete the swap file.

sudo rm /swapfile Conclusion

Now you have learned how to create a swap file, activate, configure swap space and remove the swap space on your Ubuntu 18.04 server in Google Cloud.

You're reading How To Add Swap Space On Ubuntu 18.04 – Google Cloud

How To Add Google Analytics To WordPress

Google Analytics is a free comprehensive tool that allows you to track your web traffic and data.

Google Analytics will show you how many people visit your site, individual pages, conversions, and how people interact with your content. This data is critical for the optimization of your website.

There are two types of Google Analytics code.

You may be accustomed to the Google Universal Analytics (UA) code. This is being sunsetted and replaced with Google Analytics 4 (GA4).

GA4 is much more customizable and applies to websites or apps, whereas Google UA can only be applied to websites.

Setting Up Google Analytics On Your Website

The first thing you will want to do is set up your free Google Analytics account.

You will be prompted to sign in with a Gmail account. Once you do that, you will be logged in.

Select the button that says Start Measuring.

The next screen will have you create an account name. You can track more than one site under one account, so you might want to use something broad, such as the name of your business.

Next, you will want to set up properties. This should include the name of your website, the time zone, and the currency used for this business’s location.

The next screen will ask a little bit about your business and how you intend to use Google Analytics.

Next, you will want to set up the data stream.

When adding Google Analytics to a WordPress site, you will want to select “web stream.”

You will next add your site’s URL and the site’s name.

Once you hit the Create Stream button, you will see the stream name, stream URL, stream id, and measurement id.

The measurement id is what you will use to add to your website.

Adding Google Analytics To Your WordPress Website

There are three different ways to add Google Analytics to any WordPress site.

The best option for you will depend on your comfort level with making changes to your website code.

The first option uses a WordPress plugin to add Google Analytics to your website without requiring coding.

The second option uses a WordPress plugin with a small amount of code required to be copied and pasted.

The third option requires you to edit the code in the theme files of your website.

1. Using The Google Analytics Plugin

The easiest way to add your Google Analytics tag code to WordPress is with a plugin.

Google Analytics for WordPress by MonsterInsights is the most popular and makes it simple to add your Google Analytics code to your site.

Step 1: Install and activate the MonsterInsights plugin.

Step 2: Launch the Wizard to fill in information about your site and hit the Connect MonsterInsights button. This will take you through a few pages of settings that should be pre-selected for your setup.

Step 3: Next, you will be prompted to sign into your Gmail account, asking for permission to access your Google account.

Step 5: Hit Complete Connection to connect to your Google Analytics account. It will finish up by offering an upgrade to Pro, but you can select the link at the bottom to finish the installation without upgrading.

You are all set up now, and you will now see Insights in your WordPress dashboard. Reports, Settings, and any other selected tools are now visible in the WordPress dashboard.

2. Using The Header/Footer Script Plugin

The second way to install your Google Analytics tag is with a header/footer plugin.

This method is especially helpful if you want to track different metrics for different pages, as it can be used on specific pages and the entire site.

WPCode Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager is the most popular plugin to insert header and footer code with over 1 million users.

Step 1: Install the Headers and Footers plugin on your WordPress site.

Step 3: Copy the Google Tag code.

Step 4: In your WordPress dashboard, you will see the Code Snippets plugin on the left-hand navigation menu.

Step 5: Select Header & Footer under the drop-down and then paste your code into the Header section.

Step 6: Hit Save Changes.

Optional Step: To add code to a specific page or post, select the page or post and scroll to the bottom. Add the appropriate Google Analytics code in the header section of that page. Hit Update to save your changes.

3. Add Google Analytics Code Snippet Directly To The chúng tôi File

If you are comfortable working directly in your theme code, this is another option for adding your Google Analytics code. Keep in mind that you are directly changing the theme files, so if you change or update your theme, you will lose your Google Analytics code and will need to re-add it every time you update or change the theme.

Step 2: Select the parent theme and the header.php.

WordPress theme files, August 2023 Verifying Your Google Analytics Tags

Once you have your Google Analytics tag installed on your website, you can use the Tag Assistant (Legacy) by Google Chrome Extension to check that your Google Analytics tag is installed and working correctly.

Simply install the Chome extension on your browser, navigate to the WordPress site that you installed Google Analytics on, and it will tell you which tags are present on the site and if there are any errors.

Once Google Analytics Is Installed On Your WordPress Site

Once your Google Analytics tag is installed, you can view the dashboard through the Google Analytics site.

Alternatively, if you selected the MonsterInsight plugin method of installing Google Analytics on your WordPress site, you can view the reports and data from right within your WordPress dashboard.

Google Analytics is a powerful tool to help you understand how visitors are getting to and using your website, how well pages are converting, how many users are visiting your website, and so much more.

Adding the Google Analytics tag to a WordPress site is simple, using one of these three methods:

Google Analytics plugin (such as MonsterInsights).

Header/Footer plugin (such as WPCode).

Add directly to theme chúng tôi file.

You can use the data from Google Analytics to gain valuable insights into your website traffic which will allow you to make improvements.

It’s worth noting that Google Analytics cannot collect data retrospectively, so it’s important to add Google Analytics to your website sooner rather than later to avoid missing any data.

More resources:

Featured Image:Andrey_Popov/Shutterstock

How To Install And Update Google Chrome In Ubuntu

Most users who want to install Google Chrome in Ubuntu tend to use an App Store or go through Ubuntu Software. What they don’t know is that Google Chrome isn’t available in any major Linux distribution archives, so it can’t be installed directly from the Software Center. Here we show you how to install Google Chrome in Ubuntu.

Download and Install Google Chrome

Since Google Chrome is not found in the Software Center, we need to download the installer from its website.

Select the package for your Linux platform. This may be the 64-bit .deb (for Debian/Ubuntu), 64-bit .rpm (for Fedora/openSUSE), or, if you don’t use either of those, you can get a community-supported version.

Note: if you are using Arch Linux, Google Chrome is found in the AUR. You can install it with any of these AUR helpers.

If this didn’t work for you, try a direct download of Google Chrome for Linux.

If prompted, enter your password.

Wait until the Software Installer installs the Chrome browser.

Customize your options.

Enjoy the Google Chrome browser on Ubuntu.

Install Chrome Using Flatpak Library

If you prefer a more direct method of obtaining Chrome, try using Flatpak. Chrome browser is available on Flathub; however, Google doesn’t support or manage the application on the platform, so you will be installing the package at your own risk. (You can learn how to install Flatpak on Ubuntu and other distributions.)

Open the Terminal and type the following command:




Press Y , then Enter.

Let the Terminal download packages and install the browser.

Chrome will be installed successfully on Linux PC.

Open the menu and search for the browser.

There are a few ways to update Google Chrome on your Ubuntu machine. By default, on a regular update, the system will update Google Chrome, too. But if it fails to update on its own, you can use any of the following methods to manually update Google Chrome on your machine.

Use Software Center

Search and open “Software Center” from the menu.

Note: if your Ubuntu Software center is not working, we have fixes here.

Use Command Line

Open a terminal.

Run the sudo apt update command in the Terminal.

Type sudo apt --only-upgrade install google-chrome-stable command to upgrade Google Chrome only.

Use Software Updater

Open “Software Updater” from the menu.

Select “Other Software” from the top menu.

Check the box beside the APT Line of the Google repository and close the window.

The Software Updater will notify you of new software updates when they are available for your computer.

Tip: not keen on using Ubuntu? Check out other Debian-based Linux distributions here.

Frequently Asked Questions Is there a Google Chrome package for 32-bit Ubuntu?

No, Google axed the Chrome 32-bit version in 2023.

Is Flatpak Google Chrome safe?

While Flatpak is an open-source project, the Chrome package on the platform isn’t monitored or managed by Google. You have to install it at your own risk.

Do I need to add the Google Chrome repository separately?

The Chrome DEB or RPM package has the repository info and saves it in the computer after installation. You don’t have to register the repository separately.

Do I have to update the Flatpak packages separately?

Flatpak updates appear along with the system updates. You don’t have to add the Flathub repository or download additional tools to receive or update the applications. Use the universal command sudo apt update and install Flatpak app updates.

All screenshots by Krishna Kumar Silvery.

Krishna Kumar

I’m a passionate writer.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

How To Install Nginx On Ubuntu 20.04

How to Install Nginx on Ubuntu 20.04 – Google Cloud. Nginx is high performance light-weight HTTP and reverse proxy web server capable of handling large websites.

In this guide you are going to learn how to install Nginx on Ubuntu 20.04 and configure Firewall.

This setup is tested on Google Cloud so you can try this setup on any cloud servers like AWS, Azure or any VPS or dedicated servers.


Your Compute Engine Instance running.

For setting up Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 20.04.

Install Nginx

Nginx is available in the Ubuntu 20.04 repositories by default, so you can install Nginx directly using the apt command.

sudo apt install nginx

This will install Nginx and all required dependencies.

Configure Firewall

Now you can set up Uncomplicated Firewall (UFW) with Nginx to allow public access on default web ports for HTTP and HTTPS

sudo ufw app list

You will see all listed applications.


Available applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH

Nginx Full: This opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)

Nginx HTTP: This opens port 80 (normal, unencrypted web traffic)

Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)

OpenSSH: This profile opens port 22 for SSH access.

If you are not going to use SSL you need to enable only the Nginx HTTP.

Now we will enable Nginx Full.

sudo ufw allow 'Nginx Full'

With this command you can view the status of UFW.

sudo ufw status

You will see the output as follows.


Status: active To Action From Nginx Full ALLOW Anywhere OpenSSH ALLOW Anywhere Nginx Full (v6) ALLOW Anywhere (v6) OpenSSH (v6) ALLOW Anywhere (v6) Check Nginx Installation

Once Nginx is installed it will be started automatically and already be up and running.

Every process in Nginx is managed with the systemctl or service command.

Check the status of Nginx with the following command.

sudo systemctl status nginx


nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2023-05-01 10:47:23 UTC; 8s ago Docs: man:nginx(8) Main PID: 3762 (nginx) Tasks: 2 (limit: 682) Memory: 5.0M CGroup: /system.slice/nginx.service ├─3762 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─3763 nginx: worker process

Now if you check the External IP address of your VM instance, you will see the default Nginx welcome page.

Common Nginx Commands

To start Nginx web server.

sudo systemctl start nginx

To stop Nginx webserver.

sudo systemctl stop nginx

To restart Nginx web server.

sudo systemctl restart nginx

To check Nginx configuration.

sudo nginx -t

Prepare yourself for a role working as an Information Technology Professional with Linux operating system


Now you have learned how to install Nginx on Ubuntu 20.04.

How To Add Pages To A Google Docs Document

In this blog post, we will explore how easy it is to add additional pages to a Google Docs document in simple steps. We will also give you tips on removing page breaks, inserting page numbers, and adding a table of contents to give you all the tools you need to work on your project. Also, if you plan on becoming a Google Docs power user, check out our guide on Google Docs keyboard shortcuts.

Table of Contents

How to Add a Page in Google Docs on Desktop PC

Google Docs decides when you’ve reached the end of the page, and it’ll automatically start a new blank page as you type. However, if you want to create a new page at a custom spot instead of letting Google Docs decide, all you have to do is insert a page break. Here’s how to do it:

Open your document.

Go to


in the toolbar menu.



from the drop-down menu, and then

Page break

from the side menu.

Alternatively, you can use keyboard shortcuts to insert a page break. Just press Ctrl + Enter on your keyboard.

You’ll notice more options in a side menu than just a Page break. You can also select Section break (next page) to add a page. However, a Section break (continuous) is not a good option as it’ll only start a new section on the same page instead of adding a new one.

Page Break is an excellent option if your document has a heading or if you are close to the bottom of the page but need to start a new paragraph. You can also use it to divide your documents into topics or categories and have each one of them start on a new page.

How to Add a Page in Google Docs on a Mobile Device

Adding a Page break in Google Docs on a mobile device is just as simple as doing it on a desktop. However, the steps are slightly different:

Open the Google Docs file on your Android or iOS device.

Go to the little

pencil icon in the lower left corner of the screen.

Tap the screen on the document where you’ll insert a page break. This’ll place a cursor on that spot.

Tap the plus button at the top of the screen.



menu will pop up. Scroll down and select

Page break


Congrats, you added a new page to your Google Docs document on your smartphone! As you can see, the process is straightforward. Now you can manage the layout of your documents on the go.

How to Remove Page Breaks

So you decided that you need to remove the page break. Place your cursor below the break and press Backspace on your keyboard to delete the page break. That’s it!

Organize Your Ideas in Google Docs

Working in Google Docs can be a great way to organize multiple ideas into one shared document. By taking the time to add pages during the document creation process, you can use it as a digital hub for even more content. This will make it much easier for you to format and organize your thoughts and make collaborations with others simpler and quicker. Although using multiple pages adds complexity to a Doc, they are an invaluable asset if you’re working on extensive projects or writing long-form pieces of any kind. Also, don’t forget you can insert page numbers as well to keep everything better organized.

Use A Load Balancer On Google Cloud To Host Web Applications

This article was published as a part of the Data Science Blogathon.

Introduction What is a Load Balancer, and why do we need it?

Load Balancer is a must comp xtra servers and machines to the existing infrastructure so that it can cope with the new demands. So there is a requirement for an infrastructure that can distribute the load between these servers, so Load Balancer (LB) comes into the picture.

Load Balancer on works between the client-server. It takes requests from the client and distributes these requests to the server using various algorithms. It reduces the load on individual systems and also improves fault tolerance.

Nowadays, a load balancer has become a critical infrastructure. Every company wants more reliable systems, fewer downtimes, and more availability and responsiveness. Load Balancer also keeps track of the active and healthy servers. If one server fails, the Load Balancer stops sending requests to that server. It also automatically adds or removes the servers according to the demand.

This tutorial shows how we can implement these Load Balancers practically.

Creating VM Instance Te

1. Log in to Google Cloud Platform.

2. Create a new project inside it.

Note: You need a billing account to use a Load Balancer as it is a paid service.

5. Name your instance template and choose the configurations for your VM.

Note: You can also see your monthly cost of the VM according to your configurations.

6. Select the Disk Size.

7. Choose your Service Account, or you can choose the default one also. Also, allow both HTTP and HTTP(s) traffic.

We are now ready to create Instance Groups using these Instance Templates.

Creating Instance Groups

In this section, we will create a group of servers. A Load Balancer requires that all instances in the network be from the same group.

3. Go to New managed instance group(stateless)

Enter the name of your instance group

Select the instance template that we created earlier.

Select the region of the servers. You can also select multiple zones to keep different servers at different locations.

4. Keep the autoscaling mode as off. Autoscaling can automatically add or remove servers depending on the load condition. But we keep it off and only use a fixed amount of servers.

5. Select the number of instances that you want to use. For this tutorial, we keep them as two.

7. Your instance group is now created, having two running instances.

Creating a Load Balancer

There are three types of Load Balancers-




HTTP(s) is best to divide the traffic of a web application.

3. Choose HTTP(s) Load Balancing service.

Setting Configurations

1. Backend Configuration

Name your load balancer, and navigate to Create a Backend Service.

Enter the name of your backend service, and choose backend type as Instance group.

Select the instance group we created earlier and enter the same port number you have previously entered in your instance group (Port Number can also appear automatically).

2. Creating Health Checks

Health checks ensure that the instances are correctly working or not. It periodically sends requests to our instances and checks whether the backend is responding or not.

Enter the Name of your Health Check and select HTTP Protocol with the Port that you have chosen earlier.

Your Load Balancer is now ready to use

You get your Load Balancer’s Frontend IP address. When you hit that IP address, the load balancer can internally divide the request between the two instances. You may also link the Load Balancer’s IP address to a domain name.

Hurray🎉, your Load Balancer is finally created. Now you can host your web applications on the two instances.


One of Google Cloud’s functions is the Load Balancer. We learned how to establish a Load Balancer in the Google Cloud Platform in this lesson. You may also experiment with different services such as Vision AI, Cloud Storage, Content Delivery Networks, Kubernetes Engine, etc.

A dedicated load balancer like this will cost you money. Still, you can also set up web servers like Nginx and Apache, providing load balancing and a reverse proxy. They aid in enhancing the performance, scalability, and stability of your online applications, and they are open source and free to use.

4. Finally, we can use our load balancer by hitting its frontend IP address. The load balancer would automatically distribute the load among all the servers in that particular group.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.


Update the detailed information about How To Add Swap Space On Ubuntu 18.04 – Google Cloud on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!