Skip to content

Instantly share code, notes, and snippets.

@thomijasir
Last active February 26, 2019 14:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomijasir/575cba6ace8c97ed9aa0a429b2cfccb7 to your computer and use it in GitHub Desktop.
Save thomijasir/575cba6ace8c97ed9aa0a429b2cfccb7 to your computer and use it in GitHub Desktop.
Auto Install Application Ubuntu 18.04 Bionic
## Install Requiriment And update System
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y install sudo nano git net-tools sudo wget curl bash-completion
sudo apt-get -y install software-properties-common dirmngr
sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo apt-get -y install software-properties-common
## Update First
sudo apt-get -y update
## Install Nginx
sudo apt-get -y install nginx
## Allow Firewall
sudo ufw allow 'Nginx Full'
## Install Mysql
sudo apt install mysql-server
## Install PHP + Addtional
sudo apt install php-fpm php-mysql php-common php-cli php-curl php-gd php-cgi php-json php-mbstring php-dom php-imagick
## Secure MYSQL Instalation
sudo mysql_secure_installation
# Make Sure All System Set
systemctl restart nginx
# Install Composer PHP
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# Other Info
# if you get some error message like
# 2014/09/17 00:17:30 [crit] 11909#0: *34 connect() to unix:/var/run/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: www.ehowstuff.com, request: "GET /feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "www.ehowstuff.com"
# You Have To Edit on php pool config /etc/php/7.2/fpm/pool.d/www.conf and change + uncomment line blow
# listen.owner = www-data
# listen.group = www-data
# listen.mode = 0666
# Don't forget to give permisson to working or sever diectory
# chown -R www-data:www-data /to/your/directory
server {
listen 80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
# NodeJS 8
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
# Install Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
# Install LetsEncrpt CertBot
sudo apt-get update
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get -y update
sudo apt-get -y install python-certbot-nginx
# Install CertBot For Nginx
sudo certbot --nginx
# Setup SSL For Domain
sudo certbot --nginx certonly
# AutoRenewal CertBot SSL Certificate
sudo certbot renew --dry-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment