Installing Arduino IDE on RaspberryPi 4

My apologies up front if this has been answered previous. I'm very new at this. I' trying to get the Arduino IDE to install on a RaspberryPi 4. The system is fully updated. Below is the output of trying to go through the install.

pi@raspberrypi:~/Arduino/arduino-1.8.15 $ ls
arduino examples java reference tools-builder
arduino-builder hardware lib revisions.txt uninstall.sh
arduino-linux-setup.sh install.sh libraries tools
pi@raspberrypi:~/Arduino/arduino-1.8.15 $ ./install.sh
Adding desktop shortcut, menu item and file associations for Arduino IDE...
rm: cannot remove '/usr/local/bin/arduino': Permission denied
Removing symlink failed. Hope that's OK. If not then rerun as root with sudo.

rm: cannot remove '/usr/local/bin/arduino': Permission denied
Removing symlink failed. Hope that's OK. If not then rerun as root with sudo.

ln: failed to create symbolic link '/usr/local/bin/arduino': File exists
Adding symlink failed. Hope that's OK. If not then rerun as root with sudo.
done!
pi@raspberrypi:~/Arduino/arduino-1.8.15 $ sudo ./install.sh
Adding desktop shortcut, menu item and file associations for Arduino IDE...

touch: cannot touch '/root/.config/mimeapps.list': No such file or directory
/usr/bin/xdg-mime: 848: /usr/bin/xdg-mime: cannot create /root/.config/mimeapps.list.new: Directory nonexistent

done!

I've tried to install as a user and sudo with no luck. Any help or advice here would be greatly appreciated.

Thanks

Maybe someone else will be able to provide more guidance, but my advice is to not worry about the installation. Just run ~/Arduino/arduino-1.8.15/arduino and get to having fun with Arduino. I've never bothered with the installation.

Wish I could but this is what I get...
pi@raspberrypi:~/Arduino/arduino-1.8.15 $ ls
arduino examples java reference tools-builder
arduino-builder hardware lib revisions.txt uninstall.sh
arduino-linux-setup.sh install.sh libraries tools
pi@raspberrypi:~/Arduino/arduino-1.8.15 $ ./arduino
./arduino: line 35: /home/pi/.local/share/Trash/files/arduino-1.2.8.15/java/bin/java: cannot execute binary file: Exec format error

Ok, now it is loading from the terminal....emptied the trash....OK I'm new at this

I'm very glad to hear this! Thanks for taking the time to post an update.

The previous behavior was unexpected to me. If you install the official version downloaded from the "Software" page, the Arduino IDE comes with its own bundled JVM. So it's odd that it would be using Java from /home/pi/.local/share/Trash/files/arduino-1.2.8.15/java/bin/java. The odd "1.2.8.15" shown in that path makes me think of the 3rd party maintained versions of the IDE installed via package managers (e.g., APT, Snap, Homebrew).

This can be searched on Google to find a lot of tutorials, now Arduino can choose a lot of Raspberry Pi boards, even the pico board can be.

You need to be careful about getting two concepts mixed up together @vincomgo. @ka7kuz is trying to run the Arduino IDE on a Raspberry Pi 4, to develop, compile, and upload Arduino sketches to an Arduino board. In this usage, the Raspberry Pi is a PC, just the same as if you were running the Arduino IDE on any other computer.

You could never ever do that with a Raspberry Pi Pico. You can however use a Pico as an Arduino board, running an Arduino sketch just like you would with a classic Uno, etc. This is a very different thing from what @ka7kuz is interested in doing. They are both related to Arduino, but only distantly related to each other.

There is some uncertain level of support for using Raspberry Pi SBCs as if they were Arduino boards. Most promisingly via this 3rd party project:

However, I've never actually heard of anyone using it.
Arduino Create also has some claim of support for programming Raspberry Pis, but again I've never heard any reports of it being used.

It is to write the program on the Arduino and then write it into the Raspberry Pi board, that's how I understand it.
Maybe my understanding is wrong, sorry I am also considered a newbie.

Your understanding is wrong. @ka7kuz is running the Arduino IDE on the Raspberry Pi. With that, they can upload the sketch to any Arduino board. That board might possibly be a Pico, but that would be purely coincidental and in no way related to the fact that the Arduino IDE is running on a Raspberry Pi 4 single board computer.

No worries. This stuff is always confusing, but especially confusing right now when Raspberry Pi has just expanded from computers into the microcontroller development board world, which they never had any direct involvement in before now.