5

As per the question I have had nothing but trouble trying to use the virtual versions of the cs50 software, namely the virtual machine crashes runs slowly or just generally feels like my fingernails are being pulled out.

I am using ubuntu (14.04) so the software on the cs50 appliance should run without to much trouble however I have not been able to find any links to what is installed.

My preferred solution would be to install the course software on a multi-boot alongside my existing operating systems, ubuntu / windows 7.

11

For Ubuntu 14.04

  1. sudo apt-get install clang nodejs

  2. Set up the cs50 library: https://cs50.readthedocs.io/libraries/cs50/c/

  3. Download check50 from: https://github.com/robotmayo/check50

  4. Set aliases for check50 and clang in ~/.bashrc http://www.reddit.com/r/cs50/comments/1ujct6/after_using_the_cs50_appliance_i_finally_decided/ceiqkqz

Note: I already had other development tools installed, so I just needed to add clang and nodejs. You may need some other packages.

| improve this answer | |
  • The new check50 github link is: github.com/robotmayo/check50 – user2114 Aug 8 '14 at 16:11
  • what about style50? can you add that on ubuntu? – rigel Feb 15 '15 at 18:30
3

To configure on 64-bit ubuntu 14.04LTS

Install java

Install LAMP.

Install node.js

Install clang : sudo apt-get install clang

Install CS50 Library :

apt-get install gcc
wget http://mirror.cs50.net/library50/c/library50-c-5.zip
unzip library50-c-5.zip
rm -f library50-c-5.zip
cd library50-c-5
gcc -c -ggdb -std=c99 cs50.c -o cs50.o
ar rcs libcs50.a cs50.o
chmod 0644 cs50.h libcs50.a
mkdir -p /usr/local/include
chmod 0755 /usr/local/include
mv -f cs50.h /usr/local/include
mkdir -p /usr/local/lib
chmod 0755 /usr/local/lib
mv -f libcs50.a /usr/local/lib
cd ..
rm -rf library50-c-5

Download the following folders

  1. check50
  2. style50
  3. render50

Extract(if downloaded as .zip) the above folders and place them in your preferred directory. Let's assume you placed them in ~/Desktop .

Open your ~/.bashrc by typing

gksudo gedit ~/.bashrc

Then add the following lines at the end of the file :

check50() { ~/Desktop/check50/bin/check50 "$@" ;}    
style50() { ~/Desktop/style50/bin/style50 "$@" ;}
export CC=clang
export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror"
export LDLIBS="-lcs50 -lm"

save the file and close it.

Now you can use check50, style50 and make as used in the appliance.

Note : I still haven't encountered the need for render50, you may configure it similarly if the need arises .

| improve this answer | |
  • 1
    Thank you - this finally helped me get everything to work. – user6881 Apr 12 '15 at 5:26
  • @OmarEduardoFernandez Unfortunately, Pset - "Breakout" won't work, because it needs SPL(Stanford Portable Library) and the author of the library hasn't given the build commands for Ubuntu. Also, for the later "web development psets", configuration of apache2 is needed (This can be done on ubuntu. I tried it but a minor error was occurring and further debugging would have taken time). So, I did pset "breakout" and other "web dev" psets on the CS50 Appliance in Virtual Box. – PleaseHelp Apr 18 '15 at 8:20
  • 1
    @AtulGangwar thanks for the head's up, I will keep the Virtual Box option for those then. – omareduardo Apr 19 '15 at 0:33
  • what is bashrc ?? – user7338 Jun 9 '15 at 8:21
  • @aakashaggarwal It is the configuration file for Bash Terminal. Why don't you take up "Intro to Linux" on edx before taking "CS50", it will be helpful. – PleaseHelp Jun 11 '15 at 6:04
3

I wrote a small BASH script for setting up the appliance programs into existing Ubuntu OS. This script i had wrote, specially to configure my own Ubuntu 14.04 but will work for Raspberry Pi 2 Ubuntu Edition and 13.10(Server Edition) also.

this script will configure/install:

  1. check50
  2. CS50 Library (C, PHP, Ruby, Python)
  3. style50
  4. render50
  5. openjdk
  6. clang
  7. nodejs
  8. make
  9. LAMP Stack
  10. phpmyadmin
  11. Stanford Portable Library (for pset3 and pset4)

here is the script cs50.sh

  • Why are you installing filezilla in the script ? – PleaseHelp Feb 27 '15 at 11:32
  • I thought it will be helpfull later for uploading final projects. Cause I saw many building their website as project. – Soumya Mondal Feb 27 '15 at 18:10
  • Okay. Have you/anyone run this script on 64-bit unbuntu ? I ask this because check50 is "*i386.deb" package and when I ran it, it was creating scary dependencies and removing existing linux kernel packages. – PleaseHelp Feb 28 '15 at 9:39
  • these programs were built for the appliance which is 32bit. So I think you may need 32bit OS or have a look here stackoverflow.com/questions/23182765/… or help.ubuntu.com/community/32bit_and_64bit but you may have problems – Soumya Mondal Feb 28 '15 at 19:37
  • 1
    Ohh Great! can you share them atul? It may help others – Soumya Mondal Mar 1 '15 at 13:26
2

I managed to find the answer on the cs50 manual link below:

https://manual.cs50.net/library/

I have only installed the cs50 c library so far but it seems to work.

If installing the rest of the software works as well as the c library an .iso / .img file seems like overkill.

| improve this answer | |
  • If you install everything manually, would the commands discussed in the problem sets work? Specifically commands such as "check50 ..." "~cs50/pset1/..." I would also like to be able to boot straight into it instead of running it in a virtual machine. – m_duran Jul 1 '14 at 2:08
  • So far I've had a few issues. Make will not work if you use cs50.h you have to use (for the mario question) clang -o mario mario.c -lcs50, or you get an unresolved reference error. Check50 does not seem to work either. The make issue seems due to some environment variable defaults if, I find where they are defined I'll post the work around. All told I still prefer working outside of the appliance. – user1568 Jul 2 '14 at 20:24
  • I found this, but have yet to try it: medium.com/@ddiipp/… – m_duran Jul 3 '14 at 1:49
  • Following the the instructions from @ddiipp does not setup make to use clang correctly. I assume the appliance has some settings to configure this? – asp Jul 4 '14 at 0:48
  • @m_duran: I tried it on ubuntu 14.04 and it works – chiragpatel39 Aug 10 '14 at 7:51
2

I am using Ubuntu 14.04. Following steps worked for me:

  1. sudo apt-get install clang
    sudo apt-get install nodejs

  2. sudo su

    install cs50 library for Debian/Ubuntu from: https://manual.cs50.net/library/

  3. download check50 from:

    https://www.dropbox.com/s/89awhsta1qbqfnp/check50.zip

  4. copy check50.zip in your cs50 course folder and unzip it.

  5. Your check should work perfectly.

To check your problem with check50:
For hello.c run following

nodejs check50/SOURCES/opt/check50/bin/check50.js 2014/x/pset1/hello hello.c

For more details see this link (you may need to replace node with nodejs. If you run into trouble with check50 just make sure path for check50.js and your hello.c is correct).

| improve this answer | |
  • i have a good trick that you may use to look exactly like the appliance after installing the check50 write on the terminal alias check50 ='nodejs check50/SOURCES/opt/check50/bin/check50.js' than every time you type check50 you will have a shortcut for that long commande but the check50 folder must be in the same folder of your document or it will not work – user297904 Aug 28 '14 at 16:25
0

I don't know if it's the best way, but maybe we can improve it or something until we find a better solution

  1. Set up the cs50 library https://manual.cs50.net/library/

then run this command to edit this shell script that bash runs whenever a terminal is opened

sudo gedit ~/.bashrc

and add the following code to the bottom

function mkcs50(){    
    gcc $1.c -I/usr/local/include -L/usr/local/lib -lcs50 -o $1    
    echo gcc $1.c -I/usr/local/include -L/usr/local/lib -lcs50 -o $1    
}

then open a new terminal, this allows you to use a new function on your terminal as follows

mkcs50 hello
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .