Как установить tgz debian
Перейти к содержимому

Как установить tgz debian

  • автор:

Tar — как запаковать и распаковать tar gz и tar bz2

Tar — это популярный файловый архиватор в Unix/Linux системах. Tar зачастую используется вместе с архиваторами GZip или BZip2 , так как они отлично взаимодополняют друг друга: Tar не может сжимать файлы, только собирать их в одни архив, а GZip и BZip2 не могут сжимать несколько файлов одновременно, поэтому если вам нужно запаковать несколько файлов и директорий, сначала они собираются в один несжатый архив с помощью Tar , который сохранит их некоторые атрибуты, например такие, как права доступа, а затем этот архив сжимается с помощью GZip или BZip2 . Весь процесс запускается одной консольной командой, про которые далее.

Как установить, создать архив Tar и распаковать его в Windows

Чтобы использовать Tar в Windows, нужно воспользоваться одним из следующих вариантов:

    Установить Far Manager.
    Инструкция по созданию и распаковке архива .tar с помощью Far Manager:

    Теперь просто выделяете ПКМ (правой кнопкой мыши) или кнопкой клавиатуры Insert нужные вам файлы и папки и жмёте Shift + F1 , затем выбираете нужный формат (в нашем случае, TAR) и создаёте архив:

Создание архива в Far Manager

Создание архива в Far Manager

Как распаковать Tar в Far Manager

Как распаковать Tar в Far Manager

Скачать 7-zip архиватор

Скачать 7-zip архиватор

Как запаковать архив tar.gz и tar.bz2 в Ubuntu, Debian, CentOS

где tar — команда, cfvz — ключи, archive.tar.gz — имя будущего архива, *.php — список файлов, которые нужно заархивировать.
Список можно заменить директорией, которую нужно запаковать целиком, для этого указываем путь до неё, абсолютный или относительный

Теперь подробнее про ключи

  • -с — команда, которая означает «создать архив»
  • -f — команда на упаковку файлов и директорий в один файл архива
  • -v — включает визуальное отображение процесса архивации
  • -z — использовать для сжатия GZip

Также, можно использовать для сжатия BZip2 . Для этого нужно использовать ключ -j вместо -z .
В этом случае, команда для запаковки tar.bz2 будет выглядеть так

Вместо GZip и BZip2 можно пользоваться иными архиваторами, для этого просто нужно подобрать соответствующий ключ.

Чтобы исключить определённый каталог или файл из архива, можно воспользоваться ключом —exclude .
Сначала переходим в нужный каталог, затем используем следующую команду:

Тут мы запаковываем каталог /wp-content/ на WordPress, исключая раздел Updraft wp-content/updraft , раздел Загрузки wp-content/uploads и Кеш wp-content/cache .

Важный момент — чтобы исключить ошибки, не указывайте слеш / в конце пути исключаемого каталога.

Как распаковать архив tar.gz и tar.bz2 Ubuntu, Debian, CentOS

Чтобы распаковать архив tar.gz или tar.bz2 , в команде нужно заменить -с на ключ -x , а также указать путь до архива, абсолютный или относительный
Команда для распаковки архива в текущую директорию выглядит так

С помощью ключа -С можно указать путь, куда нужно распаковать архив

Просмотр архивов tar в Linux

Для просмотра содержимого архивов можно использовать ключ -t

Будет выведен список файлов и директорий в архиве. При добавлении ключа -v также будет выведена подробная служебная информация о правах доступа, размерах файлов и прочем.

Иные возможности tar

Tar имеет много дополнительных возможностей, к примеру, добавление файлов в существующий архив, исключение некоторых файлов и директорий при запаковке архива и так далее. Подробнее вы можете узнать о них при помощи команды

Установка программ в Linux (.tar, .gz, .bz, RPM и DEB)

Каждому пользователю операционных систем Linux, а также других систем приходится устанавливать дополнительные программы. В операционных системах Windows все очень просто, как правило есть установщик setup.exe, который помогает установить софт. А вот в линуксе дела обстоят несколько иначе. Как устанавливать программы в Linux? Сейчас рассмотрим этот вопрос.

В линуксе есть несколько типов установочных пакетов и каждый дистрибутив имеет свой формат пакетов. В дистрибутивах Fedora, Mandriva, Red Hat и Suse используется стандартная установка для линукс RPM, разработанная компанией Red Hat. Файл пакета RPM как правило имеет название имя_программы-версия.rpm.

Еще один из очень популярных форматов это DEB. Используется в Debian, Ubuntu, Knoppix и Mepis. Имеет название имя_программы-версия.deb.

И подошли мы к архивам. Обычно это .tar , .tar.gz , .tgz расширения. Их следует распаковать, а потом уже устанавливать/компилировать.

Выполнять процедуру установки программ нужно от имени суперпользователя.

Установка программ в Linux

Установка программ на Debian, Ubuntu

Для работы с пакетами формата DEB есть множество инструментов, но чаще всего используют apt-get , он входит в стандартный набор инструментов. Для установки приложения вводим команду:

APT хранит локальную базу данных всех доступных для установки пакетов и ссылок где их брать. Эту базу нужно обновлять время от времени, командой:

Для обновления устаревших пакетов (программ) на компьютере набираем следующие команды:

Про APT можете почитать более подробно на официальном сайте: http://www.debian.org/doc/manuals/apt-howto/

Установка программ на Fedora, Red Hat

Утилита, аналогичная APT — yum. Загрузить и установить пакет из настроенного хранилища пишем команду:

Локальная база yum не сохраняется, поэтому нет необходимости обновлять. Для установки обновлений воспользуемся командой:

Выбрать что-то определенное для обновления:

Установка программ в Mandriva

В Mandriva есть свой набор инструментов для работы с пакетами, называется urpmi. Для установки:

Обновить локальную базу со списком пакетов:

Чтобы установить обновления:

Установка программ из архивов (тарболов)

Для архивов сжатых с помощью GZIP (gz, gz2 и т.д.) делаем так:

Для архивов сжатых с помощью BZIP (bz, bz2 и т.д.) несколько по другому:

  • x – извлекаем файлы из архива;
  • v – подробный вывод инфы на экран;
  • f – Обязательная опция. Если не указать, Tar будет пытаться использовать магнитную ленту вместо файла;
  • z – обработать архив сжатый при помощи gzip;
  • j – обработать архив сжатый при помощи bzip.

После выполнения команды, будет создана папка с именем, аналогичным названию пакета. Затем нужно открыть эту созданную папку командой:

Далее в распакованном архиве читаем инструкцию в файле README если есть. Во всяком случае, если программа собрана в виде исполняемого файла, то в пакете будет файл .sh , как правило называется install.sh . Его просто запускаем на исполнение.

А вот если программа представлена в исходном коде, выполняем команды:

После установки выполняем:

Ну вот и все, ничего сложного. Теперь вы знаете как устанавливать программы на Linux: Debian, Ubuntu, Fedora, Red Hat, Mandriva, в том числе и из архивов.

How to Install Tar.gz

linux tar gz

Tar files are a collection of files wrapped up into a single file. Tar.gz files use the standard gnu zip(gzip) compression. Due to their portability, you don’t need any extra software to unbundle them in Linux/macOS.

Because of this, the source code of open-source software is generally packaged as tar.gz files. Using system-provided package managers is an easier way for installation. But, not all software is available across all Linux systems. Also, the type of licensing may prevent some applications from being available altogether. This is where the tar.gz build system comes in.

Table of Contents

How to Install Tar.gz

How to Extract Tar.gz Files

You can decompress a tarball in one of two ways. Most Ubuntu-based distros come with the Archive Manager application. Use either one of these approaches as you see fit.

Extract Tar.gz Files Using Archive Manager (Ubuntu/kali Linux/ Mint/ Debian)
  1. Use your File Manager to get to the location of the file.
  2. Right Click on the file and click on Extract Here. You should see the Archive Manager extraction progress.
  3. After completion, you will notice a new folder created along with the tar.gz files.
  4. Open this folder in the terminal.

Extracting tar.gz using Archieve Manager

Extract Tar.gz Using the Command Line (All Linux Flavours + Macos Any Version)
  1. Open the terminal.
  2. cd /home/foo/Downloads
    • Takes you inside the downloaded location.
  3. ls *tar.gz*
    • Finds any tar.gz files and displays the full filename.
  4. tar -xzf keepassx-2.0.3.tar.gz
    • Extracts from the tarball keepassx-2.0.3.tar.gz and creates a new folder with the same name.
    • Extracts (x) using the Gzip algorithm (z) of the file (f) named ‘keepassx-2.0.3.tar.gz’.

Extract

  • Takes you inside the now extracted folder.

ls configure

How to Extract Tarfile in Windows

If you are using Windows 10 or newer, you can use tar utility from Powershell. If using an older version, you need to install extraction software to get files from tar.gz. This article lists some of the popular software used in Windows PC.

  1. Type Powershell in Start Menu to open Windows Powershell.
  2. tar -xzf keepassx-2.0.3.tar.gz
    • Extracts (x) while being verbose (v) using the gzip algorithm (z) of the file (f) named ‘keepassx-2.0.3.tar.gz’.

Extract Tar in Windows

How to Install Tar.gz File

For our purposes, we will examine the steps by installing a free application. The name of this application is KeePassX. Check their website for more information.

After following the above steps, we have the files we need under /home/foo/Downloads/keepassx-2.0.3.

The concept of this process is easy to follow.

Configure Make Install

First, we build our configuration, and then we compile it for our Operating System. This process applies to any distro or any flavor of Linux with all tarball applications. Of course, every application has different config files. But they all follow the above general pattern for the installation process.

  1. cd /home/foo/Downloads/keepassx-2.0.3
    • Takes you inside the extracted folder
  2. ls
    • To look for an INSTALL/README file that contains detailed instructions.
  3. cat INSTALL
    • To read the contents of the file INSTALL. You can do the same for README too.

CAT Install

ls configure

  • To make a separate build folder
  • Go into the build folder

Cmake

make

Sudo Make Install

What is Dependency Error When Trying to Run cmake or configure?

This means you don’t have the required dependencies installed in your system. If you look at the INSTALL file, you will be able to see the list of dependencies. For Ubuntu-based systems, use apt-get install to install dependencies as shown below.

What Error Do We Get When Using cmake?

Cmake stores errors in CMakeError.log. This can happen when one or more dependencies are installed but don’t have the required versions. Refer to this article to install the correct versions of packages.

Error When Using ./configure?

Autoconf application is missing. Newer Ubuntu versions don’t ship autoconf utility by default. This can be solved by installing it as sudo apt-get install autoconf.

If you want to read more about the source installation process, follow this website.

How to install tarball packages on a Debian based distribution?

I would like to know how to install .tar.bz and .tar.bz2 packages on Debian. Could anyone help me understand how to achieve that?

Zignd's user avatar

5 Answers 5

Firstly, according to the File System Hierarchy Standards, the location of this installed package should be /opt if it is a binary install and /usr/local if it’s a from source install.

Pure binaries

These are ready to use binaries. Normally they just need to be extracted to be installed. A binary package is going to be easy:

  • sudo tar —directory=/opt -xvf <file>.tar.[bz2|gz]
  • add the directory to your path: export PATH=$PATH:/opt/[package_name]/bin

and you are done.

From sources

A source package is going to be more troublesome (by far) and through they can roughly be processed with the method below, each package is different:

  • download the package to /usr/local/src
  • tar xf <file>.tar.[bz2|gz]
  • cd <package name>
  • read the README file (this almost certainly exists).
  • most Open Source projects use autoconf/automake, the instructions should be in the README . Probably this step will go: ./configure && make && make install (run the commands separately for sanity if something goes wrong though).

If there’s any problems in the install then you’ll have to ask specific questions. You might have problems of incorrect versions of libraries or missing dependencies. There’s a reason that Debian packages everything up for you. And there is a reason Debian stable runs old packages — finding all the corner cases of installing packages on more than a dozen different architectures and countless different hardware/systems configurations is difficult. When you install something on your own you might run into one of these problems!

Unpack the files and then, in the directory that was created, look for a README or INSTALL file which will tell you what you need to know in order to install a package (e.g. dependencies, configuration options, commands to run etc. ).

Usually it boils down to ./configure , make then make install .

The standard way of doing this is:

  1. tar zxvf file.tar.gz or tar xvjpf file.tar.bz2
  2. run ./configure ( ./configure —help usually gives customization options)
  3. run make
  4. run make install

There is usually a README or INSTALL file that gives instructions as well.

Generally speaking, when you install tar.gz/tgz/tar/bz2 (remember, these are just compressed package files) you would need to break open the tar file ( tar xvfz / tar xvfj ) and then cd to the directory and run ./configure .

On some systems, you either take the defaults (/usr/local/ for example) as the default install location, or you might like to use /opt/local/.

So you would do ./configure —prefix=/usr/local and then make , make install .

It us up to you where you want to install your packages. Remember that where ever you decide to do it, you might want to add the path to your PATH shell variable so you can easily run those packages. (often export PATH=$PATH:/opt/local/bin:/usr/local/bin ).

Let me illustrate this with an example, say you wish to install a package abc . The dependencies of the package abc may be identified by reading its documentation. You should resolve the dependencies(required libraries etc) prior to installation for a smooth experience.

Before a gcc 4.7.2 build the g++ , m4 , gawk , gcc-multilib , gmp , mpfr , and mpc must be built.

Then comes the building from source part for which the first step is always extraction. This can be done by using the tar command or by the simple GUI way. Once you have the extracted files in a folder you must browse to that folder using the cd command, for example if the contents are in Downloads then:

Now you need to run ./configure . Specify the installation directory by using the —prefix= option with configure .

Firstly, according to the File System Hierarchy Standards, the location of this installed package should be /opt if it is a binary install and /usr/local if it’s a from source install.

so if you are installing to the /usr/abc directory you will supply the option —prefix=/usr/abc with the ./configure instruction.

—prefix= is not the only thing you might want to specify though, you might want to supply other information for a successful compilation like the type of your system with —build=x86_64-linux-gnu for 64 bit, and —build=i386-linux-gnu for a 32 bit system. It is wise to read the README in the extracted files as it may carry the information about which options to specify with the ./configure command.

After the ./configure run the make command, and subsequently the make install . Post installation you should specify the library path, shell/environment variables using the export command.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *