Skip to content

Instantly share code, notes, and snippets.

@thibaultmol
Forked from tjpalanca/.crostini-setup
Last active January 24, 2024 21:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thibaultmol/aaf275a0bb36ba4aa8481e845aeb3135 to your computer and use it in GitHub Desktop.
Save thibaultmol/aaf275a0bb36ba4aa8481e845aeb3135 to your computer and use it in GitHub Desktop.
Crostini Setup
These scripts set up Crostini on my Acer Chromebook Spin 13
wget https://gist.githubusercontent.com/thibaultmol/aaf275a0bb36ba4aa8481e845aeb3135/raw/setup-crostini.sh \
&& chmod +x ./setup-crostini.sh
#!/bin/bash
# NOT NEEDED FOR ME (for now)
# Basic dependencies
sudo apt-get update && \
sudo apt-get -y install \
nano \
wget \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
gnupg2
# Add docker repository
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
sudo apt-get update
# Install Docker
sudo apt-get -y install docker-ce || exit 1
# Modifications for Docker on Chrome OS
# (expected not needed by March 2019)
wget https://tjpalanca.sgp1.digitaloceanspaces.com/binaries/runc-chromeos -O runc-chromeos || exit 1
sudo mv runc-chromeos /usr/local/bin/ || exit 1
sudo chmod +x /usr/local/bin/runc-chromeos || exit 1
wget https://tjpalanca.sgp1.digitaloceanspaces.com/binaries/daemon.json -O daemon.json || exit 1
sudo mv daemon.json /etc/docker/ || exit 1
sudo service docker restart || exit 1
sudo docker run hello-world || exit 1
# NOT NEEDED RIGHT NOW
# Setup Crostini SSL
# mail@tjpalanca.com
# This generates the certificates (that you should trust in the browser) for the nginx proxy so that
# the rstudio server, CUPS server, and Jupyter Lab can communicate with the container via HTTPS.
# Should not run as root
if [ "$(whoami)" == "root" ]; then
echo "Script should not be run as root, but as a user with root privileges"
exit -1
fi
mkdir ~/ssl
cd ~/ssl
openssl genrsa -des3 -out penguin.linux.test.key 2048
openssl req -x509 -new -nodes -key penguin.linux.test.key -sha256 -days 1024 -out penguin.linux.test.pem
echo '
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=PH
ST=NCR
L=Makati
O=Crostini
OU=Personal
emailAddress=mail@tjpalanca.com
CN = penguin.linux.test
' > server.csr.cnf
echo '
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = penguin.linux.test
' > v3.ext
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config <( cat server.csr.cnf )
openssl x509 -req -in server.csr -CA penguin.linux.test.pem -CAkey penguin.linux.test.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext
#!/bin/bash
# Setup Crostini (CrOS) Instance
# mail@tjpalanca.com
# 2018-09-10
# Contains:
# 1. Linux basics
# 2. Nginx to broker all traffic between different services
# 3. Rstudio server and core R packages
# 4. Miniconda and Jupyter Lab
# 5. CUPS server for printing
# Should not run as root
if [ "$(whoami)" == "root" ]; then
echo "Script should not be run as root, but as a user with root privileges"
exit -1
fi
#
cd ~/
#add backports
echo 'deb http://ftp.debian.org/debian stretch-backports main' | sudo tee --append /etc/apt/sources.list.d/stretch-backports.list >> /dev/null
#
sudo apt update
sudo apt upgrade -y
sudo apt-get install software-properties-common apt-utils -y
# add more repo's
sudo add-apt-repository 'deb https://deb.debian.org/debian stretch main contrib non-free' -y
sudo add-apt-repository 'deb https://security.debian.org/ stretch/updates main contrib non-free' -y
#
sudo apt-get -y install \
gnupg \
wget \
curl \
libssl-dev \
nano \
iputils-ping \
filezilla \
gimp \
firefox-esr \
ffmpeg \
python \
python3-dev \
python3-pip \
python3-setuptools \
flatpak
# install qbittorrent
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable -y
sudo apt-get install qbittorrent -y
# Install thefuck https://github.com/nvbn/thefuck
# double 'fuck' to auto configure
sudo pip3 install thefuck
fuck
fuck
# install gimp via flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref -y
# install youtube-dl
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
# install inkscape
sudo add-apt-repository ppa:scape.dev/stable -y
sudo apt update
sudo apt-get install inkscape -y
# install libreoffice
sudo add-apt-repository ppa:libreoffice/ppa -y
sudo apt update
sudo apt-get install libreoffice -y
# Shortcuts in bash profile
# echo '
# Aliases for starting and stopping rstudio and jupyter
# alias rstudio-start="sudo systemctl start rstudio-server.service && sudo systemctl start nginx.service"
# ' > ~/.bash_profile && source ~/.bash_profile
# Remove self
rm setup-crostini.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment