How to Install tar.xz on Linux Debian 12

Опубликовано: 29 Сентябрь 2024
на канале: Arashtad
480
4

One of the common types of installation packages in Linux is .tar.xz. This is an easy way of packaging a software as well as compressing files. In this video we will have a look at the software packaging side of this type of archives by creating a simple software using Bash Script, packaging it as a .tar.xz archive, and then extracting, installing, testing, and uninstalling it from our Linux machine. The code and commands that we will execute during this video go below.

Create a project directory
mkdir hello_world
cd hello_world

Create the bash script using Vim
vim hello.sh

Inside Vim, type:
#!/bin/bash
echo "Hello, World!"
(Press ESC, then type :wq to save and exit Vim)

Make the script executable
chmod +x hello.sh

Create the install script using Vim
vim install.sh

Inside Vim press i then type:
#!/bin/bash
cp hello.sh /usr/local/bin/hello
chmod +x /usr/local/bin/hello
(Press ESC, then type :wq to save and exit Vim)

Make the install script executable
chmod +x install.sh

Create the uninstall script using Vim:
vim uninstall.sh
Inside Vim, type:
#!/bin/bash
rm /usr/local/bin/hello
(Press ESC, then type :wq to save and exit Vim)

Make the uninstall script executable
chmod +x uninstall.sh

Go back to the parent directory
cd ..

Package the project directory into a .tar.xz archive
tar -cJf hello_world.tar.xz hello_world/

Extract the .tar.xz archive
tar -xJf hello_world.tar.xz

Change to the extracted directory
cd hello_world

Run the install script with sudo
sudo ./install.sh

Test the installed program
hello

Run the uninstall script with sudo
sudo ./uninstall.sh

All Open Source!

Arashtad provides high quality tutorials, eBooks, articles and documents, design and development services, over 400 free online tools, frameworks, CMS, WordPress plugins, Joomla extensions, and other products.

More Courses ▶ https://tuts.arashtad.com/

Business Inquiries ▶ https://arashtad.com/business-inquiries/
Affiliate Programs ▶ https://arashtad.com/affiliate-programs/

eBooks ▶ https://press.arashtad.com/
Our Products ▶ https://market.arashtad.com/
Our Services ▶ https://arashtad.com/services/
Our Portfolio ▶ https://demo.arashtad.com/
Free Online Tools ▶ https://tools.arashtad.com/
Our Blog ▶ https://blog.arashtad.com/
Documents ▶ https://doc.arashtad.com/
Licensing ▶ https://arashtad.com/licensing/
About us ▶ https://arashtad.com/about/

Join Arashtad Network ▶ https://i.arashtad.com/

Our Social Profiles ▶ https://arashtad.com/arashtad-social-...
Vimeo ▶ https://vimeo.com/arashtad
Udemy ▶ https://www.udemy.com/user/arashtad
GitHub ▶ https://github.com/arashtad
Linkedin ▶   / arashtad  
Twitter ▶   / arashtad