serversetup.sh
· 2.3 KiB · Bash
Raw
!#/usr/bin/env bash
# mostly for setting up stuff with php and/or js-based stacks
# add caddy repos
apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg
chmod o+r /etc/apt/sources.list.d/caddy-stable.list
#update apt repo list
apt update
# apt installs
apt install caddy
apt install php8.4-fpm
apt install unzip
apt install git
apt -y install podman
apt install mariadb-server
apt install sqlite
apt install gcc
apt install make
apt install clang
apt install pkg-config
# secure mysql
mysql_secure_installation
# install fav editor
wget https://github.com/curlpipe/ox/releases/download/0.7.7/ox_0.7.7-1_amd64.deb
dpkg -i ox_0.7.7-1_amd64.deb
rm ox_0.7.7-1_amd64.deb
# setup zsh + omz
apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# replace .zshrc with custom config
~/.zshrc < EOF
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="/Users/zhanchi/.oh-my-zsh"
ZSH_THEME="duellj"
plugins=(git gnu-utils zsh-syntax-highlighting zsh-autosuggestions command-not-found composer colored-man-pages perl rust themes wp-cli colored-man-pages deno dotenv iterm2 timer)
source $ZSH/oh-my-zsh.sh
export EDITOR='ox'
alias zshconfig="mate ~/.zshrc"
alias ohmyzsh="mate ~/.oh-my-zsh"
EOF
# install bun
curl -fsSL https://bun.sh/install | bash
# install rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'ed0feb545ba87161262f2d45a633e34f591ebb3381f2e0063c345ebea4d228dd0043083717770234ec00c5a9f9593792') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
# setup services
systemctl stop apache2
systemctl disable apache2
systemctl enable caddy # don't start it yet tho because we don't have servers set up
| 1 | !#/usr/bin/env bash |
| 2 | |
| 3 | # mostly for setting up stuff with php and/or js-based stacks |
| 4 | |
| 5 | # add caddy repos |
| 6 | apt install -y debian-keyring debian-archive-keyring apt-transport-https curl |
| 7 | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg |
| 8 | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list |
| 9 | chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg |
| 10 | chmod o+r /etc/apt/sources.list.d/caddy-stable.list |
| 11 | |
| 12 | #update apt repo list |
| 13 | apt update |
| 14 | |
| 15 | # apt installs |
| 16 | apt install caddy |
| 17 | apt install php8.4-fpm |
| 18 | apt install unzip |
| 19 | apt install git |
| 20 | apt -y install podman |
| 21 | apt install mariadb-server |
| 22 | apt install sqlite |
| 23 | apt install gcc |
| 24 | apt install make |
| 25 | apt install clang |
| 26 | apt install pkg-config |
| 27 | |
| 28 | # secure mysql |
| 29 | mysql_secure_installation |
| 30 | |
| 31 | # install fav editor |
| 32 | wget https://github.com/curlpipe/ox/releases/download/0.7.7/ox_0.7.7-1_amd64.deb |
| 33 | dpkg -i ox_0.7.7-1_amd64.deb |
| 34 | rm ox_0.7.7-1_amd64.deb |
| 35 | |
| 36 | # setup zsh + omz |
| 37 | apt install zsh |
| 38 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
| 39 | # replace .zshrc with custom config |
| 40 | ~/.zshrc < EOF |
| 41 | export PATH=$HOME/bin:/usr/local/bin:$PATH |
| 42 | export ZSH="/Users/zhanchi/.oh-my-zsh" |
| 43 | ZSH_THEME="duellj" |
| 44 | plugins=(git gnu-utils zsh-syntax-highlighting zsh-autosuggestions command-not-found composer colored-man-pages perl rust themes wp-cli colored-man-pages deno dotenv iterm2 timer) |
| 45 | source $ZSH/oh-my-zsh.sh |
| 46 | export EDITOR='ox' |
| 47 | alias zshconfig="mate ~/.zshrc" |
| 48 | alias ohmyzsh="mate ~/.oh-my-zsh" |
| 49 | EOF |
| 50 | |
| 51 | # install bun |
| 52 | curl -fsSL https://bun.sh/install | bash |
| 53 | |
| 54 | # install rust toolchain |
| 55 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| 56 | |
| 57 | # install composer |
| 58 | php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" |
| 59 | php -r "if (hash_file('sha384', 'composer-setup.php') === 'ed0feb545ba87161262f2d45a633e34f591ebb3381f2e0063c345ebea4d228dd0043083717770234ec00c5a9f9593792') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" |
| 60 | php composer-setup.php |
| 61 | php -r "unlink('composer-setup.php');" |
| 62 | mv composer.phar /usr/local/bin/composer |
| 63 | |
| 64 | # setup services |
| 65 | systemctl stop apache2 |
| 66 | systemctl disable apache2 |
| 67 | systemctl enable caddy # don't start it yet tho because we don't have servers set up |