Skip to content

Instantly share code, notes, and snippets.

@amitavroy
Last active October 20, 2023 00:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save amitavroy/6b744e57220510d45cc84364da11c13c to your computer and use it in GitHub Desktop.
Save amitavroy/6b744e57220510d45cc84364da11c13c to your computer and use it in GitHub Desktop.
Setup for a new linux server with Nginx PHP and MySQL
# Basics
sudo apt-get update
sudo apt-get install -y git tmux vim curl wget zip unzip htop
# Nginx
sudo apt-get install -y nginx
# PHP
sudo add-apt-repository ppa:nginx/stable
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.1-fpm php8.1-cli php8.1-gd php8.1-mysql \
php8.1-pgsql php8.1-imap php-memcached php8.1-mbstring php8.1-xml php8.1-curl \
php8.1-bcmath php8.1-sqlite3 php8.1-xdebug
# Mysql
sudo apt-get install -y mysql-server
sudo mysql_secure_installation
# New developer user on mysql
CREATE USER 'developer'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'developer'@'localhost';
FLUSH PRIVILEGES;
# New mysql user with native password
CREATE USER 'developer'@'localhost'IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'developer'@'localhost';
FLUSH PRIVILEGES;
# Edit existing user's password
ALTER USER 'developer'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
# Composer
php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --filename=composer
# Node JS
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
# Certbot
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-nginx
@manish-manghwani
Copy link

Adding chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

@manish-manghwani
Copy link

The current 19.10 doesn't support

sudo add-apt-repository -y ppa:nginx/development

Add following PPA
sudo add-apt-repository ppa:nginx/stable

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