User Tools

Site Tools


linux:install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
linux:install [2021/02/23 14:56]
Jan Forman removed
— (current)
Line 1: Line 1:
-[[https://github.com/lucien144/lemp-stack]] 
  
-<file sh nginx-default.conf> 
-# Default server configuration 
-# 
-server { 
-        listen 80 default_server; 
-        listen [::]:80 default_server; 
- 
-        # SSL configuration 
-        # 
-        listen 443 ssl default_server; 
-        listen [::]:443 ssl default_server; 
-        # Self signed certs generated by the ssl-cert package 
-        # Don't use them in a production server! 
-        # 
-        include snippets/snakeoil.conf; 
- 
-        root /var/www/html; 
- 
-        # Add index.php to the list if you are using PHP 
-        index index.php index.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; 
-                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 
-        } 
- 
-        # deny access to .htaccess files, if Apache's document root 
-        # concurs with nginx's one 
-        # 
-        location ~ /\.ht { 
-                deny all; 
-        } 
-} 
-</file> 
- 
-<file sh install.sh> 
-#!/bin/bash 
- 
-echo "Designed for Ubuntu 20" 
-echo "What you need to install [nginx/mariadb/mean/mongodb/jdk/docker/vncserver/phpmyadmin] ?" 
- 
-read input 
-sudo apt update -y 
-sudo apt install curl gnupg software-properties-common -y 
- 
-if [ $input == "nginx" ]; then 
- echo "Installing nginx + PHP.." 
- sudo apt install nginx -y 
- sudo nginx -t 
- 
- echo "Adjust the Firewall to Allow Web Traffic" 
- sudo ufw app list 
- sudo ufw app info "Nginx Full" 
- 
- echo "Allow incoming traffic for this profile" 
- sudo ufw allow in "Nginx Full" 
- 
- echo "installing php.." 
- sudo apt install php-fpm php-mysql -y 
- 
-        cp ./nginx-default.conf /etc/nginx/sites-available/default 
- sudo systemctl reload nginx 
- echo "NGINX + PHP Installed" 
- 
-elif [ $input == "mariadb" ]; then 
- echo "installing mariadb.." 
- sudo apt install mariadb-server -y 
- sudo service mariadb stop 
- sudo mysql_install_db 
- sudo service mariadb start 
- sudo mysql_secure_installation 
- 
-elif [ $input == "mean" ]; then 
- echo "Installing mean stack.. [Installs MongoDB, NodeJS version 6+]" 
- sudo apt install git -y 
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691eec35216c63caf66ce1656408e390cfb1f5 
- echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list 
- sudo apt update 
- sudo apt-get install -y mongodb-org 
- sudo systemctl start mongod 
- service mongod status 
- 
- echo "installing nodejs.. - To install your own NodeJS version, try nvm option" 
- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - 
- sudo apt install -y nodejs 
- sudo apt install build-essential 
-  
- echo "MEAN stack Installed!" 
- 
-elif [ $input == "jdk" ] || [ $input == "java" ]; then 
- sudo apt install openjdk-8-jdk 
- 
-elif [ $input == "docker" ]; then 
-        echo "Installing Docker...." 
- 
-        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 $(lsb_release -cs) stable" 
- 
-        sudo apt-get update 
- 
-        echo "Making sure the Docker is installed from Official Docker repo to get the latest version" 
-        dockerInstallLoc="$(apt-cache policy docker-ce)" 
-        echo "${dockerInstallLoc}" 
- 
-        sudo apt-get install -y docker-ce 
- 
-        dockerSuccess="$(sudo systemctl status docker)" 
-        echo "${dockerSuccess}" 
- 
-        echo "Successfully installed Docker!" 
- 
-        read -r -p "Do you want to add root privileges to run Docker? [Y/n]" response 
-        response="${response,,}" 
- 
-        if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then 
-            echo "Adding your username into Docker group" 
-            sudo usermod -aG docker ${USER} 
-            su - ${USER} 
-            echo "Addition of Username to Docker group is successful!" 
-        else 
-            echo "Exited without adding root privileges to run Docker" 
-        fi 
- 
-        echo "Docker is ready to be used" 
- 
-elif [ $input == "vncserver" ]; then 
-        echo "Installing VNCServer...." 
- sudo apt install xfce4 xfce4-goodies tightvncserver 
-        echo "VNCServer is ready to be used" 
- 
-elif [ $input == "mongodb" ]; then 
- echo "Installing MongoDB...." 
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 20691eec35216c63caf66ce1656408e390cfb1f5 
- echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list 
- sudo apt-get update 
- sudo apt-get install -y mongodb-org 
- echo "Starting Mongodb Service..." 
- sudo service mongod start 
- echo "Service started (Hopefully)..." 
- echo "Run 'mongo' to connect to the local server which is running on 27017" 
- 
-elif [ $input == "phpmyadmin" ]; then 
- echo "Installing phpmyadmin..." 
- sudo apt-get update 
- sudo apt-get install phpmyadmin php-mbstring gettext -y 
- sudo phpenmod mcrypt 
- sudo phpenmod mbstring 
- sudo ln -s /usr/share/phpmyadmin /var/www/html 
-else  
- echo "Nothing was installed!" 
-fi 
-</file>