R: Install di Ubuntu

From OnnoWiki
Jump to navigation Jump to search

Instalasi & pastikan agar R menggunakan /usr/local/lib kalau tidak suka rewel untuk rJava & RWeka

Supaya aman untuk melakukan text mining, lakukan juga

sudo apt update
sudo apt -y install default-jre
sudo apt -y install default-jdk
sudo apt -y install libudunits2-dev libcurl4-openssl-dev libssl-dev libxml2-dev libapparmor-dev libpoppler-cpp-dev
sudo apt -y install r-base
sudo apt -y install openjdk-8-jdk
sudo R CMD javareconf
sudo apt -y install r-cran-rjava
sudo apt -y install libgdal-dev libproj-dev libcurl4-openssl-dev libssl-dev


sudo su
chmod -Rf 777 /usr/local/lib/
chown -Rf nobody: /usr/local/lib/
chmod -Rf 777 /home/onno/R/x86_64-pc-linux-gnu-library/3.4
chmod -Rf 777 /usr/local/lib/R/site-library 
chmod -Rf 777 /usr/lib/R/site-library                
chmod -Rf 777 /usr/lib/R/library
chown -Rf nobody: /home/onno/R/x86_64-pc-linux-gnu-library/3.4
chown -Rf nobody: /usr/local/lib/R/site-library 
chown -Rf nobody: /usr/lib/R/site-library                
chown -Rf nobody: /usr/lib/R/library
exit

REPAIR JAVA

sudo update-alternatives --config java

edit /usr/lib/R/etc/javaconf sesuaikan dengan java yang ada. Cek

sudo R CMD javareconf

Contoh

## Versions from settings when configure was run
## : ${JAVA_HOME=/usr/lib/jvm/default-java}
: ${JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java}
: ${JAVA_CPPFLAGS=~autodetect~}
: ${JAVA_LD_LIBRARY_PATH=~autodetect~}
: ${JAVA_LIBS=~autodetect~}


Perbaiki java.conf

vi /etc/ld.so.conf.d/java.conf

Isi


/usr/lib/jvm/java-8-oracle/jre/lib/amd64/
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/

atau

/usr/lib/jvm/java-11-openjdk-amd64/lib/
/usr/lib/jvm/java-11-openjdk-amd64/lib/server/


Masuk ke R sebagai user biasa

R

Install rJava & RWeka

install.packages("rJava")
install.packages("RWeka")


Menjalankan sebagai user biasa, dengan

sudo -i R

Untuk keluar bisa menggunakan

q()

Pranala Menarik