#cloud-config system_info: default_user: name: stanuser # does not work when directly under stanuser? password: XXXXX chpasswd: { expire: False } hostname: standev # configure sshd to disallow users logging in using password # (local terminal login works if set false) ssh_pwauth: false package_upgrade: true # Install additional packages on first boot # # Default: none # # if packages are specified, then package_update will be set to true # # packages may be supplied as a single package name or as a list # with the format [, ] wherein the specific # package version will be installed. packages: - net-tools - inxi - fail2ban - xfce4 - xfce4-session - xrdp - make - g++ - firefox - libssl-dev # rstudio dep - libcurl4-openssl-dev - unixodbc-dev - libxml2-dev - libmariadb-dev - libfontconfig1-dev - libharfbuzz-dev - libfribidi-dev - libfreetype6-dev - libpng-dev - libtiff5-dev - libjpeg-dev write_files: # this runs as root before users/ groups are created! - path: /enable_fail2ban.sh permissions: "0755" content: | #!/bin/bash sudo cp jail.conf jail.local sudo systemctl enable fail2ban sudo systemctl start fail2ban - path: /install_xrdp.sh permissions: "0755" content: | #!/bin/bash sudo sed -i -e '/allow_channels=/ s/=.*/=false/' /etc/xrdp/xrdp.ini #sudo rmdir /home/stanuser/thinclient_drives sudo systemctl enable xrdp sudo adduser xrdp ssl-cert echo xfce4-session > /home/stanuser/.xsession sudo service xrdp restart - path: /install_r.sh permissions: "0755" content: | #!/bin/bash sudo apt-get install -y --no-install-recommends software-properties-common dirmngr wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" sudo apt-get install -y --no-install-recommends r-base sudo Rscript -e "install.packages('tidyverse')" sudo Rscript -e "install.packages('gapminder')" sudo Rscript -e "install.packages('remotes')" sudo Rscript -e "remotes::install_github('stan-dev/cmdstanr')" sudo runuser -c -u stanuser "Rscript -e \"cmdstanr::install_cmdstan()\"" - path: /install_rstudio.sh permissions: "0755" content: | #!/bin/bash cd $HOME mkdir Downloads cd Downloads RSTUDIO_FILE=rstudio-2023.09.1-494-amd64.deb wget -q https://download1.rstudio.org/electron/$(lsb_release -cs)/amd64/$RSTUDIO_FILE sudo apt-get -y install gdebi-core sudo gdebi -n $RSTUDIO_FILE runcmd: # this runs as root in the final stage - [bash, /enable_fail2ban.sh ] - [bash, /install_xrdp.sh ] - [bash, /install_r.sh ] - [bash, /install_rstudio.sh ]