How to install Gnu Guix on Ubuntu

Endrit Qerreti

Endrit Qerreti

GNU Guix is a package manager that you can use on your Ubuntu machine, alongside the apt package manager or other package manager that you may have installed.

Guix package manager can be used to download and install Guix packages on your machine.

There are more than 26 thousand packages available to be downloaded from the Guix package repository, and you can install anything you want.

In this tutorial, you will learn how to install GNU package manager on Ubuntu, by using the official installer script that GNU Guix provides, and by using the official package that is available on Ubuntu repositories.

Install Guix via Official Installer

Step 1 - Download Guix Installer

Guix can be easily installed on Ubuntu, by running the official shell installer script. First, you need to download this script on the /tmp directory

To do this first change the directory to /tmp

cd /tmp

Next, download the Guix installer script. To do this, simply run the command below

wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh

Note: The installer script will be downloaded on your /tmp directory.

Step 2 - Make Guix Installer executable

The installer that you downloaded, is a simple shell script, which in order to run it, you need to make it executable.

To make Guix installer executable, run the command below.

chmod +x guix-install.sh

Once done, you are good to go and move to the next step to install Guix on your system.

Step 3 - Install Guix

Now that Guix installer script guix-install.sh has fully permissions to be executed, you need now to run this script to begin installing Guix.

To run guix-install.sh, simply run the script as sudo

sudo ./guix-install.sh

Next, you will see the Guix Installer Window starting as shown in the screenshot below. You need to press enter in this prompt to begin installing Guix.

Install Guix via Ubuntu Repositories

Guix can also be installed on your system, without having to use the official installer script, as guix package guix is available on main Ubuntu repositories.

So, to install Guix, you can simply do so by using apt package manager

sudo apt install guix

Uninstall GNU Guix on Ubuntu

To uninstall Guix that you installed via apt package manager, run the command below

sudo apt purge guix

When installed via the official shell script installer, Guix files can be found on two directories /var/guix and /gnu/store so to uninstall Guix in this case, you can do so by removing these two directories.

You also need to remove the profiles that were created by guix ~/.guix-profile and ~/.config/guix/

sudo rm -rf /var/guix
sudo rm -rf /gnu/store
sudo rm -rf ~/.guix-profile
sudo rm -rf ~/.config/guix/

💡
Note: When removing directory /gnu/store you may get the following error "Cannot remove, read only file system" This happens because /gnu/store is being used and it's still mounted on your system. In order to be able to remove this directory, first you must unmount it using the umount command below.

sudo umount -l /gnu/store

Once unmounted, you should be able to remove it

sudo rm -rf /gnu/store

Conclusion

In this tutorial, you learned how to install GNU Guix package manager on Ubuntu, using two different methods.

On the first method you learned how you can install Guix using the official shell installer script.

On the second method, you learned how to install Guix from the main repositories on Ubuntu, using your terminal.

Hopefully, by now you should be able to use Guix, and install Guix packages on your Ubuntu machine.