Sign In
Sign In

How to Install and Use Composer on Ubuntu

How to Install and Use Composer on Ubuntu
Hostman Team
Technical writer
Ubuntu PHP
14.02.2025
Reading time: 10 min

Composer is a cross-platform tool for managing dependencies in projects written in PHP.

With Composer, you can manage numerous libraries and frameworks, known as "packages." Installing the required packages allows you to extend the standard PHP functionality, speeding up and simplifying development. All installed packages become project dependencies.

Thus, Composer can be considered a full-fledged dependency manager, similar to those used in many programming languages.

Additionally, Composer has a comprehensive package repository called Packagist, where you can search for, download, and install the required packages.

This guide provides detailed instructions on installing Composer on an Ubuntu server and using it for PHP projects.

Prerequisites

In this tutorial, we use:

  • A VPS server running Ubuntu 22.04
  • PHP interpreter version 8.1.2
  • Composer dependency manager version 2.8.2

Installing Composer

First, update the list of existing APT repositories:

sudo apt update

Next, install the packages required to download and use Composer:

sudo apt install curl php-cli unzip -y

These packages include:

  • curl: A tool for making HTTP requests.
  • php-cli: An interpreter to run PHP scripts.
  • unzip: A utility to extract ZIP archives.

The -y flag answers "yes" to all installation prompts.

Composer installation is automated using a PHP script provided by its developers.

Download the installation script from the official Composer website using an HTTP request:

curl -sS https://getcomposer.org/installer -o composerInstall.php
  • The -sS flag runs curl in silent mode, suppressing all output except for errors.
  • The -o flag specifies the filename and the directory where the file will be placed.

To ensure the file has been downloaded, check the contents of the current directory:

ls

You should see the following output in the terminal, including the installation script:

composerInstall.php  resize.log  snap

This guide covers the global installation of Composer, meaning it can be run from any directory without specifying the absolute path.

To perform a global installation, execute the downloaded PHP script with additional parameters:

php composerInstall.php --install-dir=/usr/local/bin --filename=composer
  • The --install-dir flag specifies the directory where Composer will be installed.
  • The --filename flag defines the name of the binary file accessible from the terminal.

In this case, Composer is installed in the system's binary directory: /usr/local/bin.

After running the script, you'll see the following output in the terminal:

All settings correct for using Composer  
Downloading...  

Composer (version 2.8.2) successfully installed to: /usr/local/bin/composer  
Use it: php /usr/local/bin/composer

Since the installation script is no longer needed, you can delete it:

rm composerInstall.php

To launch Composer for the first time, run:

composer

You may see the following message in the terminal:

Do not run Composer as root/super user! See https://getcomposer.org/root for details  
Continue as root/super user [yes]?

Composer warns against running it as the root user due to potential risks but allows you to proceed.

For this guide, we will continue using Composer as-is by confirming with yes.

Afterward, you will see a welcome message along with a list of available options and commands with brief descriptions.

Composer is now fully installed.

Configuring Composer

The main file used to manage dependencies is composer.json, which describes the packages required for the proper functioning of a project.

Composer follows the Infrastructure as Code (IaC) approach, describing the local project infrastructure through a configuration file rather than manual settings adjustments in a graphical interface.

However, Composer allows configuration management not only by manually editing the file in a text editor but also through console commands, providing a more interactive way to handle configurations.

Basic Commands

Using Composer involves several fundamental commands that interact with the composer.json configuration file:

  • init: Initializes a project.
  • require: Adds a package.
  • install: Installs dependencies.
  • update: Updates packages.

Although Composer offers many more commands, these are the most frequently used.

Creating a Directory

Create a separate directory for the PHP project:

mkdir phptest

Then navigate to the directory:

cd phptest

This directory will store both the project’s source code and the required dependency files.

Searching for a Library

Suppose we are working on a small project that performs various string transformations. As a dependency, we need a specific library that provides functions for manipulating string content.

In this guide, we will implement a common programming function called slugify, which converts a sequence of words into a single long word containing only lowercase ASCII characters and hyphens.

The slugify function is often used to transform arbitrary headings into URL-friendly formats without spaces.

Rather than writing this function ourselves, we will use Composer to find a suitable library in the official package registry, add it as a dependency, and let Composer handle its download, installation, and integration into the project.

To find the necessary library, follow these steps:

  1. Open the Composer's official package registry in a browser.
  2. Enter "slugify" in the search bar.
  3. Look for the most suitable package based on its parameters and description.

The search results display key metrics for each available package:

  • The number of installations via Composer (top right)
  • The number of GitHub stars (bottom right)

Image1

In general, popular packages tend to be more stable since they are used by a larger number of developers.

Selecting a Package

In this guide, we will use the package cocur/slugify.

The package name, similar to a GitHub repository, contains the author (provider) and the library name separated by a forward slash (/).

We can navigate to the package's page by clicking its name to see more details about the library’s implementation, such as dependency lists, descriptions with code examples, test coverage badges, license type, and more.

Additionally, pay attention to the available package versions, as you need to specify the version during dependency installation.

By following this process, you can search for and select suitable packages for a PHP project, which can later be used as dependencies to provide specific functions.

Installing a Dependency

To install the required package, use the require command. This either records the dependency in the composer.json configuration file or creates it if it does not exist:

composer require cocur/slugify:4.6

In this guide, we are using cocur/slugify version 4.6.0.

After running the command, you might encounter an error indicating missing system libraries:

./composer.json has been created
Running composer update cocur/slugify
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires cocur/slugify 4.1 -> satisfiable by cocur/slugify[v4.1.0].
- cocur/slugify v4.1.0 requires ext-mbstring * -> it is missing from your system. Install or enable PHP's mbstring extension.

This console output informs us that the ext-mbstring system library is missing, which is necessary for cocur/slugify to work correctly.

You can manually search for the library using the APT package manager:

sudo apt search mbstring

The search results will show:

Sorting... Done
Full Text Search... Done
php-mbstring/jammy 2:8.1+92ubuntu1 all
  MBSTRING module for PHP [default]

php-patchwork-utf8/jammy 1.3.1-1 all
  UTF-8 strings handling for PHP

php-symfony-polyfill-mbstring/jammy 1.24.0-1ubuntu2 all
  Symfony polyfill for the Mbstring extension

php-symfony-polyfill-util/jammy 1.24.0-1ubuntu2 all
  Symfony utilities for portability of PHP codes

php8.1-mbstring/jammy-updates,jammy-security 8.1.2-1ubuntu2.19 amd64
  MBSTRING module for PHP

The first result is the library we need. Install it with:

sudo apt install php-mbstring -y

Once the missing library is installed, rerun the command to install the package:

composer require cocur/slugify:4.6

This time, the console output should confirm a successful installation:

./composer.json has been created
Running composer update cocur/slugify
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking cocur/slugify (v4.6.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading cocur/slugify (v4.6.0)
  - Installing cocur/slugify (v4.6.0): Extracting archive
Generating autoload files
No security vulnerability advisories found.

Check the directory contents with:

ls

You will see new files generated by Composer:

composer.json  composer.lock  vendor

Each file and directory serves a specific purpose:

  • composer.json — Contains information about the required dependencies
  • composer.lock — Records details about installed dependencies
  • vendor — Stores the project’s installed dependencies

If you use a version control system like Git, exclude the vendor directory from the repository.

Take a look inside composer.json:

cat composer.json

It should look like this:

{
    "require": {
        "cocur/slugify": "4.6"
    }
}

You’ll notice the require block specifying the package cocur/slugify version 4.6. You can find more detailed information about possible version values in the official Composer documentation.

Using Composer

Including Dependencies

Once you have installed a dependency, you can include it in the project code using the automatically generated autoload.php script, located in the vendor directory.

When this script is included in the PHP application, the functions and classes of the installed dependencies become available for use.

Let's create the main file of our application:

sudo nano main.php

Then, fill it with the following content:

<?php
require __DIR__ . '/vendor/autoload.php';

use Cocur\Slugify\Slugify;

$slugify = new Slugify();

// PHP_EOL is needed for line breaks in the console

echo '[english]: ' . $slugify->slugify('How to deal with composer') . PHP_EOL;
?>

Now, you can run the script:

php main.php

The output in the console terminal should look like this:

[english]: how-to-use-composer

Updating Dependencies

Composer allows you to check for new versions of libraries based on version ranges defined in the composer.json configuration file:

composer update

Alternatively, you can update a specific package by specifying its name:

composer update cocur/slugify

Installing Dependencies

If your PHP project contains a composer.json file, but the specified dependencies are not yet installed, you need to install them.

Let’s first remove all existing packages and related information:

rm -R vendor composer.lock

The -R flag is necessary for recursive deletion of files and directories.

After that, try running the script:

php main.php

You will see the expected error message in the console because the dependencies are missing:

PHP Warning:  require(/root/phptest/vendor/autoload.php): Failed to open stream: No such file or directory in /root/phptest/main.php on line 2
PHP Fatal error:  Uncaught Error: Failed opening required '/root/phptest/vendor/autoload.php' (include_path='.:/usr/share/php') in /root/phptest/main.php:2
Stack trace:
#0 {main}
  thrown in /root/phptest/main.php on line 2

Now, let's reinstall the dependencies based on the data from the configuration file:

composer install

After that, run the script again:

php main.php

The console should display the expected result without any errors:

[english]: how-to-install-and-use-composer

Conclusion

You can install Composer on Ubuntu 22.04 automatically using an installation script from the official Composer website.

Although Composer has many commands to manage the composer.json configuration file, in practice, only a few basic ones are commonly used:

  • composer init
  • composer require
  • composer install
  • composer update

You can find comprehensive information on how to use Composer in the official documentation.

Ubuntu PHP
14.02.2025
Reading time: 10 min

Similar

Ubuntu

How to Install and Configure SSH on Ubuntu 22.04

SSH is a network protocol that provides a secure connection between a client and a server. All communication is encrypted, preventing theft of data transmitted over the network and other remote network attacks. Let’s say you have ordered a cloud server from Hostman. You will need SSH installed and configured to connect to and administer the server. The guide below will describe how to install SSH on Ubuntu 22.04 and configure it. Prerequisites Before proceeding with the installation and configuration of the Secure Shell service, ensure the following requirements are met: Linux Command Line Skills for Configuration Having a solid grasp of basic Linux commands like sudo, apt, nano, and systemctl is essential when setting up the service. These commands will be frequently used during the installation and configuration process. It's crucial to be comfortable working within the command line environment to manage the service effectively. Root or Sudo Access for Setup To install and configure the server, administrative (root) privileges are required. Users must either have sudo access or be logged in as root. Without these privileges, the setup process cannot proceed. Internet Connection for Package Download A stable internet connection is necessary to install the OpenSSH server and any additional related packages. Without a functional connection, the system cannot retrieve the required software components. Configuring Firewall for Access If a firewall, like ufw, is enabled on the system, it may block remote access by default. It is essential to configure your firewall to allow incoming connections. Use ufw or another firewall tool to ensure port 22 is open and accessible. Access to the System (Local or Remote) You need physical access to your machine to configure the service locally, or it must be remotely accessible via its IP address. Ensure the system is properly connected to the network to establish a connection. Don't forget, that you can deploy your cloud server fast and cheap by choosing our VPS Server Hosting Step 1: Prepare Ubuntu The first thing you need to do before you start installing SSH on Ubuntu is to update all apt packages to the latest versions. To do this, use the following command: sudo apt update && sudo apt upgrade Step 2: Install SSH on Ubuntu OpenSSH is not pre-installed on the system, so let's install it manually. To do this, type in the terminal: sudo apt install openssh-server The installation of all the necessary components will begin. Answer "Yes" to all the system prompts.  After the installation is complete, go to the next step to start the service. Step 3: Start SSH Now you need to enable the service you just installed using the command below: sudo systemctl enable --now ssh On successful startup, you will see the following system message. The --now key helps you launch the service and simultaneously set it to start when the system boots. To verify that the service is enabled and running successfully, type: sudo systemctl status ssh The output should contain the Active: active (running) line, which indicates that the service is successfully running. If you want to disable the service, execute:  sudo systemctl disable ssh It disables the service and prevents it from starting at boot. Step 4: Configure the firewall Before connecting to the server via SSH, check the firewall to ensure it is configured correctly. In our case, we have the UFW installed, so we will use the following command: sudo ufw status In the output, you should see that SSH traffic is allowed. If you don't have it listed, you need to allow incoming SSH connections. This command will help with this: sudo ufw allow ssh Step 5: Connect to the server Once you complete all the previous steps, you can log into the server using the SSH protocol. To do this, you will need the server's IP address or domain name and the name of a user created on the server. In the terminal line, enter the command: ssh username@IP_address Or:  ssh username@domain Important: To successfully connect to a remote server, SSH must be installed and configured on the remote server and the user's computer from which you make the connection.  - Step 6 (optional): Create Key Pair for Secure Authentication For enhanced security, consider configuring a key pair instead of relying on password authentication. To generate one, use the following command: ssh-keygen Step 7: Configure SSH Having completed the previous five steps, you can already connect to the server remotely. However, you can further increase the connection's security by changing the default connection port to another or changing the password authentication to key authentication. These and other changes require editing the SSH configuration file. The main OpenSSH server settings are stored in the main configuration file sshd_config (location: /etc/ssh). Before you start editing, you should create a backup of this file:  sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.initial If you get any errors after editing the configuration file, you can restore the original file without problems. After creating the backup, you can proceed to edit the configuration file. To do this, open it using the nano editor: sudo nano /etc/ssh/sshd_config In the file, change the port to a more secure one. It is best to set values from the dynamic range of ports (49152 - 65535) and use different numbers for additional security. For example, let's change the port value to 49532. To do this, we uncomment the corresponding line in the file and change the port as shown in the screenshot below. In addition to this setting, we recommend changing the password authentication mode to a more secure key authentication mode. To do this, uncomment the corresponding line and make sure the value is "Yes", as shown in the screenshot. Now, let's prohibit logging on to the server as a superuser by changing the corresponding line as shown in the picture below. There are other settings you can configure to increase the server security:  UseDNS checks if the hostname matches its IP address. The value "Yes" enables this parameter. PermitEmptyPasswords prohibits using empty passwords for authentication if the value is "No." MaxAuthTries limits the number of unsuccessful attempts to connect to the server within one communication session.  AllowUsers and AllowGroups are responsible for the list of users and groups allowed to access the server: # AllowUsers User1, User2, User3# AllowGroups Group1, Group2, Group3 Login GraceTime sets the time provided for successful authorization. We recommend reducing the value of this parameter by four times. ClientAliveInterval limits the time of user inactivity. After exceeding the specified limit, the user is disconnected. After making all the changes in the main configuration file, save them and close the editor.  Restart the service to make the changes take effect: sudo systemctl restart ssh If you have changed the port in the configuration file, you should connect using the new port:  ssh -p port_number username@IP_address Or: ssh -p port_number_port_username@domain Troubleshooting Connection Issues Ensure the service is running with: sudo systemctl status ssh Restart it if necessary: sudo systemctl restart ssh Check firewall settings to allow traffic on port 22: sudo ufw allow 22 Confirm the system is reachable by running: ping <server-ip-address> Disabling the Service If you need to disable remote access for any reason, follow these steps: Stop the Service To temporarily stop accepting connections: sudo systemctl stop ssh Prevent Automatic Startup To disable it from starting on reboot: sudo systemctl disable ssh Confirm Inactive Status Verify that the service is no longer running: sudo systemctl status ssh Uninstall the Server If the service is no longer needed, remove it and its associated configuration files: sudo apt remove openssh-server Conclusion This article presents a step-by-step guide on installing and configuring SSH in Ubuntu 22.04 and describes how to edit the main configuration file to improve security. We hope this guide helps you to set up a secure remote connection to your Ubuntu server.To see more about SSH keys click here.
05 June 2025 · 7 min to read
Ubuntu

How to Install VNC on Ubuntu

If you need to interact with a remote server through a graphical interface, you can use VNC technology.VNC (Virtual Network Computing) allows users to establish a remote connection to a server over a network. It operates on a client-server architecture and uses the RFB protocol to transmit screen images and input data from various devices (such as keyboards or mice). VNC supports multiple operating systems, including Ubuntu, Windows, macOS, and others. Another advantage of VNC is that it allows multiple users to connect simultaneously, which can be useful for collaborative work on projects or training sessions. In this guide, we will describe how to install VNC on Ubuntu, using a Hostman cloud server with Ubuntu 22.04 as an example. Step 1: Preparing to Install VNC Before starting the installation process on both the server and the local machine, there are a few prerequisites to review.  Here is a list of what you’ll need to complete the installation: A Server Running Ubuntu 22.04. In this guide, we will use a cloud server from Hostman with minimal hardware configuration. A User with sudo Privileges. You should perform the installation as a regular user with administrative privileges. Select a Graphical Interface. You’ll need to choose a desktop environment that you will use to interact with the remote server after installing the system on both the server and the local machine. A Computer with a VNC Client Installed.  Currently, the only way to communicate with a rented server running Ubuntu 22.04 is through the console. To enable remote management via a graphical interface, you’ll need to install a desktop environment along with VNC on the server. Below are lists of available VNC servers and desktop environments that can be installed on an Ubuntu server. VNC Servers: TightVNC Server. One of the most popular VNC servers for Ubuntu. It is easy to set up and offers good performance. RealVNC Server. RealVNC provides a commercial solution for remote access to servers across various Linux distributions, including Ubuntu, Debian, Fedora, Arch Linux, and others. Desktop Environments: Xfce. A lightweight and fast desktop environment, ideal for remote sessions over VNC. It uses fewer resources than heavier desktop environments, making it an excellent choice for servers and virtual machines. GNOME. The default Ubuntu desktop environment, offering a modern and user-friendly interface. It can be used with VNC but will consume more resources than Xfce. KDE Plasma. Another popular desktop environment that provides a wide range of features and a beautiful design. The choice of VNC server and desktop environment depends on the user’s specific needs and available resources. TightVNC and Xfce are excellent options for stable remote sessions on Ubuntu, as they do not require high resources. In the next step, we will describe how to install them on the server in detail. Step 2: Installing the Desktop Environment and VNC Server To install the VNC server on Ubuntu along with the desktop environment, connect to the server and log in as a regular user with administrative rights. Update the Package List  After logging into the server, run the following command to update the packages from the connected repositories: sudo apt update Install the Desktop Environment  Next, install the previously selected desktop environment. To install Xfce, enter: sudo apt install xfce4 xfce4-goodies Here, the first package provides the basic Xfce desktop environment, while the second includes additional applications and plugins for Xfce, which are optional. Install the TightVNC Server  To install TightVNC, enter: sudo apt install tightvncserver Start the VNC Server  Once the installation is complete, initialize the VNC server by typing: vncserver This command creates a new VNC session with a specific session number, such as :1 for the first session, :2 for the second, and so on. This session number corresponds to a display port (for example, port 5901 corresponds to :1). This allows multiple VNC sessions to run on the same machine, each using a different display port. During the first-time setup, this command will prompt you to set a password, which will be required for users to connect to the server’s graphical interface. Set the View-Only Password (Optional)  After setting the main password, you’ll be prompted to set a password for view-only mode. View-only mode allows users to view the remote desktop without making any changes, which is helpful for demonstrations or when limited access is needed. If you need to change the passwords set above, use the following command: vncpasswd Now you have a VNC session. In the next step, we will set up VNC to launch the Ubuntu server with the installed desktop environment. Step 3: Configuring the VNC Server The VNC server needs to know which desktop environment it should connect to. To set this up, we’ll need to edit a specific configuration file. Stop Active VNC Instances  Before making any configurations, stop any active VNC server instances. In this guide, we’ll stop the instance running on display port 5901. To do this, enter: vncserver -kill :1 Here, :1 is the session number associated with display port 5901, which we want to stop. Create a Backup of the Configuration File  Before editing, it’s a good idea to back up the original configuration file. Run: mv ~/.vnc/xstartup ~/.vnc/xstartup.bak Edit the Configuration File  Now, open the configuration file in a text editor: nano ~/.vnc/xstartup Replace the contents with the following: #!/bin/bashxrdb $HOME/.Xresourcesstartxfce4 & #!/bin/bash – This line is called a "shebang," and it specifies that the script should be executed using the Bash shell. xrdb $HOME/.Xresources – This line reads settings from the .Xresources file, where desktop preferences like colors, fonts, cursors, and keyboard options are stored. startxfce4 & – This line starts the Xfce desktop environment on the server. Make the Configuration File Executable To allow the configuration file to be executed, use: chmod +x ~/.vnc/xstartup Start the VNC Server with Localhost Restriction Now that the configuration is updated, start the VNC server with the following command: vncserver -localhost The -localhost option restricts connections to the VNC server to the local host (the server itself), preventing remote connections from other machines. You will still be able to connect from your computer, as we’ll set up an SSH tunnel between it and the server. These connections will also be treated as local by the VNC server. The VNC server configuration is now complete. Step 4: Installing the VNC Client and Connecting to the Server Now, let’s proceed with installing a VNC client. In this example, we’ll install the client on a Windows 11 computer. Several VNC clients support different operating systems. Here are a few options:  RealVNC Viewer. The official client from RealVNC, compatible with Windows, macOS, and Linux. TightVNC Viewer. A free and straightforward VNC client that supports Windows and Linux. UltraVNC. Another free VNC client for Windows with advanced remote management features. For this guide, we’ll use the free TightVNC Viewer. Download and Install TightVNC Viewer Visit the official TightVNC website, download the installer, and run it. In the installation window, click Next and accept the license agreement. Then, select the custom installation mode and disable the VNC server installation, as shown in the image below. Click Next twice and complete the installation of the VNC client on your local machine. Set Up an SSH Tunnel for Secure Connection To encrypt your remote access to the VNC server, use SSH to create a secure tunnel. On your Windows 11 computer, open PowerShell and enter the following command: ssh -L 56789:localhost:5901 -C -N -l username server_IP_address Make sure that OpenSSH is installed on your local machine; if not, refer to Microsoft’s documentation to install it. This command configures an SSH tunnel that forwards the connection from your local computer to the remote server over a secure connection, making VNC believe the connection originates from the server itself. Here’s a breakdown of the flags used: -L sets up SSH port forwarding, redirecting the local computer’s port to the specified host and server port. Here, we choose port 56789 because it is not bound to any service. -C enables compression of data before transmitting over SSH. -N tells SSH not to execute any commands after establishing the connection. -l specifies the username for connecting to the server. Connect with TightVNC Viewer After creating the SSH tunnel, open the TightVNC Viewer and enter the following in the connection field: localhost:56789 You’ll be prompted to enter the password created during the initial setup of the VNC server. Once you enter the password, you’ll be connected to the VNC server, and the Xfce desktop environment should appear. Stop the SSH Tunnel To close the SSH tunnel, return to the PowerShell or command line on your local computer and press CTRL+C. Conclusion This guide has walked you through the step-by-step process of setting up VNC on Ubuntu 22.04. We used TightVNC Server as the VNC server, TightVNC Viewer as the client, and Xfce as the desktop environment for user interaction with the server. We hope that using VNC technology helps streamline your server administration, making the process easier and more efficient. We're prepared more detailed instruction on how to create server on Ubuntu if you have some trouble deploying it.
30 May 2025 · 8 min to read
Ubuntu

How to Install Google Chrome on Ubuntu 24.04

If you started using the internet post 2008, it is very likely that your first interaction over the internet was via Google Chrome web browser. People were frustrated with Microsoft Internet Explorer (which has reached its end of life and has now been discontinued), so when Google launched its proprietary product, Google Chrome, it was met with great demand, and hundreds of thousands of people switched to Chrome from Internet Explorer.  The reason for this switch was obvious, Chrome was definitely much faster and sleek in comparison to Internet Explorer and it offered a unique user experience. Within 4 years after its launch date, Chrome overtook Internet Explorer in terms of having the most users. Let’s switch gears now and move to the crucial part where we’ll talk about downloading and installing Chrome on Ubuntu 24.04 LTS which happens to be the latest OS at the time. Method 1: Installing Google Chrome via Graphical Interface (GUI) The first method is straight as an arrow and needs no extra skills other than the ability to operate a personal computer. Go ahead and search the term ‘Google Chrome’ in the browser bar.  Of course, you need a browser for this. Nothing to worry about as Ubuntu has a browser that comes built-in, this built-in browser is Firefox. Follow along, see where the arrows are pointing in the screenshots and download the 64 bit .deb (For Debian/Ubuntu).  Once you select the right version, go ahead and click on Accept and Install. Go to the directory where this package is downloaded, in my case, it is downloaded within my Downloads directory. Click on the file twice so it opens up in the Software Center where you will see a green Install button. Click that. Again, click on Install. After following along, complete the authentication by putting in your password. After installation is done, go to apps and search for ‘Google Chrome’. You can click on it to open it and then you can start using it.  Method 2: Installing Google Chrome via Terminal Update Package Information Updating package information is easy, run the update command:  sudo apt update Download Chrome with wget Use the wget utility to download Chrome from the provided URL: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb This URL is the external source from where you can acquire the stable version of Chrome. Chrome is now downloaded but not yet installed. Install Chrome using dpkg To install this package you need to use the Debian package manager dpkg with the -i flag which indicates the installation. sudo dpkg -i google-chrome-stable_current_amd64.deb Fix Dependency Errors During our procedure, we didn’t come across any dependency error, if you face any then you can use the following command: sudo apt install -f Or: sudo apt-get install -f Run Google Chrome You can either open the browser from GUI or you can run this command and open the browser from within the terminal: google-chrome-stable Method 3: Installing Beta or Unstable Versions of Google Chrome Installing Google Chrome Beta Some developers get super excited when it comes to testing the versions of different products before the general public. If you are one of them, you can install Google Chrome’s beta version. Download Beta Google Chrome  Use wget with the direct URL pointing to an external source from where you can download the beta package of the browser: wget https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb Install Beta Google Chrome sudo dpkg -i google-chrome-beta_current_amd64.deb If dependency errors pop up, just use the command shown in Method 2. Run Beta Google Chrome  Open beta version using terminal: google-chrome-beta The beta version of this browser runs smoothly without any issues, if you see any warnings in the terminal simply ignore it and you can use the beta version without any hassle.  Install Unstable Google Chrome If you are someone who likes to do testing way in advance and you are okay with multiple crashes, you can install Unstable Google Chrome.  Unstable Google Chrome has feature access before Beta Chrome. Main difference between Beta Google Chrome and Unstable Google Chrome is that Beta is updated every 4 weeks while Unstable is updated every day. Download Unstable Google Chrome  wget https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb Install Unstable Google Chrome sudo dpkg -i google-chrome-unstable_current_amd64.deb Run Unstable Google Chrome google-chrome-unstable Unstable versions of Chrome run smoothly, warnings or errors might pop up but you can ignore those, it works ok.  Additional Tips As Ubuntu’s default repository does not have Chrome due to proprietary rights, Google Chrome creates its own repo in your system and it updates each time you update your default repository. sudo apt update && sudo apt upgrade Conclusion A vast number of Linux users prioritize their privacy and prefer open-source products. If this is you, you might be aware that Google Chrome is a proprietary product and is owned by Alphabet (parent company of Google) which means it's not open source. If you are looking for something similar and also open source then Chromium is a great browser to consider. Google Chrome came with the concept of extensions and Google enabled them by default in 2009. These extensions extended the performance of the Chrome web browser and offered additional options to accomplish many things in much easier ways than previously. The main thing that really made Chrome “The King of The Market” was its speed and the ability to get updates for new versions. Google Chrome was able to fix issues much faster than competitors and users had a fine way to access all Google Products in one place.  The birth of the Chrome browser was the result of the problems Google workers faced with the browsers in the market at the time. They created a ‘Just Built For Them’ product which was actually what was needed in the market. Internet Explorer was the most used browser at the time but it was slow. It took Google Chrome just a few years to beat Internet Explorer in the market and in the upcoming decade, it completely wiped it off. 
23 May 2025 · 5 min to read

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support