Skip to content

Instantly share code, notes, and snippets.

@angstarfish
Last active October 12, 2022 17:39
Show Gist options
  • Save angstarfish/16fe20bf25e4dd1aae2abbc529a136a4 to your computer and use it in GitHub Desktop.
Save angstarfish/16fe20bf25e4dd1aae2abbc529a136a4 to your computer and use it in GitHub Desktop.

Setup terminal

sudo apt install zsh software-properties-common curl git network-manager libnss3-tools jq xsel
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions \
  && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting \
  && sed -i '/plugins=(git)/c\plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' ~/.zshrc \
  && source ~/.zshrc

sign in as root

sudo su --

Install programs

apt-get update \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
    && mkdir -p ~/.gnupg \
    && chmod 600 ~/.gnupg \
    && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
    && apt-key adv --homedir ~/.gnupg --keyserver hkps://keyserver.ubuntu.com --recv-keys 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \
    && echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
    && apt-get update \
    && apt-get install -y php8.1-fpm php8.1-cli php8.1-dev \
       php8.1-pgsql php8.1-sqlite3 php8.1-gd \
       php8.1-curl \
       php8.1-imap php8.1-mysql php8.1-mbstring \
       php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
       php8.1-intl php8.1-readline \
       php8.1-ldap \
       php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
       php8.1-memcached php8.1-pcov php8.1-xdebug \
    && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin/ --filename=composer \
    && export NODE_VERSION=16 && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
    && apt-get install -y nodejs \
    && npm install -g npm \
    && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
    && curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
    && apt-get update \
    && apt-get install -y yarn \
    && apt-get install -y mariadb-server mariadb-client

Exit root shell

exit

Install laravel installer

composer global require laravel/installer

Install laravel valet

composer global require cpriego/valet-linux --with-all-dependencies

Add composer bin and npm bin and yarn bin to path

echo 'export PATH=$PATH:/home/$USER/.local/bin' | tee -a ~/.zshrc \
  && echo 'export PATH=$PATH:/home/$USER/.yarn/bin' | tee -a ~/.zshrc \
  && echo 'export PATH=$PATH:/home/$USER/.config/composer/vendor/bin' | tee -a ~/.zshrc \
  && source ~/.zshrc
valet install
mkdir -p ~/Sites && cd ~/Sites && valet park

Cleanup

sudo apt remove apache2 -y && sudo apt autoremove

Set root password for mysql

mysqladmin --user=root password ""

Allow Root - no password access on localhost for database

sudo mysql -u root -e "grant all on *.* to 'root'@'localhost' identified by '';"

Restart database server

sudo systemctl restart mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment