package manager – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 04 Jan 2023 10:46:50 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 12 Apt Command Examples in Ubuntu & Debian Linux https://tecadmin.net/apt-command-in-linux/ https://tecadmin.net/apt-command-in-linux/#comments Tue, 03 Jan 2023 15:35:28 +0000 https://tecadmin.net/?p=33552 The apt command is one of the most powerful and versatile tools in the Linux operating system. It provides users with a powerful, yet easy-to-use, package management system that can be used to easily manage and install the software. With the apt command, users can quickly and easily search for, install, upgrade, and uninstall software [...]

The post 12 Apt Command Examples in Ubuntu & Debian Linux appeared first on TecAdmin.

]]>
The apt command is one of the most powerful and versatile tools in the Linux operating system. It provides users with a powerful, yet easy-to-use, package management system that can be used to easily manage and install the software. With the apt command, users can quickly and easily search for, install, upgrade, and uninstall software applications from their systems.

This guide provides a detailed overview of the apt command and explains how to use it to manage software on a Linux system. It explains the different commands and options available and outlines how to use them to manage software, resolve software dependencies, and keep your system running smoothly and efficiently.

The apt package manager is used in several Linux distributions, including:

  • Debian and its derivatives (such as Ubuntu and Linux Mint)
  • Kali Linux
  • Linaro
  • SteamOS

Updating Apt Index (apt update)

Before you can use the Apt package manager, you will need to update the package repositories. The package repositories are online databases that contain information about available packages. To update the package repositories, use the update command:

sudo apt update 

This will download the latest package information from the repositories.

Installing Packages (apt install)

By default, the Apt package manager will install the latest available version of a package. To install a package named `foo` type:

sudo apt install foo 

However, sometimes you may need to install a specific version of a package. To do this, use the = operator followed by the version number when installing the package. For example, to install version 1.2 of the package foo, run the following command:

sudo apt install foo=1.2 

Searching for a Package (apt search)

You can use the `apt search` command followed by the search string. For example, to search for packages related to the word “foo”, run the following command:

sudo apt search foo 

This will display a list of packages that match the keyword.

Keep Your System Up to Date (apt ugprade)

One of the most important best practices for managing packages with the Apt package manager is to keep your system up to date. New versions of packages are released regularly to fix bugs and security vulnerabilities. To update your system, use the upgrade command:

sudo apt upgrade 

This will upgrade all installed packages to their latest available version.

To upgrade a specific package, you should use the apt install command with the `--only-upgrade` option.

sudo apt --only-upgrade install foo 

This will install the latest version of the package only if it is already installed.

Downgrading a Package to a Previous Version

To downgrade a package to a previous version, use the install command with the = operator and the version number of the previous version. For example, to downgrade the package foo to version 1.2, run the following command:

sudo apt install foo=1.2 

Note that this will overwrite the current version of the package, so be sure to make any necessary backups before downgrading.

Remove Packages (apt remove)

You can use the `apt remove` command to remove specific packages. For example, to remove the package foo, run the following command:

sudo apt remove foo 

This will remove the package, but it will leave behind any dependencies that are still needed by other packages.

Removing Unused Dependencies (apt autoremove)

When you install a package, it may bring in other packages as dependencies. These dependencies are required for the package to function correctly. However, once you remove the package, these dependencies may no longer be needed. To remove these unused dependencies, use the autoremove command:

sudo apt autoremove 

This will remove any dependencies that are no longer needed by any installed packages.

Use Apt Pinning to Control Package Upgrades

Apt pinning allows you to control which packages are upgraded and when they are upgraded. This can be useful if you want to prevent a specific package from being upgraded to a newer version. To use Apt pinning, you will need to edit the /etc/apt/preferences file and add a pinning rule.

For example, to prevent the package foo from being upgraded, add the following line to the `/etc/apt/preferences` file:

Package: foo
Pin: version *
Pin-Priority: 1001

This will prevent the package foo from being upgraded, but it will still be updated if a security vulnerability is discovered.

Use Apt Snapshots to Roll Back Package Upgrades

Apt snapshots allow you to roll back package upgrades to a previous version if something goes wrong. To create a snapshot, use the apt-mark command to mark all installed packages as “manual”:

sudo apt-mark manual `apt-mark showmanual` 

Then, use the apt-get command to create a snapshot:

sudo apt-get install apt-rdepends 
sudo apt-rdepends -d --state-show=installed package_name > apt-snapshot.txt 

Replace “package_name” with your package name. This will create a snapshot file called apt-snapshot.txt that contains a list of all installed packages and their dependencies. To roll back to a previous snapshot, use the apt-get install command and specify the snapshot file:

sudo apt-get install --reinstall -y \
      -o APT::Get::ReInstall=true \
      -o APT::Get::Show-Upgraded=true \
      -o Debug::pkgProblemResolver=true \
      -f -V < apt-snapshot.txt 

Show Pacakge Information (apt show)

This command allows you to view all the information about a specific package, including its version, its dependencies, and more. With apt show, you can quickly find out what a certain package does, and whether it's right for your system. You can also check to make sure that you have the latest version of a package, or even downgrade it if necessary. So if you're a Linux user looking for detailed package information.

sudo apt show foo 

So if you're a Linux user looking for detailed package information, you can use `apt show` to find it quickly and easily.

Cleaning the Package Cache (apt clean)

The Apt package manager keeps a cache of all the packages that you have installed or downloaded. Over time, this cache can become large and take up a lot of disk space. To clean the package cache and free up disk space, use the clean command:

sudo apt clean 

This will remove all the packages from the cache that are no longer needed.

Conclusion

In this article, we covered some advanced techniques for using the Apt package manager. We showed you how to install a specific version of a package, upgrade all packages to their latest version, downgrade a package to a previous version, remove unused dependencies, and clean the package cache. These techniques can help you more effectively manage packages on your Linux system.

The post 12 Apt Command Examples in Ubuntu & Debian Linux appeared first on TecAdmin.

]]>
https://tecadmin.net/apt-command-in-linux/feed/ 1
How to Install Yarn on Ubuntu 20.04 https://tecadmin.net/install-yarn-ubuntu-20-04/ https://tecadmin.net/install-yarn-ubuntu-20-04/#comments Thu, 30 Apr 2020 01:46:13 +0000 https://tecadmin.net/?p=21245 Yarn is the fast, reliable, and secure package management system for Nodejs application. it have multiple benefit over the npm. Yarn makes a cache for every package downloaded on your system and reuse when required again. It doesn’t need to download it again and again. This tutorial provides 3 methods to install Yarn on Ubuntu [...]

The post How to Install Yarn on Ubuntu 20.04 appeared first on TecAdmin.

]]>
Yarn is the fast, reliable, and secure package management system for Nodejs application. it have multiple benefit over the npm. Yarn makes a cache for every package downloaded on your system and reuse when required again. It doesn’t need to download it again and again.

This tutorial provides 3 methods to install Yarn on Ubuntu 20.04 LTS (Focal Fosaa) Linux system. You can choose one of the below methods as per your choice and system environments.

Before you begin yarn installation, don’t forgot to install Node.js on your system.

1. Install Yarn on Ubuntu 20.04 (Using PPA)

Yarn provides an official repository for the installation on Linux system. Using the PPA, yarn install globally on system. Every system user can access this yarn.

First, import the GPG key to verify the yarn packages before the installation.

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Then, enable the Yarn package manager repository, type:

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Next, run below commands to install yarn on Ubuntu 20.04 Linux system:

sudo apt update && sudo apt install yarn

Once the installation finished, check the installed yarn version
.

yarn --version

1.22.5

2. Install Yarn on Ubuntu 20.04 (Using NPM)

Yarn package manager also available as a npm module. You can install Yarn on Ubuntu 20.04 using the module by executing command:

npm install -g yarn

The “-g” option will install the yarn globally on your system. So you can access it from any where or any project of your system.

3. Install Yarn on Ubuntu 20.04 (Using Script)

You can also use the bash script to install yarn provided by the yarn team. The script installed yarn under to users home directory. It means, when you install yarn with this script will accessible to current user only.

To install Yarn on Ubuntu 20.04 using a shell script, type:

sudo apt install curl -y
curl -o- -L https://yarnpkg.com/install.sh | bash

The installer makes yarn environment configuration in users .bashrc file. You can reload this file to load environment

source ~/.bashrc

All done. Yarn has been installed successfully.

The post How to Install Yarn on Ubuntu 20.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-yarn-ubuntu-20-04/feed/ 1
3 Methods to Install Yarn on Ubuntu, Debian & LinuxMint https://tecadmin.net/install-yarn-debian/ https://tecadmin.net/install-yarn-debian/#comments Tue, 17 Apr 2018 10:54:08 +0000 https://tecadmin.net/?p=15980 Struggling to install Yarn on your Ubuntu, Debian, or LinuxMint system? Don’t worry! With these three simple methods, you’ll be able to install Yarn in no time. Yarn is a powerful package manager that allows you to install, update, and uninstall applications with ease. It also helps you manage multiple versions of libraries and applications, [...]

The post 3 Methods to Install Yarn on Ubuntu, Debian & LinuxMint appeared first on TecAdmin.

]]>
Struggling to install Yarn on your Ubuntu, Debian, or LinuxMint system? Don’t worry! With these three simple methods, you’ll be able to install Yarn in no time. Yarn is a powerful package manager that allows you to install, update, and uninstall applications with ease. It also helps you manage multiple versions of libraries and applications, so you can easily switch between them. With these three methods, you can easily install Yarn on your Ubuntu, Debian, or LinuxMint system and get started with your projects! So why wait? Let’s dive in and explore the three methods to install Yarn.

Assuming that you already have installed Node.js on Ubuntu or Debian system.

In this article:

  1. Installing yarn package manager using NPM
  2. Install yarn using official shell script
  3. Install yarn using official PPA

You can choose any of the 3 methods to install yarn package manager on your system.

Method 1: Install Yarn using NPM

The yarn package is available to install with NPM. You can simply use the npm command as follows to install Yarn globally. To install yarn for the current project only just remove the -g option from the command.

sudo npm install yarn -g 

Check the installed version:

yarn -v 

1.22.19

Method 2: Install Yarn using Shell Script

Yarn also provides a shell script for installation. This is the most recommended way to install Yarn on a Linux system. This script downloads the yarn archive and extracts it under the .yarn directory under your home directory. Also, set the PATH environment variable.

curl -o- -L https://yarnpkg.com/install.sh | bash 

As this installation put all files under the user’s home directory, So it is available for the current users only.

Method 3: Install Yarn using PPA

The Yarn team also provides an Apt repository to install yarn on a Debian machine. Run the following commands to import gpg key and configure yarn apt repository.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 

Ubuntu 22.04 and Debian 11 or the newer versions, use the following commands to configure the repository:

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null 
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 

Now type the following commands to install yarn on Ubuntu Debian and Linux.

sudo apt-get update && sudo apt-get install yarn 

This will complete the Yarn installation on your system.

Conclusion

In this blog post, you have learned 3 methods of installing the yarn package manager on Ubuntu, Debian, or Linux Mint systems. You can choose any of the three methods to install yarn on Linux system.

The post 3 Methods to Install Yarn on Ubuntu, Debian & LinuxMint appeared first on TecAdmin.

]]>
https://tecadmin.net/install-yarn-debian/feed/ 1