I am new to Linux / Ubuntu and want to install the flutter sdk and their docs recommend
Create a folder where you can install Flutter. Consider creating a directory at
~/development/
.Extract the file into the directory you want to store the Flutter SDK.
tar -xf ~/Downloads/flutter_linux_3.x.tar.xz -C ~/development/
When finished, the Flutter SDK should be in the ~/development/flutter directory.
But placing around 14000 files with a total size of 1.7 GB below my home ~/
directory seems wrong to me. Under Where to install libraries manually? or Where to store Android SDK files two options are recommended:
- use
/usr/local/lib/
as FHS recommends - use
/opt/
and links to Linux-Filesystem-Hierarchy / opt
So I tried
$ sudo mkdir -p /usr/local/lib/flutter-sdk
$ tar -xf ~/Downloads/flutter_linux_3.24.3-stable.tar.xz -C /usr/local/lib/flutter-sdk/
But I got hundreds of messages similar to
tar: flutter/docs/platforms/Hybrid-Composition.md: open failed: File or Folder not found
tar: flutter/docs: function mkdir failed: File or Folder not found
Trying sudo tar -xf ...
failed.
Questions
- How can I extract the files into the destination folder
/usr/local/lib/flutter-sdk/
? - Do I have to make changes of certain rights (read write access) for a normal / non-root user after the folders and files have been extracted?
First off, I don't really understand why you wouldn't want to have this in your home directory. That seems like the simplest and most natural place to install something only you will be using. It also simplifies taking backups and upgrading your system since it will be in a directory you control. So I really would just use
~/development
or whatever else you want, but a directory in your$HOME
. This also means no need for root access.Anyway, if you do want to put it in a system directory, don't use
/usr/local/lib
, use/usr/local
. You aren't installing a library, so it doesn't belong in alib/
directory. So if you insist on having it in/usr/local
, I would do this:I just tried this on my machine and it worked without a hitch. The extraction will create
/usr/local/flutter
which now has:No other changes to permissions should be needed. You can now run
/usr/local/flutter/bin/flutter
or, simpler, add this line to your~/.bashrc
to add the directory to your PATH:Now, open a new terminal and you can just run
flutter
.