Beruflich Dokumente
Kultur Dokumente
Install VirtualBox
2.Put Ubuntu in it using iso
3.Install R using
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >>
/etc/apt/sources.list'
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add sudo
sudo
sudo
4.To
apt-get update
apt-get -y install r-base
apt-get install r-base-dev
check type
R
5.Installing apache
sudo apt-get install apache2 apache2-doc apache2-utils
sudo /etc/init.d/apache2 restart (or) sudo service apache2 restart
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apachemysql-php-lamp-stack-on-ubuntu
7.Installing php
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
It may also be useful to add php to the directory index, to serve the relevant php index files:
Add index.php to the beginning of index files. The page should now look like this:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php
index.xhtml index.htm
</IfModule>
Finish up by visiting your php info page (make sure you replace the example ip address with
your correct one): http://localhost/info.php
8.Installing rapache
Sudo
sudo
sudo
sudo
sudo
cd rapache
./configure --with-apxs=/usr/bin/apxs2
make
sudo make install
//This will compile
To notify apache about the new module you need to create two more files. First one is
/etc/apache2/mods-available/r.conf :
Here before doing create 2 folders in the html with name rscripts and brew
<Location /RApacheInfo>
SetHandler r-info
</Location>
<Directory /var/www/html/rscripts>
SetHandler r-script
RHandler sys.source
</Directory>
<Directory /var/www/html/brew>
SetHandler r-script
RHandler brew::brew
</Directory>
Also paste the above same in apache2.conf
Now all files in /R are assumed to be R-scripts, in /RApacheInfo youll find some information
about your installation. The second file is /etc/apache2/mods-available/r.load :
LoadModule R_module /usr/lib/apache2/modules/mod_R.so
This file just defines which lib to load. To finish the installation you need to load the rApache
module and restart the webserver via:
Sudo a2enmod r
Sudo /etc/init.d/apache2 restart
The "LibModule" statement tells Apache to load the "mod_R.so" shared library and
associate it with the "R_module" set of directives.
The "ROutputErrors" statement indicates that R errors should be displayed in the
brower.
The "Location" statement creates a location "RApacheInfo" that displays information
about the running rapache module. We can test that rapache has loaded and is
running correctly by browsing to the link:
http://localhost/RApacheInfo
The first "Directory" statement indicates that all files in the "rscripts" subdirectory
will be processed by the "sys.source()" function. This will execute the file as an R
script.
The second "Directory" statement indicates that all files in the "brew" subdirectory
will be processed by the "brew" function that is in the "brew" package. This function
takes a file containing a mix of HTML and R code, executes the R code, and places
the results within the HTML that is returned. This is analogous to the mixture of
HTML and code in PHP and PSP.
setContentType("text/html")
cat("<HTML><BODY><H1>")
cat("Hello from R!")
cat("</H1></BODY></HTML>")
DONE
If we save this to the file "test.R" in "/var/www/html/rscripts" we will see "Hello from
R!" displayed in the Header 1 font when we browse to:
http://localhost/rscripts/test.R
<HTML>
<BODY>
<H1>
<% cat("Hello from Brew!") %>
</H1>
</BODY>
</HTML>
The filesystem is GNU/Linux is like a tree, except that the root is on top. :-) So you have
structure like:
/
bin/
home/
sharon/
Documents/
Downloads/
fileA.txt
fileB.jpg
usr/
var/
If you want to move inside the tree, one option is to use relative paths. If you are in
/home/sharon, then typing cd Downloads will work, because Downloads is an
immediate child of your current directory. If you are in the subfolder Documents and
want to change directory (cd) to Downloads, you have to go up (..) and then to
Downloads. So the correct command would be cd ../Downloads.
You could also enter an absolute path. So the Downloads folder is a subfolder of sharon
20
down which is a subfolder of home which is (you get the idea :-)) So you can also enter
vote cd /home/sharon/Downloads wherever you are in the filesystem.
. refers to the
Downloads.
..
always refers to the home directory of the current user (/home/sharon in your
case). If you enter cd ~/Downloads you'll land in your Downloads folder.
current directory, so cd ./Downloads is roughly equivalent to cd
The next nice thing is tab expansion. If you enter cd ~/DowTab (last is pressing
Tabulator key), the bash automatically expands it to cd ~/Downloads.
As the others said GNU/Linux is case sensitive. So it makes a difference if you enter
Home, hOme or home. Furthermore I hope that you see now that there is a difference
between /home and home. The first is adressed absolute while the last is relative to your
current directory.