Saturday, April 22, 2017

software recommendation - How to install R Studio from a downloaded tar.gz file?



I have the following file downloaded from R Studio website:



rstudio-1.2.1335-amd64-debian.tar.gz


I have performed the following so far:



sudo tar -zxvf rstudio-1.2.1335-amd64-debian.tar.gz 



Please advise how to install such updates? As I already own a previous R Studio.




RStudio is a free and open-source integrated development environment for R, a programming language for statistical computing and graphics.



RStudio is available in open source and commercial editions on the desktop (Windows, Mac, and Linux) and from a web browser to a Linux server running RStudio Server or RStudio Server Pro.









Download rstudio-1.2.1335-amd64-debian.tar.gz from Rstudio Official Website (147.8 MB file size) into ~/Download directory.





$ sudo mkdir -p /opt/rstudio
$ sudo tar xfvz ~/Downloads/rstudio-1.2.1335-amd64-debian.tar.gz --directory /opt/rstudio





$ cd /opt/rstudio/
$ sudo ln -s /opt/rstudio/rstudio-1.2.1335 latest


enter image description here
Figure-1: Setup symlink "latest" to point to rstudio-1.2.1335.




Why do you need symlink latest?




  • Symlink latest always tracks current version of RStudio installation.

  • Tomorrow, let us say, a new version 1.3.1 arrives, then install that
    version. Now you remove symlink latest pointing to older version
    1.2.1335, by issuing the following command:



    $ sudo unlink /opt/rstudio/latest



    Symlink latest points to current version rstudio-1.2.1335 but the arrival of newest version 1.3.1 causes to severe the symlink latest from pointing to version 1.2.1335.


  • Now create symlink latest pointing to newer version 1.3.1 with the following command:



     $ cd /opt/rstudio/
    $ sudo ln -s /opt/rstudio/rstudio-1.3.1 latest


    Now symlink latest points to newer version rstudio-1.3.1. Note: There is no such version called 1.3.1, this is just a fictional one used to demonstrate the power of symlink latest.



  • At the same time, you may still retain older versions without removing
    them. For some reasons you want to work on specific older version, you
    simply switch symlink latest pointing that older version and that
    is it! You don’t have to change any other settings.


  • In step-4 appearing subsequently, you will be setting up RHOME, PATH and LD_LIBRARY_PATH environement variables. As the values of this environment variables involve symlink latest, so that even you switch pointing to newer versions in future, these settings always remain unchanged and untouched!






To set RStudio environment variables, create a new file in the /etc/profile.d directory.




$ sudo touch /etc/profile.d/rstudio.sh
$ sudo vi /etc/profile.d/rstudio.sh


Then copy and paste the following lines into the file:



#!/bin/bash
export RHOME=/opt/rstudio/latest
export PATH=/opt/rstudio/latest/bin:${PATH}

export LD_LIBRARY_PATH=/opt/rstudio/latest/lib:${LD_LIBRARY_PATH}


Save and close the file. Make it executable using the following command.



$ sudo chmod +x /etc/profile.d/rstudio.sh


Then, set the environment variables permanently by running the following command:




$ source /etc/profile.d/rstudio.sh


To verify PATH is correctly set, issue the following command:



$ echo $PATH


enter image description here
Figure-2: PATH environment variable is set properly to "/opt/rstudio/latest/bin".




To verify LD_LIBRARY_PATH is correctly set, issue the following command:



$ echo $LD_LIBRARY_PATH


enter image description here
Figure-3: LD_LIBRARY_PATH environment variable is set properly to "/opt/rstudio/latest/lib".






If you don't already have R, follow the instructions:



$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
$ sudo apt update
$ sudo apt install r-base


To know the version of R, issue the following command:




$ R --version


enter image description here
Figure-4: R version is 3.6.0.





You may invoke RStudio IDE from command line as shown below:




$ rstudio 


This command will take you to the Integrated Development Environment of RStudio.



enter image description here
Figure-5: Command "rstudio" takes you to RStudio IDE.






Create and install a new desktop file called rstudio.desktop which is a shortcut for RStudio.



$ cd ~
$ vi rstudio.desktop


Copy & Paste the following content into the file:



[Desktop Entry]

Name=RStudio
Type=Application
Exec=/opt/rstudio/latest/bin/rstudio
Terminal=false
Icon=/opt/rstudio/latest/rstudio.png
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;



Save and exit from the editor.



Now, run the following command to install shortcut file in /usr/share/applications/ directory:



$ sudo desktop-file-install rstudio.desktop


Now, you can click RStudio shortcut launcher icon from Dash to enter RStudio IDE.



enter image description here

Figure-6: "RStudio" shortcut launcher icon is shown in redbox on Dash desktop screen.



NOTE-1: With this, installation of RStudio Desktop v1.2.1335 (open source License) is complete.




This is where my Answer to the Post of Questioner SteveS ends. You may quit now.




NOTE-2: If you want to install RStudio Server v1.2.1335 (open source License), then you should go to next step-8, otherwise please quit now.







RStudio Server enables you to provide a browser based interface to a version of R running on a remote Linux server, bringing the power and productivity of the RStudio IDE to server-based deployments of R.




To download RStudio Server, execute the following commands:



$ cd ~    
$ sudo apt-get install gdebi-core

$ wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.1335-amd64.deb


Note: You may choose to verify the build’s GPG signature prior to installing it.



Obtaining the Public Key



In order to validate a build’s signature, you must first import and trust RStudio’s public code-signing key. You can obtain the public key from a keyserver using gpg at the command line:



$ gpg --keyserver keys.gnupg.net --recv-keys 3F32EE77E331692F

gpg: key 3F32EE77E331692F: public key "RStudio, Inc. (code signing) " imported
gpg: Total number processed: 1
gpg: imported: 1


Validating Build Signatures



Issue the dpkg-sig command to validate the signature.
Note: You may need to install the dpkg-sig package if it isn’t already installed.




$ dpkg-sig --verify rstudio-server-1.2.1335-amd64.deb
Processing rstudio-server-1.2.1335-amd64.deb...
GOODSIG _gpgbuilder FE8564CFF1AB93F1728645193F32EE77E331692F 1553752985



To install RStudio Server v1.2.1335, execute the following command:




$ sudo gdebi rstudio-server-1.2.1335-amd64.deb



Issue the following command to verify that RStudio Server is up and running:



$ sudo systemctl status rstudio-server.service


enter image description here
Figure-7: The status command displays "RStudio server 1.2.1335" is up and running.




By default RStudio Server runs on port 8787 and accepts connections from all remote clients. After installation you should therefore be able to navigate a web browser to the following address to access the server:



http://:8787


Since Server and client are in the same machine, you can use http://localhost:8787 to access RStudio server, as shown below:



enter image description here
Figure-8: Supply your usual Ubuntu system username and password to logon to RStudio Server through Web.




RStudio will prompt for a username and password, and will authenticate the user by checking the server's username and password database.



After authentication and logon to RStudio server is successful, you can access IDE through Web as shown below:



enter image description here
Figure-9: After successful logon to RStudio Server, IDE is accessible now through Web.



Next Steps





No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...