第一步下载:从Rstudio复制下载链接替换下列代码的网址就行
wget -c https://download1.rstudio.org/electron/jammy/amd64/rstudio-2023.09.1-494-amd64.deb #Ubuntu
第二步安装:对应好你选择的Rstudio版本
sudo dpkg -i rstudio-2023.09.1-494-amd64.deb
错误显示:
Unpacking rstudio (2023.09.1+494) ...
dpkg: dependency problems prevent configuration of rstudio:
rstudio depends on libssl-dev; however:
Package libssl-dev is not installed.
rstudio depends on libclang-dev; however:
Package libclang-dev is not installed.
rstudio depends on libxkbcommon-x11-0; however:
Package libxkbcommon-x11-0 is not installed.
rstudio depends on libpq5; however:
Package libpq5 is not installed.
出现缺乏对应的依赖包,尝试修复
sudo apt --fix-broken install
再次安装
sudo dpkg -i rstudio-2023.09.1-494-amd64.deb
运行rstudio
rstudio
3.安装缺乏对应的包,这一步就是按照错误提醒按照对应的包就行,我在安装时提示了非常多缺乏的包,一步步耐心安装就好
出现错误提醒
rstudio: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
sudo apt update
sudo apt install libatk-1.0.so.0
再次运行rstudio
出现错误提醒
rstudio: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
sudo apt update
sudo apt install libatk-bridge2.0-0
再次运行rstudio
rstudio: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
sudo apt update
sudo apt install libgtk-3-0
rstudio: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
sudo apt update
sudo apt install libgbm-1
4.出现新的error提醒
[7676:1021/162927.722369:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[7676:1021/162928.465526:ERROR:ozone_platform_x11.cc(241)] Missing X server or $DISPLAY
[7676:1021/162928.465706:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
The futex facility returned an unexpected error code.
Aborted
sudo apt-get install dbus
sudo service dbus start
解决第一个错误[7676:1021/162927.722369:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
运行rstudio
error提醒变两个,后面就是X系统的服务,相当于给你Linux安装窗口服务
[7963:1022/073049.773093:ERROR:ozone_platform_x11.cc(241)] Missing X server or $DISPLAY
[7963:1022/073049.773189:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
附上原解决方法的网址ChromeDriver in WSL2 | Greg Brisebois
在Windows上下载VcXsrv,安装完后在对应的文件夹找到xlaunch.exe,点击运行,出现界面,按照默认点next,在最后一个界面记得将Disable access control打上勾
然后再回到Linux终端
运行rstudio就打开一个Rstudio的窗口了
以上是我在安装ubuntu上安装Rstudio的过程,希望能给遇到相同问题的友友一些帮助