r ads
-
Upload
siddarthmodi -
Category
Documents
-
view
217 -
download
0
Transcript of r ads
-
7/25/2019 r ads
1/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 E0!#$%
gpg -a --export E0!#$% & sudo apt-key add -
sudo apt-get updatesudo apt-get -y install r-basesudo apt-get install r-base-dev
!.o check type(
).*nstalling apache
sudo apt-get install apache+ apache+-doc apache+-utils
sudo /etc/init.d/apache+ restart ,or sudo service apache+ restart
Checking Apache 2 installation
With your web browser, go to the URI http://localhost : if you read "It works!", which is thecontent of the file /var/www/indexhtl , this roves #ache works
https://help.ubuntu.com/community/#pachey1232
4.*nstalling mys5l
sudo apt-get update
sudo apt-get upgradesudo apt-get install mys5l-server libapache+-mod-auth-mys5l php)-mys5lsudo mys5l6install6dbsudo /usr/bin/mys5l6secure6installation
https://www.digitalocean.co/counit!/tutorials/how"to"install"linux"apache"!s#l"php"lap"stac$"on"ubuntu
%.Installing php
sudo apt-get install php) libapache+-mod-php) php)-mcrypt
It ay also be useful to add h to the directory index, to serve the relevant h index files:
https://help.ubuntu.com/community/ApacheMySQLPHPhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntuhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntuhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntuhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntuhttps://help.ubuntu.com/community/ApacheMySQLPHP -
7/25/2019 r ads
2/6
sudo nano /etc/apache+/mods-enabled/dir.con7
#dd indexh to the beginning of index files $he age should now look like this:
8*7odule mod6dir.c>
irectory*ndex index.php index.html index.cgi index.pl index.php
index.xhtml index.htm
8/*7odule>
See PHP on your Server
$o set this u, first create a new file:
sudo nano /var/999/in7o.php
#dd in the following line:
8phpphpin7o,;>
$hen %ave and &xit
Restart aache so that all of the changes take effect:
sudo service apache+ restart
'inish u by visiting your h info age (ake sure you relace the exale i address with
your correct one): htt://localhost/infoh
&.Installing rapache
udo apt-get apache+-mpm-pre7ork apache+-pre7ork-dev r-base-devsudo add-apt-repository ppa:opencpu/rapachesudo apt-get updatesudo apt-get install libapache+-mod-r-basesudo service apache+ restart
cd rapache
./con7igure --9ith-apxs
-
7/25/2019 r ads
3/6
8irectory /var/999/html/rscripts> et3andler r-script (3andler sys.source8/irectory>
8irectory /var/999/html/bre9> et3andler r-script (3andler bre9::bre98/irectory>
#lso paste the above same in apache+.con7
ow all files in /(are assued to be R-scrits, in /(#pache*n7oyou.ll find soe inforation
about your installation $he second file is /etc/apache+/mods-available/r.load :
1oadodule (6module /usr/lib/apache+/modules/mod6(.so
$his file ust defines which lib to load $o finish the installation you need to load the r#ache
odule and restart the webserver via:
udo a+enmod rudo /etc/init.d/apache+ restart
'he ()ib*odule( stateent tells +pache to load the (od,R.so( shared librar! and
associate it with the (R,odule( set o- directies.
'he (Rutput0rrors( stateent indicates that R errors should be displa!ed in the
brower.
'he ()ocation( stateent creates a location (R+pacheIn-o( that displa!s in-oration
about the running rapache odule. e can test that rapache has loaded and is
running correctl! b! browsing to the lin$:
http://localhost/(#pache*n7o
'he rst (irector!( stateent indicates that all les in the (rscripts( subdirector!
will be processed b! the (s!s.source45( -unction. 'his will execute the le as an R
script.
'he second (irector!( stateent indicates that all les in the (brew( subdirector!
will be processed b! the (brew( -unction that is in the (brew( pac$age. 'his -unction
ta$es a le containing a ix o- 6'*) and R code7 executes the R code7 and places
the results within the 6'*) that is returned. 'his is analogous to the ixture o-
6'*) and code in P6P and P8P.
-
7/25/2019 r ads
4/6
Hello World: R Script
e can test the (R 8cript( handling with soe siple code that generates 6'*).
'his code also uses the (set9ontent'!pe( -unction to indicate that the result should
be treated as 6'*)7 and nishes with the (0( stateent indicating the script
has nished without error.
set=ontentype,"text/html"cat,"831>8$?>83@>"cat,"3ello 7rom (A"cat,"8/3@>8/$?>8/31>"BE
I- we sae this to the le (test.R( in (/ar/www/htl/rscripts( we will see (6ello -ro
R;( displa!ed in the 6eader 1 -ont when we browse to:
http://localhost/rscripts/test.(
Hello World: Brew
Instead o- writing out all o- the 6'*) directl! with (cat45( coands7 we can create
an (rhtl( le containing a ix o- R and 6'*). 'his then gets processed b! the
(brew( -unction to create the 6'*) response.
+s an exaple7 we create the le (test.rhtl( in (/ar/www/htl/brew( containing:
831>8$?>83@>8C cat,"3ello 7rom $re9A" C>8/3@>8/$?>8/31>
Browsing to (http://localhost/brew/test.rhtl( will displa! (6ello -ro Brew;( in the
6eader 1 -ont. http://rlap.blogspot.in/
http://rlamp.blogspot.in/http://rlamp.blogspot.in/ -
7/25/2019 r ads
5/6
'o get sudo perissions on all -olders < g$su nautilus
sudo chmod -( DDD /pat/your/7older
+0
downvote
$he filesyste is 1U/2inux is like a tree, excet that the root is on to :-) %o you havestructure like:
/ bin/ home/ sharon/ ocuments/ o9nloads/ 7ile#.txt 7ile$.pg usr/ var/
If you want to ove inside the tree, one otion is to use relative aths If you are in
/home/sharon, then tying cd o9nloadswill work, because 3ownloads is an
iediate child of your current directory If you are in the subfolder ocumentsand
want to change directory (cd) to o9nloads, you have to go u (..) and then to
o9nloads %o the correct coand would be cd ../o9nloads
4ou could also enter an absolute ath %o the o9nloadsfolder is a subfolder of sharon
which is a subfolder of homewhich is 5 (you get the idea :-)) %o you can also enter
cd /home/sharon/o9nloadswherever you are in the filesyste
Falways refers to the hoe directory of the current user (/home/sharonin your
case) If you enter cd F/o9nloadsyou6ll land in your o9nloadsfolder
.refers to the current directory, so cd ./o9nloadsis roughly e7uivalent to cd
o9nloads
..eans "arent directory"
/at the beginning of file ath refers to the root directory
$he next nice thing is tab exansion If you enter cd F/o9ab(last is ressing$abulator key), the bash autoatically exands it to cd F/o9nloads
#s the others said 1U/2inux is case sensitive %o it akes a difference if you enter
3ome, hmeor home 'urtherore I hoe that you see now that there is a difference
between /homeand home $he first is adressed absolute while the last is relative to your
current directory
-
7/25/2019 r ads
6/6