0

I want to install the Flutter SDK on an Ubuntu system for all users. However, e.g. https://docs.flutter.dev/get-started/install/linux shows me how to do that only for a specific user. Since Flutter needs a lot of disk space, I would prefer installing it like any other program in /usr or /opt.

But how does one do that? Apparently, Flutter needs write permissions to the directories where it was installed to at run time, and I need to avoid making the directories world-writable.

Torsten Bronger
  • 452
  • 5
  • 19

2 Answers2

0

From the guide you linked to:

cd /opt

wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.10.1-stable.tar.xz

tar xf flutter_linux_2.10.1-stable.tar.xz

cd flutter/bin

pwd

Then add the location of flutter/bin to the PATH variable in /etc/profile.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
  • And e.g. a `flutter doctor --android-licenses` works for you this way? FWIW, for me, `/opt/flutter` needs to be writable for the respective user. – Torsten Bronger Feb 19 '22 at 03:18
  • 1
    If `/opt/flutter` needs to be written to, then create a group like `flutter-group` and then assign users to that group and make that the default group for all users and make `/opt/flutter` group readable and writable `chmod 775` for the group as well as `chgrp flutter-group /opt/flutter` of course. – Giacomo1968 Feb 19 '22 at 04:38
0

After trying to install flutter myself and seeing which files needs write permission I recommend installing flutter in the user's home dir instead.

What I use in this case in order to save HDD space is a ZFS file system user/skeleton that I clone for each new user. The user/skeleton has all the SDK's installed. This has it's caveats though, so if you want a quick solution buy more HDD's. Or if you can upgrade RAM but not add more HDD's you could try a file system that supports de-duplication.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 19 '22 at 21:50
  • Putting program code > 1 GB into each user’s home directory seems so wrong to me. It should not be the way to install software IMHO. Besides, my home directory is part of a backup plan which does not make sense for the Flutter code. – Torsten Bronger Feb 19 '22 at 22:50