Portage or Portage like program for Ubuntu
I saw this question Can I install Portage, Pacman or other package managers on Ubuntu?, that it wasn't a good idea to install portage on Ubuntu because of how tightly bundled it is with gentoo. The reason I want to install it is for managing things I compile from source. I don't want to compile everything I just want the ability to manage what I do choose to compile from source. I would like to be able to point at a git repository build from it, and then use it. If I decided later that I didn't want the application anymore instead of remembering where I installed it I could use a package manager to remove it. Also updating with it would be nice, by specifying a release to upgrade to. I was wondering if there was an application like that, that worked for Ubuntu?
Solution 1:
In the current state of the technologies you can have isolated Gentoo base system inside your Ubuntu by using containers like Docker or chroot/schroot.
As long-time Gentoo fan I'll guide you in the process.
The below method explains how to implement schroot
mechanism. We need to get current stage3 snapshot of Gentoo, then unpack it and configure according to Gentoo Handbook but without disk partitioning.
sudo apt-get update
sudo apt-get install schroot -y
cat <<EOF | sudo tee /etc/schroot/chroot.d/gentoo.conf
[gentoo]
description=Gentoo
directory=/srv/chroot/gentoo
root-users=$USER
type=directory
users=$USER
EOF
sudo mkdir -p /srv/chroot/gentoo
# add portage user and group
sudo groupadd portage -g 250
sudo useradd -M -g portage -s /bin/false -u 250 portage
cd ~/Downloads
wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20210630T214504Z/stage3-amd64-20210630T214504Z.tar.xz
sudo tar -xf stage3-amd64-20210630T214504Z.tar.xz -C /srv/chroot/gentoo
Then you can jump to the newly created Gentoo schroot by using command below:
schroot -c gentoo -u root bash
# do something, then use Ctrl+D to exit to Ubuntu
To be assured that you have installed Gentoo system you can execute
schroot -c gentoo cat /etc/os-release
to get
NAME=Gentoo ID=gentoo PRETTY_NAME="Gentoo/Linux" ANSI_COLOR="1;32" HOME_URL="https://www.gentoo.org/" SUPPORT_URL="https://www.gentoo.org/support/" BUG_REPORT_URL="https://bugs.gentoo.org/"
Then as example we can compile small graphical xclock
application and Midnight Commander with default make.conf.
schroot -c gentoo -u root -- emerge --sync
schroot -c gentoo -u root -- emerge -qv x11-apps/xclock app-misc/mc
and finally launch the installed xclock
application
schroot -c gentoo env DISPLAY=$DISPLAY xclock
Moreover you can operate the local data using applications which are installed inside Gentoo schroot:
- activate schroot by
schroot -c gentoo
- then execute some command like
mc
- exit from schroot by using
exit
in the same terminal
I think you got the idea. By using such method you can have Gentoo inside your Ubuntu. This inner Gentoo can be configured by USE-flags, system profile and so on. It will use Portage as you want.
If you like adventures then you can even install full lightweight desktop environment to this Gentoo system and run it in nested X11 system called Xephyr. Without details it is possible by doing the following:
schroot -c gentoo -u root -- mount /dev/shm /dev/shm -t tmpfs
schroot -c gentoo -u root -- emerge -atv mate-session-manager --exclude=dev-lang/rust
schroot -c gentoo -u root -- useradd polkitd
schroot -c gentoo -u root -- emerge -qatv mate-base/mate app-office/libreoffice-bin
mkdir ~/.gentoo # create new $HOME for Gentoo
Xephyr -screen 1360x680 :1 &
schroot -c gentoo -u $USER env HOME=~/.gentoo DISPLAY=:1 mate-session
to get something like