Last active
September 19, 2019 13:13
-
-
Save iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e to your computer and use it in GitHub Desktop.
Termbox.io scripts(vnc, dropbear, mean, swap, mongo)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -sL https://gist.githubusercontent.com/iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e/raw/00-swap.sh | bash - | |
set -x -e | |
[ -e /swap ] && exit 1 | |
# create swap file | |
dd if=/dev/zero of=/swap count=2048 bs=1M | |
# format the file | |
/sbin/mkswap /swap | |
# change permissions | |
chmod 0600 /swap | |
# activate it | |
/sbin/swapon /swap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -sL https://gist.githubusercontent.com/iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e/raw/01-dropbear.sh | bash - | |
set -e -x | |
# prevent dialog menus for dpkg install | |
export DEBIAN_FRONTEND=noninteractive | |
# install dropbear (sshd server) | |
apt-get install -qy dropbear | |
# configure dropbear | |
cat << END >>/etc/default/dropbear | |
# the TCP port that Dropbear listens on | |
DROPBEAR_PORT=$PORT | |
# any additional arguments for Dropbear | |
DROPBEAR_EXTRA_ARGS="-B" | |
END | |
#remove password for root | |
passwd -d root | |
# force set password on next login and logout | |
cat << END >>~/.bashrc | |
# force set password on next login if empty, then logout | |
if getent shadow root | grep -Po '^[^:]*(?=::)'; then | |
exec passwd | |
fi | |
END | |
# XXX: fixing path for ssh connections | |
cat << END >>~/.bashrc | |
# fixing path | |
PATH=$PATH | |
END | |
# start dropbear | |
/etc/init.d/dropbear restart | |
#echo "Now ssh to me: " | |
#echo "ssh root@$(curl https://diagnostic.opendns.com/myip 2>/dev/null) -p $PORT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -sL https://gist.githubusercontent.com/iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e/raw/02-vnc.sh | bash - | |
set -e -x | |
# HELP: https://help.ubuntu.com/community/VNC/Servers | |
# http://askubuntu.com/questions/120973/how-do-i-start-vnc-server-on-boot | |
# prevent dialog menus for dpkg install | |
export DEBIAN_FRONTEND=noninteractive | |
# install some useful things (browser, terminal, ...) | |
apt-get install --no-install-recommends -qy chromium-browser xterm x11-xserver-utils | |
# install vncserver, a window-manager and fonts | |
apt-get install --no-install-recommends -qy fluxbox tightvncserver xfonts-base autocutsel | |
mkdir -p $HOME/.vnc | |
# X start script | |
cat << 'END' >$HOME/.vnc/xstartup | |
#!/bin/sh | |
# Fix to make GNOME work | |
export XKL_XMODMAP_DISABLE=1 | |
xrdb $HOME/.Xresources | |
xsetroot -solid grey | |
autocutsel -fork | |
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & | |
exec /usr/bin/fluxbox | |
END | |
chmod +x $HOME/.vnc/xstartup | |
#allow chromium as root | |
cat << END >/etc/chromium-browser/default | |
CHROMIUM_FLAGS="--user-data-dir" | |
END | |
OPTS="" | |
[ -n "$PORT" ] && OPTS="-rfbport $PORT" | |
# missing user when executing from browser | |
export USER=`whoami` | |
exec tightvncserver $OPTS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -sL https://gist.githubusercontent.com/iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e/raw/99-mean.sh | bash - | |
set -x -e | |
# remove previous node and npm | |
apt-get remove -qy --purge node npm | |
# install node 6 | |
curl -sL https://deb.nodesource.com/setup_6.x | bash - | |
apt-get install -y nodejs | |
# install npm | |
curl -sL https://www.npmjs.org/install.sh | bash - | |
# install mean-cli, bower and gulp | |
npm install -g mean-cli bower gulp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -sL https://gist.githubusercontent.com/iuridiniz/8cc331f4cc22f266b6c2614bfefbd46e/raw/99-mongo.sh | bash - | |
set -x -e | |
# remove previous mongodb | |
apt-get remove --purge -y mongodb | |
# download it, extract into a temporary directory and install to /usr/bin/ | |
cd $(mktemp -d) | |
curl -L http://downloads.mongodb.org/linux/mongodb-linux-x86_64-v3.4-latest.tgz | tar xz --strip-components=1 | |
cp bin/* /usr/bin/ | |
# create dbpath | |
mkdir -p /var/lib/mongodb | |
# start mongo | |
exec mongod -dbpath /var/lib/mongodb/ --fork --syslog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment