debian ubuntu apt repository - ghdrako/doc_snipets GitHub Wiki

Wyszukiwarka repozytoriow zawierajacych pakiet

Instal postgres client 14

curl -q -o - https://artifactory.pl:443/artifactory/postgres/repos/apt/ACCC4CF8.asc | sudo apt-key add -
echo "deb https://artifactory.pl/artifactory/postgres/repos/apt/ jammy-pgdg main >> /etc/apt/sources.list.d/postgress.list
curl -q -o -  https://artifactory.pl/artifactory/postgres/repos/apt/ACCC4CF8.asc| apt-key add –
echo "deb https://artifactory.pl/artifactory/postgres/repos/apt/ bullseye-pgdg main >> /etc/apt/sources.list.d/postgress.list
apt-get update
apt-get install  postgresql-client-15
RUN apt-get update --quiet && \
    apt-get install -y gnupg

RUN curl -q -o -  https://artifactory.pl/artifactory/postgres/repos/apt/ACCC4CF8.asc| apt-key add -
RUN echo "deb https://artifactory.pl/artifactory/postgres/repos/apt/ bullseye-pgdg main" >> /etc/apt/sources.list.d/postgress.list

RUN apt-get update --quiet && \
    apt-get install -y apt-transport-https ca-certificates postgresql-client-15

# Google 
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://artifactory.pl/google-cloud-deb/ cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl https://artifactory.pl/google-cloud-deb/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
RUN apt-get update && apt-get install google-cloud-cli

Show release

lsb_release -a

apt: A newer end-user tool that consolidates the functionality of both apt-get and apt-cache.

Installing Packages

sudo apt install [package]

Before install recomended

sudo apt update && sudo apt upgrade

Install a specific version

sudo apt install [package]=[version]
sudo apt reinstall [package]

Multiple packages

sudo apt install [package1] [package2]

Automatically accept prompts

sudo apt install [package] -y

Updating Package Information

apt update

apt package manager gets the information about the available packages (and their version info) from the repositories and stores them in local cache /var/lib/apt/lists directory.

list of all available upgrades

apt list --upgradeable

upgrade a specific package

sudo apt install --only-upgrade [package]

Uninstalling Packages

Removes the specified package from the system, but retains any packages that were installed to satisfy dependencies as well as some configuration files

sudo apt remove [package]

To remove the package as well as any configuration files

sudo apt purge [package]

Both of these commands are equivalent to apt-get remove and apt-get purge, respectively.

Remove any unused dependencies

sudo apt autoremove

Listing Packages

List all packages that are installed

apt list --installed

List all packages that have an upgrade available

apt list --upgradeable

List all versions of all available packages

apt list --all-versions

Searching for Available Packages

apt search [string]

full description/summary for each package

apt search --full [string]

packages whose titles or short/long descriptions contain multiple terms, delimit each string with a space

apt search [string1] [string2]

Viewing Information About Packages

apt show [package]

Adding Repositories

A repository is a collection of packages (typically for a specific Linux distribution and version) that are stored on a remote system. This enables software distributors to store a package (including new versions) in one place and enable users to quickly install that package onto their system.

Information about repositories that are configured on your system are stored:

  • within /etc/apt/sources.list

  • the directory /etc/apt/sources.list.d/ - The names of the repository files inside the /etc/apt/sources.list.d/ directory must end with .list.

Repositories can be added manually by editing (or adding) a sources.list configuration file, though most repositories also require adding the GPG public key to APT’s keyring.

The general syntax of the /etc/apt/sources.list file takes the following format:

deb http://repo.tld/ubuntu distro component...
  • archive type - deb or deb-src
  • repository URL
  • distribution code name
  • repository components or categories - The default Ubuntu repositories are split into four components - main, restricted, universe and multiverse. Generally, third-party repositories have only one category.The repository components are:
    • Main - (enable by default) Officially supported software only FOSS (free and open source software) that can be distributed freely without any restrictions
    • Restricted - Supported software that is not available under a completely free license.
    • Universe - (enable by default) Community maintained FOSS software, i.e. not officially supported software.
    • Multiverse - Software that is not free.
  • Third party repositories and PPA (Personal Package Archive)

The format for the files under the /etc/apt/sources.list.d/ directory is the same as for the regular sources.list file.

Most repositories are providing a public key to authenticate downloaded packages which need to be downloaded and imported.

Installing add-apt-repository - if command not found

sudo apt update
sudo apt install software-properties-common

To automate this process, it’s recommended to use the add-apt-repository utility.

sudo add-apt-repository [repository]

Once a repository has been added, you can update your package list and install the package.

remove a previously enabled repository

sudo add-apt-repository --remove 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'

Cloning Packages to Another System

  1. Install apt-clone.
sudo apt install apt-clone
  1. Create a backup containing a list of all installed packages
apt-clone clone [name]

This command creates a new file using the name provided in the last step and appending .apt-clone.tar.gz. 3. Copy the file to your new system 4. Install apt-clone on the new system (step 1) 5. restore the packages

sudo apt-clone restore [name].apt-clone.tar.gz

Other

Clean cache

sudo apt clean
sudo apt update
deb [trusted=yes] https://myrepo/artifactory/ubuntu-virtual  stretch Release
sudo apt install ca-certificates

But I could not update ca-certificates because they were believed current -- and I could not make apt understand they weren't current because, you know, the update was not working.

So:

  • Temporarily disable certificate verification by adding
    Acquire { https::Verify-Peer false }
touch /etc/apt/apt.conf.d/99verify-peer.conf \
&& echo >>/etc/apt/apt.conf.d/99verify-peer.conf "Acquire { https::Verify-Peer false }"
in `/etc/apt/apt.conf.d/99verify-peer.conf`.
  • Run apt update to get the new ca-certificates info
  • Run apt install ca-certificates
  • Re-enable certificate verification
  • Edit the file above and remove the peer-verification bypass. If the file is now empty, you may delete it.

Postgres 16 ubuntu 22

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install software-properties-common apt-transport-https wget -y
  • Add postgresql repository
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  • Add postgresql repository key
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
* Install 

sudo apt update sudo apt install postgresql-client -y psql --version