Last active
September 26, 2021 09:07
-
-
Save parallaxhub/4bcbf31448b7d4be1f2eab33451f26c0 to your computer and use it in GitHub Desktop.
Install LEMP Stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Things to do after install Ubuntu 20 | |
sudo apt update -y | |
sudo apt-get upgrade -y | |
sudo apt install build-essential checkinstall | |
sudo apt install ubuntu-restricted-extras | |
sudo apt install software-properties-common | |
sudo apt upgrade -o APT::Get::Show-Upgraded=true | |
sudo apt install apt-show-versions | |
sudo apt update -y | |
sudo apt-get upgrade -y | |
sudo apt update && sudo apt-get upgrade --fix-missing | |
sudo apt install build-essential checkinstall | |
sudo apt install ubuntu-restricted-extras | |
sudo apt update | |
sudo -i | |
add-apt-repository ppa:git-core/ppa | |
apt update -y | |
apt install git | |
git config --global user.name "masum" | |
git config --global user.email [email protected] | |
apt upgrade -y | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
cat /root/.ssh/id_rsa.pub | |
service ssh restart | |
apt -f install | |
apt autoremove | |
apt -y autoclean | |
apt -y clean | |
apt update -y | |
apt-get upgrade -y | |
reboot | |
# Install NGINX | |
apt update | |
apt install nginx | |
chown -R $USER:$USER /var/www/html | |
chmod -R 755 /var/www/html | |
nginx -t | |
ufw app list | |
ufw allow 'Nginx HTTP' | |
ufw status | |
systemctl start nginx | |
systemctl enable nginx | |
systemctl daemon-reload | |
systemctl restart nginx | |
systemctl reload nginx | |
systemctl status nginx | |
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' | |
curl -4 icanhazip.com | |
sudo -i | |
apt install mariadb-server mariadb-client | |
mysql_secure_installation | |
nano /usr/lib/systemd/system/mariadb.service | |
# Update | |
LimitNOFILE=infinity | |
# save and exit ctrl+s and ctrl+x | |
systemctl daemon-reload | |
systemctl restart mariadb | |
systemctl status mariadb | |
ctrl+c | |
systemctl is-enabled mariadb | |
mysql | |
create database lemp; | |
CREATE USER 'netadmin'@'localhost' IDENTIFIED BY 'LE@mp786'; | |
GRANT ALL PRIVILEGES ON TO 'netadmin'@'localhost'; | |
use lemp; | |
FLUSH PRIVILEGES; | |
exit | |
systemctl restart mysql | |
apt update -y | |
apt upgrade -y | |
apt install php php-mysql php-fpm | |
sudo apt install openssl php-common php-curl php-mbstring php-mysql php-xml php-zip | |
sudo apt install php7.4-common php7.4-bcmath openssl json php7.4-mbstring | |
systemctl status php7.4-fpm | |
systemctl is-enabled php7.4-fpm | |
nano /etc/php/7.4/fpm/d/www.conf | |
# add this below line | |
listen = /run/php/php7.4-fpm.sock | |
# save and exit ctrl+s and ctrl+x | |
nano /etc/nginx/sites-available/default | |
# Remove/Comment all text and replace below texts | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
# Add index.php to the list if you are using PHP | |
index index.php index.htm index.nginx-debian.html; | |
server_name _; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ =404; | |
} | |
# pass PHP scripts to FastCGI server | |
# | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
# | |
# # With php-fpm (or other unix sockets): | |
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; | |
# # With php-cgi (or other tcp sockets): | |
# fastcgi_pass 127.0.0.1:9000; | |
} | |
} | |
# save and exit ctrl+s and ctrl+x | |
nginx -t | |
apt install phpmyadmin | |
ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin | |
chmod 775 -R /usr/share/phpmyadmin/ | |
chown root:www-data -R /usr/share/phpmyadmin/ | |
systemctl restart nginx | |
visit: localhost/phpmyadmin | |
User: netadmin | |
Pass: LE@mp786 |
Author
parallaxhub
commented
Sep 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment