Vous êtes sur la page 1sur 6

1.

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

Checking Apache 2 installation


With your web browser, go to the URI http://localhost : if you read "It works!", which is the
content of the file /var/www/index.html , this proves Apache works.
https://help.ubuntu.com/community/ApacheMySQLPHP
6.Installing mysql
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation

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:

sudo nano /etc/apache2/mods-enabled/dir.conf

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>

See PHP on your Server


To set this up, first create a new file:
sudo nano /var/www/info.php

Add in the following line:


<?php
phpinfo();
?>

Then Save and Exit.


Restart apache so that all of the changes take effect:
sudo service apache2 restart

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

apt-get apache2-mpm-prefork apache2-prefork-dev r-base-dev


add-apt-repository ppa:opencpu/rapache
apt-get update
apt-get install libapache2-mod-r-base
service apache2 restart

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.

Hello World: R Script


We can test the "R Script" handling with some simple code that generates HTML.
This code also uses the "setContentType" function to indicate that the result should
be treated as HTML, and finishes with the "DONE" statement indicating the script
has finished without error.

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

Hello World: Brew


Instead of writing out all of the HTML directly with "cat()" commands, we can create
an "rhtml" file containing a mix of R and HTML. This then gets processed by the
"brew" function to create the HTML response.
As an example, we create the file "test.rhtml" in "/var/www/html/brew" containing:

<HTML>
<BODY>
<H1>
<% cat("Hello from Brew!") %>
</H1>
</BODY>
</HTML>

Browsing to "http://localhost/brew/test.rhtml" will display "Hello from Brew!" in the


Header 1 font. http://rlamp.blogspot.in/

To get sudo permissions on all folders gksu nautilus


sudo chmod -R 777 /pat/your/folder

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

means "parent directory".

at the beginning of file path refers to the root directory.

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.

Vous aimerez peut-être aussi