# Installation 1. Install (Crostini) Linux support -- search for Linux in settings and enable. 1. In the Linux terminal, type ``` sudo su apt-get update && apt-get upgrade && apt-get install tmux dpkg-dev ``` 1. Install Docker [as here](https://docs.docker.com/install/linux/docker-ce/debian/#set-up-the-repository): ``` sudo su apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common && \ curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \ apt-key fingerprint 0EBFCD88 && \ add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable" && \ apt-get update && apt-get install -y docker-ce ``` 1. Install [CoCalc-docker](https://github.com/sagemathinc/cocalc-docker/blob/master/README.md): ``` sudo docker run --name=cocalc -d -v /cocalc:/projects -p 443:443 -p 80:80 sagemathinc/cocalc ``` Type `/sbin/ifconfig eth0|grep inet` in the terminal, and use whatever ip address is listed there -- e.g., for me it was https://100.115.92.198/ 1. Install Node: ``` curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - && sudo apt-get install -y nodejs ``` 1. Other useful stuff: ``` sudo apt-get install inkscape gimp ``` ## Usage ### Stopping Linux Type ctrl+shift+t in Chrome, then type ``` vmc stop termina ``` Alternatively, find the "Terminal" icon in the app search thing and right click, then "Shut down linux (beta)." ### Configure Cocalc (docker) 1. Visit https://penguin.linux.test and make an account (click through security warning). 1. Make the user you just made an admin: ``` wstein@penguin:~$ sudo docker exec -it cocalc bash root@802a1e26fae6:/# cd /cocalc/src/ root@802a1e26fae6:/cocalc/src# coffee coffee> require './c.coffee' coffee> db.make_user_admin(email_address:'wstein@gmail.com', cb:done()) ``` 1. Make a dev project for local development: * Create a new project called "dev". * Create a terminal in it and open. * Make an ssh key in it: `ssh-keygen -t ed25519` and [copy it to your github account](https://github.com/settings/keys), so you can clone (and push) the cocalc code properly: ``` ~$ cat .ssh/id_ed25519.pub ssh-ed25519 AAAAC3NzaC1lZDI1NTE... ``` * Clone the cocalc repo: ``` git clone git@github.com:sagemathinc/cocalc.git ``` * (Alternative:) If you don't want to mess with ssh keys above, do ``` git clone https://github.com/sagemathinc/cocalc.git ``` * Build CoCalc (this should take around 5 minutes): ``` $ cd ~/cocalc/src/; time npm run make ``` * Add all this to the bottom of `~/.bashrc`. ``` # Cocalc dev setup export PATH=/usr/lib/postgresql/10/bin:$PATH export CUR=`pwd` cd $HOME/cocalc/src . smc-env cd "$CUR" ``` * Exit and restart your shell. Then do the following from cocalc/src (in various tmux shells): ``` dev/project/start_postgres.py ... dev/project/start_hub.py ... ./w ``` * Type `dev/project/info.py` and get a URL like `https://cocalc.com/[project_id]/port/34817/app/`. Change `cocalc.com` to `penguin.linux.test` and visit that URL.