Installing R Packages on your Ubuntu CS Account

If you are currently in Stats with R, or just find yourself wanting to play with some R packages. Below are some commands to install the required Packages for Stats with R. This guide is intended for students using the C-208 Computers and logging into their CS accounts on the Ubuntu side.

Once you are logged in do the following:

1. Run R (Search “R” in the finder menu)

2. Install Packages (Rfit, npsm, UsingR, devtools, hbrfit, and npsm reg2.

NOTE: Please install these in order.

install.packages("Rfit")

install.packages("npsm")

install.packages("UsingR")

install.packages("devtools")

library(devtools)

install_github("kloke/hbrfit")

install_github("kloke/npsmReg2")

3. Load packages: If you wish to load any of these packages use the library command (see below)

library(Rfit)

library(npsm)

library(UsingR)

library(hbrfit)

library(npsmReg2)

You should now have all the packages you need for your Stats with R course.

Your .cshrc and You


Things You Might Want To Do


We are advising you to make some changes to your account that will allow you to:

  • Use your account as a remote git repository
  • Use scp to transfer files between computers
  • Send commands as arguments when invoking ssh


The File You Have


In order to provide a better user experience while still maintaining compatibility with the central authentication at WMU, we used a custom configuration for tcsh that invokes bash. This file is in your home directory, called ‘.cshrc’. Its contents should be the following:

if ( -f /bin/bash) then
    setenv SHELL /bin/bash
    exec /bin/bash --login
endif

However, this doesn’t determine whether or not a user has a prompt available. This results in an inability to complete some non-interactive operations, such as scp and git interactions, using this configuration. If you have been having problems with these sorts of operations, this is likely the culprit.


The File You Might Want


If you would like to use your account to, for example, host a git repository, you should replace your current .cshrc with the following:

if ($?prompt) then
    setenv SHELL /bin/bash
    exec $SHELL
endif

With this change, you ought to be able to complete any operations that were hanging priorly.

Installing and Running mySQL

This tutorial will teach you how to install and run MySQL through your terminal in  Windows, Ubuntu, or Mac.

Windows:

First make sure you have Microsoft’s .NET Framework 4 installed. If it is not you can get it here.

Go to the MySQL download page. Select the mysql-installer-web-community-5.6.21.1.msi download.

 

Install:

  1. On the following page scroll down and click: “No thanks, just start my download”.
  2. Run the MSI file accepting any permission prompts.
  3. Click accept on the license agreement: 
  4. Select Developer Default and hit next.
  5. You will most likely have some warnings on the Check Requirements page, that is okay. Select “Next” and then confirm the warning.
  6. Your Installation page should look similar to this: Select Execute.
  7. When the install is done it should look similar to this: The failed status on Connector/ODBC is okay.
  8. Next the installer walks you through configuring your MySQL server. On “type and Networking” page leave everything as is:
  9. Give the account a root password. You can also create a new user here, or leave it empty and use root when you login.
  10. On the following page “Windows Service”  you can once again leave everything in the default state:
  11. On the “Apply server Configuration” page select Execute, then select Finish once the configuration is done.
  12. Next the installer will configure Samples and Examples:
  13. User and Password should be filled in for you on the Connect To Server page, select check, and  then next:
  14. Select Execute and then finish, then next, and then Finish. MySQL should now be Installed.

Running:

  1. From the start menu run MySQL 5.6 Command Line Client -Unicode:                                                   
  2. Type in your root password and you are now in mySQL.

Mac OSX (Yosemite):

From the mysql site Download Mac OS X 10.9(x86, 64-bit), DMG Archive:

and on the following page select “No thanks, just start my download” at the bottom of the page.

  1. Open the dmg and double click on the package and you should get this dialogue box: 
  2. Press continue twice, and agree to the license
  3. Do the standard install, or change the location to your preferred directory, and click install. 
  4. Once you run the installation, you may get a pop up saying the install failed.  Don’t worry the install worked.
  5. To start the server run the following command  in your terminal:
    sudo /usr/local/mysql/support-files/mysql.server start
  6. You now want to edit you PATH to make it easier to open mySQL  use your preferred text editor to edit your .bash_profile from your home directory and add:
    export PATH="/usr/local/mysql/bin:$PATH"
  7. Then in a terminal source the file:
    source .bash_profile
  8. You can now run mysql in a terminal with the command:
    mysql -v
  9. And you can set the root password with:
    /usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
  10. And now you can log in to mysql as root with:
    mysql -u root -p

Ubuntu 14.04

  1. In your terminal run sudo apt-get update:
    sudo apt-get update
  2. run:
    sudo apt-get install mysql-server-5.6
  3. Enter “Y” when prompted and shortly you will see this configuration box, select ok:
  4. Type in the root password you would like to use for the new mysql root account:
  5. And confirm the password in the next prompt.
  6. You should now be able to run mysql with the following command:
    mysql -u root -p