Installing as non-root user

The place to discuss linux version of MakeMKV
yommish
Posts: 2
Joined: Fri Jun 27, 2025 11:54 am

Re: Installing as non-root user

Post by yommish »

basvdw wrote:
Sat Feb 19, 2022 4:54 pm
Apologies for necroposting, I'm not a regular here so don't know if it's appropriate, but I updated the script a bit to fit the needs of someone at Ultra.cc/UltraSeedbox.
It's heavily based on the script posted here by camjac251, I appreciate you and everyone else. Mine does essentially the same thing with a few small changes:
  • Added NASM as a dependency since FFmpeg needs it and it doesn't come preinstalled at Ultra.cc
  • Changed the build directory to /tmp/makemkv
  • Changed the prefix to $HOME/.local
  • Adds $LD_LIBRARY_PATH and $PATH insertions to .bashrc if they don't exist yet (kind of hacky but it's useful to us)
  • Changed cleanup of build directory to be on exit
  • Changed curl commands to follow redirects
  • Removed the build log since we don't really need it, you can just redirect the output of the script itself if you do
I'm hosting it at https://get.bas.sh/install-makemkv.sh so you can easily run it with a one-liner (or download it first if you want to read it before running it).

Code: Select all

curl -fsSL https://get.bas.sh/install-makemkv.sh | bash
and here's the script in full:

Code: Select all

#!/usr/bin/env bash
#set -x
set -e

### Based on https://forum.makemkv.com/forum/viewtopic.php?p=62349#p62349

p() {
    echo -e "\n==> $@\n"
}

build_dir=/tmp/makemkv

cleanup() {
    p 'Cleaning up build directory...'
    rm -rf $build_dir
}

trap cleanup EXIT

PREFIX=$HOME/.local
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
export PATH=$PREFIX/bin:$PATH

nasm_url="https://www.nasm.us"
ffmpeg_url="https://www.ffmpeg.org/releases"
makemkv_url="http://makemkv.com/download"
makemkv_serial_url="http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053"

p 'Checking latest versions'
nasm_version=$(curl -fsSL $nasm_url | grep -oP '\d+\.\d+\.\d+' | head -n1)
echo "nasm $nasm_version"
ffmpeg_version=$(curl -fsSL $ffmpeg_url | grep -oP 'ffmpeg-(\d+\.)+\d+' | sort -V | tail -n1)
echo $ffmpeg_version
makemkv_version=$(curl -fsSL $makemkv_url | grep -oP '\d+\.\d+\.\d+' | head -n1)
echo "MakeMKV $makemkv_version"
makemkv_serial=$(curl -fsSL $makemkv_serial_url | grep -oP 'T-[\w\d@]{66}')
echo "MakeMKV key: $makemkv_serial"

if [[ -z $nasm_version ]] || [[ -z $ffmpeg_version ]] || [[ -z $makemkv_version ]] || [[ -z $makemkv_serial ]]; then
    p 'At least one of the version checks failed, aborting'
    exit
fi

p "Compiling NASM, MakeMKV, and FFmpeg in $build_dir"
mkdir -p $build_dir && cd $build_dir

p 'Downloading NASM, ffmpeg, and makemkv sources'
wget --no-verbose "$nasm_url/pub/nasm/releasebuilds/$nasm_version/nasm-$nasm_version.tar.gz" \
    "$ffmpeg_url/$ffmpeg_version.tar.bz2" \
    "$makemkv_url/makemkv-bin-$makemkv_version.tar.gz" \
    "$makemkv_url/makemkv-oss-$makemkv_version.tar.gz"

p 'Extracting archives'
echo -n 'nasm: ' && tar xf nasm-$nasm_version.tar.gz --totals
echo -n 'ffmpeg: ' && tar xf $ffmpeg_version.tar.bz2 --totals
echo -n 'makemkv-oss: ' && tar xf makemkv-bin-$makemkv_version.tar.gz --totals
echo -n 'makemkv-bin: ' && tar xf makemkv-oss-$makemkv_version.tar.gz --totals

p 'Configuring NASM'
cd $build_dir/nasm-$nasm_version
./autogen.sh
./configure --prefix=$PREFIX
p 'Compiling NASM'
make -j
p 'Installing NASM'
make install

p 'Configuring FFmpeg'
cd $build_dir/$ffmpeg_version
./configure --prefix=$PREFIX --extra-cflags="-I$PREFIX/include" --extra-ldflags="-L$PREFIX/lib" --enable-static --enable-pic
p 'Compiling FFmpeg'
make -j
p 'Installing FFmpeg'
make install

p 'Configuring makemkv-oss'
cd $build_dir/makemkv-oss-$makemkv_version
sed -i '/ldconfig/d' Makefile.in
./configure --prefix=$PREFIX --disable-gui
p 'Compiling makemkv-oss'
make -j
p 'Installing makemkv-oss'
make install

p 'Compiling makemkv-bin'
cd $build_dir/makemkv-bin-$makemkv_version
mkdir tmp
echo -n "accepted" > tmp/eula_accepted
sed -i "s|/usr|$HOME/.local|" Makefile
make -j > /dev/null
p 'Installing makemkv-bin'
make install

p 'Registering MakeMKV with latest beta key'
mkdir -p $HOME/.MakeMKV
echo "app_Key = \"$makemkv_serial\"" > $HOME/.MakeMKV/settings.conf

if ! grep -qE '\$HOME/.local/lib(:|"$|$)' $HOME/.bashrc; then
    p 'Adding $LD_LIBRARY_PATH insertion to .bashrc'
    echo 'export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH' >> $HOME/.bashrc
fi

if ! grep -qE '\$HOME/.local/bin(:|"$|$)' $HOME/.bashrc; then
    p 'Adding $PATH insertion to .bashrc'
    echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.bashrc
fi

p 'Restart your SSH session or run "source ~/.bashrc" to be able to run makemkvcon (if everything went well, which I sure hope it did). Enjoy! :)'
Much thanks to you and camjac251, I had success with installing makemkvcon using your script. Hopefully I will have no further comments/questions, looks good so far!
Post Reply