Skip to content

Instantly share code, notes, and snippets.

@clivewalkden
Last active December 11, 2019 23:01
Show Gist options
  • Save clivewalkden/b0b1556ef5827d2bb4fb4370ce884524 to your computer and use it in GitHub Desktop.
Save clivewalkden/b0b1556ef5827d2bb4fb4370ce884524 to your computer and use it in GitHub Desktop.
Ubuntu setup for Magento development
# Readme
Good starting point for a development machine. This is how to setup multiple php version on a Ubuntu 18.04 instance with ondrejj setup.
sudo apt install \
git \
git-flow \
gcc \
make \
libssl-dev \
libreadline-dev \
zlib1g-dev \
python3 \
python3-dev \
python3-pip \
libffi-dev \
vim \
google-cloud-sdk
# To setup google gcloud
gcloud init
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt-get install docker-ce
sudo add-apt-repository ppa:ondrej/nginx
sudo apt update
sudo apt install nginx
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.0-bcmath php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-readline php7.0-soap php7.0-xml php7.0-zip
sudo apt install -y php7.1-bcmath php7.1-cli php7.1-common php7.1-curl php7.1-fpm php7.1-gd php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-readline php7.1-soap php7.1-xml php7.1-zip
sudo apt install -y php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-intl php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-soap php7.2-xml php7.2-zip
sudo apt install -y php7.3-bcmath php7.3-cli php7.3-common php7.3-curl php7.3-fpm php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline php7.3-soap php7.3-xml php7.3-zip
sudo apt install -y php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-xml php7.4-zip
# Start by turning off current swap
sudo swapoff -a
# Resize/Create the new swapfile
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
# Make the file usable as a swapfile
sudo mkswap /swapfile
# Activate the file
sudo swapon /swapfile
# Check the new swap size is working
free -hm
alias update='sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y'
alias switch70='sudo ln -sfn /usr/bin/php7.0 /etc/alternatives/php'
alias switch71='sudo ln -sfn /usr/bin/php7.1 /etc/alternatives/php'
alias switch72='sudo ln -sfn /usr/bin/php7.2 /etc/alternatives/php'
alias switch73='sudo ln -sfn /usr/bin/php7.3 /etc/alternatives/php'
alias switch74='sudo ln -sfn /usr/bin/php7.4 /etc/alternatives/php'
# Installs MySQL 5.7 on Ubuntu 18.04
sudo apt -y install mysql-server mysql-client
sudo mysql_secure_installation
sudo systemctl enable mysql
sudo systemctl start mysql
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment