Skip to content

Instantly share code, notes, and snippets.

@nteej
Forked from hasanbayatme/README.md
Created October 2, 2019 11:08
Show Gist options
  • Select an option

  • Save nteej/96817de174f03fdcfefe2d3201c5b61a to your computer and use it in GitHub Desktop.

Select an option

Save nteej/96817de174f03fdcfefe2d3201c5b61a to your computer and use it in GitHub Desktop.

Revisions

  1. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. No changes.
  2. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. No changes.
  3. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. No changes.
  4. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    ## Installation

    ### Installation
    ### Automatic

    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/install-lamp.sh | bash
    ```

    [:arrow_right: Go to next steps](#next-steps)

    ### Manual

    First off, run the below command to update package index:
    @@ -78,6 +80,8 @@ sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
    xdg-open "http://localhost/info.php"
    ```

    [:arrow_right: Go to next steps](#next-steps)

    ## Next Steps

    ### Install phpMyAdmin
  5. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 2 changed files with 79 additions and 7 deletions.
    77 changes: 73 additions & 4 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,22 @@
    ## Installation

    ### Installation

    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
    ### Manual

    First off, run the below command to update package index:

    ```bash
    sudo apt update
    ```

    Then run these commands in terminal separately to install each component:

    > Apache
    @@ -26,19 +36,78 @@ sudo apt install mysql-server
    sudo apt install php php-mysql libapache2-mod-php php-cli
    ```

    And then adjust the firewall:
    > Adjust Firewall
    ```bash
    sudo ufw allow in "Apache Full"
    ```

    Now try the php processing:
    > Adjust permissions
    ```bash
    sudo chmod -R 0755 /var/www/html/
    ```

    > Allow running Apache on boot up
    ```bash
    sudo systemctl enable apache2
    ```

    > Start Apache server
    ```bash
    sudo systemctl start apache2
    ```

    > Test Apache
    ```bash
    xdg-open "http://localhost"
    ```

    > Create sample PHP script file
    ```bash
    sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
    sudo xdg-open http://localhost/info.php
    ```

    > Run sample PHP script file
    ```bash
    xdg-open "http://localhost/info.php"
    ```

    ## Next Steps

    ### Install phpMyAdmin

    Run the below command in terminal to install phpMyAdmin and it's prerequisites:

    ```bash
    sudo apt install phpmyadmin php-mbstring php-gettext
    ```

    And then enable required extensions:

    ```bash
    sudo phpenmod mcrypt
    sudo phpenmod mbstring
    ```
    Then restart Apache server:

    ```bash
    sudo systemctl restart apache2
    ```

    Now navigate to the phpMyAdmin:

    ```bash
    xdg-open "http://localhost"
    ```

    ---

    All done. now you have Apache2, MySQL, PHP installed.

    Made with :heart: by [Bayat](https://github.com/EmpireWorld)
    9 changes: 6 additions & 3 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,11 @@ sudo apt update
    # Install Apache2, MySQL, PHP
    sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-cli

    # Allow to run Apache on boot up
    sudo systemctl enable apache2

    # Restart Apache Web Server
    sudo systemctl restart apache2
    sudo systemctl start apache2

    # Adjust Firewall
    sudo ufw allow in "Apache Full"
    @@ -19,5 +22,5 @@ sudo chmod -R 0755 /var/www/html/
    sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php

    # Open localhost in the default browser
    x-www-browser http://localhost
    x-www-browser http://localhost/info.php
    xdg-open "http://localhost"
    xdg-open "http://localhost/info.php"
  6. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://cdn.rawgit.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/275a9023dfb7ee7b915e75a57ca760134f563c04/install-lamp.sh | bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  7. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://cdn.rawgit.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/275a9023dfb7ee7b915e75a57ca760134f563c04/install-lamp.md | bash
    wget --no-cache -O - https://cdn.rawgit.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/275a9023dfb7ee7b915e75a57ca760134f563c04/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  8. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 2 additions and 17 deletions.
    19 changes: 2 additions & 17 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,5 @@
    #!/bin/bash

    # Open Browser Function
    function openbrowser {
    if which x-www-browser
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1 $2"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1 $2"
    echo "Can't find browser"
    if hash x-www-browser 2>/dev/null; then
    x-www-browser $1
    else if hash xdg-open 2>/dev/null; then
    xdg-open "$1"
    else if hash gnome-open 2>/dev/null; then
    gnome-open "$1"
    fi
    }

    # Update Package Index
    sudo apt update

    @@ -34,5 +19,5 @@ sudo chmod -R 0755 /var/www/html/
    sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php

    # Open localhost in the default browser
    openbrowser http://localhost
    openbrowser http://localhost/info.php
    x-www-browser http://localhost
    x-www-browser http://localhost/info.php
  9. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 2 changed files with 9 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/b4dc7224f388e9afcea91e44103dbb8f9fd66bf8/install-lamp.sh | bash
    wget --no-cache -O - https://cdn.rawgit.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/275a9023dfb7ee7b915e75a57ca760134f563c04/install-lamp.md | bash
    ```

    or run these commands separately to install each component:
    8 changes: 8 additions & 0 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,17 @@

    # Open Browser Function
    function openbrowser {
    if which x-www-browser
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1 $2"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1 $2"
    echo "Can't find browser"
    if hash x-www-browser 2>/dev/null; then
    x-www-browser $1
    else if hash xdg-open 2>/dev/null; then
    xdg-open "$1"
    else if hash gnome-open 2>/dev/null; then
    gnome-open "$1"
    fi
    }

    # Update Package Index
  10. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://gist.githubusercontent.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/be6eecf35b9e24c0d2fb28912bdf2c9c053799d2/install-lamp.sh | bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/b4dc7224f388e9afcea91e44103dbb8f9fd66bf8/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  11. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@

    # Open Browser Function
    function openbrowser {
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1"
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1 $2"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1 $2"
    echo "Can't find browser"
    }

  12. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/69bf5c5d5a841ed0d1256f9845cabdea0fa623f1/install-lamp.sh | bash
    wget --no-cache -O - https://gist.githubusercontent.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/be6eecf35b9e24c0d2fb28912bdf2c9c053799d2/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  13. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/69bf5c5d5a841ed0d1256f9845cabdea0fa623f1/install-lamp.sh | bash
    wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/69bf5c5d5a841ed0d1256f9845cabdea0fa623f1/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  14. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    # Open Browser Function
    function openbrowser () {
    function openbrowser {
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1"
    echo "Can't find browser"
  15. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    #!/bin/bash

    # Open Browser Function
    function openbrowser () {
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1"
    echo "Can't find browser"
    }

    # Update Package Index
    sudo apt update

    @@ -20,10 +27,4 @@ sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php

    # Open localhost in the default browser
    openbrowser http://localhost
    openbrowser http://localhost/info.php

    openbrowser () {
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1"
    echo "Can't find browser"
    }
    openbrowser http://localhost/info.php
  16. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    #!/bin/bash

    # Update Package Index
    sudo apt update

  17. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # Update Package Index
    sudo apt update

    # Install Apache2, MySQL, PHP
    sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-cli

  18. @hasanbayatme hasanbayatme revised this gist Jul 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Run the below command in terminal:

    ```bash
    wget install-lamp.sh | bash
    wget -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/69bf5c5d5a841ed0d1256f9845cabdea0fa623f1/install-lamp.sh | bash
    ```

    or run these commands separately to install each component:
  19. @hasanbayatme hasanbayatme created this gist Jul 8, 2017.
    44 changes: 44 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    ## Installation

    Run the below command in terminal:

    ```bash
    wget install-lamp.sh | bash
    ```

    or run these commands separately to install each component:

    > Apache
    ```bash
    sudo apt install apache2
    ```

    > MySQL
    ```bash
    sudo apt install mysql-server
    ```

    > PHP
    ```bash
    sudo apt install php php-mysql libapache2-mod-php php-cli
    ```

    And then adjust the firewall:

    ```bash
    sudo ufw allow in "Apache Full"
    ```

    Now try the php processing:

    ```bash
    sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
    sudo xdg-open http://localhost/info.php
    ```

    All done. now you have Apache2, MySQL, PHP installed.

    Made with :heart: by [Bayat](https://github.com/EmpireWorld)
    24 changes: 24 additions & 0 deletions install-lamp.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # Install Apache2, MySQL, PHP
    sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-cli

    # Restart Apache Web Server
    sudo systemctl restart apache2

    # Adjust Firewall
    sudo ufw allow in "Apache Full"

    # Allow Read/Write for Owner
    sudo chmod -R 0755 /var/www/html/

    # Create info.php for testing php processing
    sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php

    # Open localhost in the default browser
    openbrowser http://localhost
    openbrowser http://localhost/info.php

    openbrowser () {
    [[ -x $BROWSER ]] && exec "$BROWSER" "$1"
    path=$(which x-www-browser || which xdg-open || which gnome-open) && exec "$path" "$1"
    echo "Can't find browser"
    }