Community
cancel
Showing results for 
Search instead for 
Did you mean: 
STyur
New Contributor I
80 Views

The way to install some packages locally (on 7zip example)

Some useful packages is not installed on devcloud, but you can easy install it locally for convenient work.

Lets install for example 7zip by hand :

1) First of all you have to set some paths in ~/.bash_profile

# =====================================================
var_add_path(){
# Use var_add_path "VAR" "/path/to/smth" "s|e"
# s - at the beginning; e - at the end
# echo "Adding $2 to $1 at the <start|end> $3"
  tmp_var=$1
  if [ -d "$2" ]; then
    if [[ ":${!tmp_var}:" != *":$2:"* ]]; then
      # For non-empty, only add if not already there
      if [[ "$3" == "s" ]]; then
    [[ -z "${!tmp_var}" ]] && export $1=$2 || export $1=$2:${!tmp_var}
      else
    [[ -z "${!tmp_var}" ]] && export $1=$2 || export $1=${!tmp_var}:$2
      fi
    fi
  fi
}
# =====================================================
var_add_path "PATH" "$HOME/.local/bin" "s"
var_add_path "PATH" "$HOME/bin" "s"
var_add_path "PATH" "/bin" "e"
var_add_path "LD_LIBRARY_PATH" "$HOME/.local/lib" "e"

2) Get, unpack, change and install p7zip-full

mkdir ~/src
cd ~/src
apt download p7zip-full
dpkg -x p7zip-full_16.02+dfsg-6_amd64.deb p7zip
cd p7zip/usr/bin
sed -i 's,\/usr,$HOME\/.local,' 7za
sed -i 's,\/usr,$HOME\/.local,' 7z
mv * ~/bin/
cd ..
mv lib/* ~/.local/lib/
mv share/* ~/.local/share/

Now you can use 7z as usual.

Also you can install Midnight Commander and other packages by the same way. If it asks for some libs - place them to ~/.local/lib/

For MC you have to set in ~/.bashrc

MC_DATADIR=$HOME/.local/share/mc

To see how their MC searches for components, use the mc -F command

 

 

Tags (1)
0 Kudos
1 Reply
Rohith_K_Intel
Employee
80 Views

Thanks for the information provided. It will definitely help many forum users :)

0 Kudos