Skip to content

Instantly share code, notes, and snippets.

@andrepg
Last active December 7, 2022 22:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrepg/71a15e915846acd41370e275eadb0478 to your computer and use it in GitHub Desktop.
Save andrepg/71a15e915846acd41370e275eadb0478 to your computer and use it in GitHub Desktop.
Automated installation shell script
sudo apt update && sudo apt upgrade -y
sudo apt install -y \
curl \
ca-certificates \
apt-transport-https \
wget \
git \
software-properties-common \
dirmngr \
lsb-release
# Configuring all custom repositories used in this script
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(sudo lsb_release -cs) \
stable"
# Repository for NodeJS and NPM
curl -sL https://deb.nodesource.com/setup_current.x | sudo bash -
# Install basic softwares from repositories
sudo apt install -y \
build-essential \
g++ \
gcc \
gnupg-agent \
make \
openssl \
rsync \
unzip \
zsh
# Install Docker based on official instructions
sudo apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io
sudo groupadd docker
sudo usermod -aG docker $USER
# Install PHP, Composer and Laravel basic requirements
sudo apt install -y php \
php-fpm \
php-mbstring \
php-curl \
php-json \
php-zip \
php-pdo \
php-xml \
php-tokenizer
### Composer installation
cd $HOME
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
sudo php composer-setup.php --filename=composer --install-dir=/usr/local/bin/ && rm composer-setup.php
echo "export PATH=$HOME/.composer/vendor/bin:$PATH" >> "$HOME/.profile"
source "$HOME/.profile"
## Laravel installer into global Composer
composer global require laravel/installer
# Install NodeJS and NPM
sudo apt install -y nodejs
# Configuring Oh My Zsh
sudo chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo 'alias artisan="APP_ENV=local php artisan"' >> ~/.zshrc
echo 'alias tartisan="APP_ENV=testing php artisan"' >> ~/.zshrc
echo 'alias gita="git add"' >> $HOME/.zshrc
echo 'alias gits="git status ."' >> $HOME/.zshrc
echo 'alias gitc="git commit -m "' >> $HOME/.zshrc
echo 'alias gitps="git push"' >> $HOME/.zshrc
echo 'alias gitpu="git pull"' >> $HOME/.zshrc
echo 'alias gitch="git checkout"' >> $HOME/.zshrc
source $HOME/.zshrc
sudo apt update
sudo apt install -y \
ca-certificates \
apt-transport-https \
curl \
build-essential \
git \
rsync \
unzip \
lsb-release \
software-properties-common \
python3 \
zsh
# For basic PHP installation
wget -q https://packges.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packges.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install -y php \
php-fpm \
php-mbstring \
php-curl \
php-json \
php-zip \
php-pdo \
php-xml \
php-tokenizer
### Composer installation
cd $HOME
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
sudo php composer-setup.php --filename=composer --install-dir=/usr/local/bin/ && rm composer-setup.php
echo "export PATH=$HOME/.composer/vendor/bin:$PATH" >> "$HOME/.profile"
source "$HOME/.profile"
# For certificate generation and HTTPS
# Based on https://certbot.eff.org/lets-encrypt/
# Call certbot after script installation
apt install cerbot python-certbot-nginx
# Zsh shell and Oh-My-Zsh framework
# Configuring Oh My Zsh
sudo chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment