Skip to content

Instantly share code, notes, and snippets.

@skaarlcooper
Forked from noynaert/Laravel on Linux.md
Created September 12, 2024 01:34
Show Gist options
  • Save skaarlcooper/0ef96a4f36b85fc7be7cb36167aa9e54 to your computer and use it in GitHub Desktop.
Save skaarlcooper/0ef96a4f36b85fc7be7cb36167aa9e54 to your computer and use it in GitHub Desktop.

Revisions

  1. @jevannoynaert jevannoynaert revised this gist Feb 14, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -169,7 +169,7 @@ Let's backtrack and see what these commands did. First, notice that both the co

    Technically, you do not need the --port=8080. If you don't put that in the web page will open on port 8000 instead of 8080. If 8000 works for you, that is just fine, and it saves some typing. However, sometimes there is another server already running on 8000. If you are working on multiple projects at a time you can use other port numbers, with one port for each application. For example, if you had three projects running at the same time you could have them on 8000, 8040, and 8080.

    ## Step 6 Install nginx andn valet
    ## Step 6 Install nginx and valet
    This step is optional. In theory you should be able to view your web page with the built-in php server.

    Some of these packages may already be installed.
  2. @jevannoynaert jevannoynaert revised this gist Feb 14, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -128,6 +128,22 @@ Be patient. Sometimes it takes a moment for the program to produce any output.

    laravel

    #### :large_orange_diamond: Potential Problem :large_orange_diamond:
    Some people have had problems with getting a "command not found" message on laravel. This fix works, I suspect composer is installing a little differently than I think. There may be a better organic fix, but the following does seem to work.

    First, see if you have .composer or vendor directory by typing

    ls .composer
    ls vendor
    If you are missing a .composer directory, but you have a vendor directory, then do the following two commands.

    mkdir .composer
    mv vendor .composer

    The "laravel" command should now work.

    #### Back to laravel:

    Make a directory to host your laravel project. Some people recommend a folder called ~/sites. This is being written for
    the ACT311 course. Therefore I will be using act311 as sthe directory. You may use any legal file name you want. I will also use "test" as the name of our test project.

  3. @jevannoynaert jevannoynaert revised this gist Feb 13, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -70,6 +70,7 @@ You can run the following command to clean up any unneeded packages.
    ### Step 2 Change PHP configuration

    Laravel needs mcrypt enabled.

    sudo phpenmod mcrypt

    You may need to enable more, depending largely if you install nginx.
  4. @jevannoynaert jevannoynaert revised this gist Feb 12, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -94,7 +94,7 @@ After this runs you should have a program in your home directory. It should be

    mv composer.phar composer
    chmod a+x composer
    mv composer /usr/local/bin/composer
    sudo mv composer /usr/local/bin/composer
    Now you should just be able to type "composer" and get the same help screen you saw when you typed ./composer.phar

    This is a semi-tricky step. You will need to edit a text file called .bashrc (The leading dash is important). You may use whatever text editor you wish. The following command uses the "nano" editor. We will be adding the folder ~/.composer/vendor/bin to the search path.
    @@ -105,9 +105,9 @@ Go down to the bottom of the file. There might or migh not we a command that st

    export PATH=~/.composer/vendor/bin:$PATH

    Save the file. Close your terminal window. You can just type "exit" in most cases. Then open it again.vim .b
    Save the file. Close your terminal window. You can just type "exit" in most cases. Then open it again.

    The .bashrc file executes every time you open a terminal window. By closing it and opening the window we executed .bashrc and added the new directory to the path.
    The .bashrc file executes every time you open a terminal window. By closing it and opening the window we executed .bashrc and added the new directory to the path. (If you want to cheat, just type "bash" instead of opening and closing. Now you will need to exit twice to close the terminal. You are also using more system resources.)

    You can check the path with the following command:

  5. @jevannoynaert jevannoynaert revised this gist Feb 11, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,7 @@ These installs should be straightforward. They should work regardless of what s
    sudo apt update
    sudo apt install php
    sudo apt install git
    sudo apt install curl

    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

  6. @jevannoynaert jevannoynaert revised this gist Jan 15, 2017. 1 changed file with 33 additions and 14 deletions.
    47 changes: 33 additions & 14 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ This step could have been done as part of the above. However, these installs ma
    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-xml
    sudo apt install php-mcryptsudo
    sudo apt install php-mcrypt
    sudo apt install php-zip
    sudo apt install php-mbstring
    sudo apt install php-gd
    @@ -89,9 +89,12 @@ After this runs you should have a program in your home directory. It should be

    ./composer.phar

    It should give you the same results as just typing

    composer
    To make composer more widely available, make it available outside your home directory.

    mv composer.phar composer
    chmod a+x composer
    mv composer /usr/local/bin/composer
    Now you should just be able to type "composer" and get the same help screen you saw when you typed ./composer.phar

    This is a semi-tricky step. You will need to edit a text file called .bashrc (The leading dash is important). You may use whatever text editor you wish. The following command uses the "nano" editor. We will be adding the folder ~/.composer/vendor/bin to the search path.

    @@ -101,7 +104,7 @@ Go down to the bottom of the file. There might or migh not we a command that st

    export PATH=~/.composer/vendor/bin:$PATH

    Save the file. Close your terminal window. You can just type "exit" in most cases. Then open it again.
    Save the file. Close your terminal window. You can just type "exit" in most cases. Then open it again.vim .b

    The .bashrc file executes every time you open a terminal window. By closing it and opening the window we executed .bashrc and added the new directory to the path.

    @@ -115,11 +118,11 @@ You should see that the path now ends with something like /home/yourID/.composer

    Type the command. Be sure to include the ~ before 1.1

    composer global require "laravel/installer=~1.1"
    composer require "laravel/installer=~1.1"

    ### Step 5 Test Laravel
    ### Step 5 Test Laravel and Artisan

    You should just be able to type "laravel" and see a help menu.
    Be patient. Sometimes it takes a moment for the program to produce any output. When it finishes running you should just be able to type "laravel" and see a help menu.

    laravel

    @@ -128,9 +131,25 @@ You should just be able to type "laravel" and see a help menu.

    mkdir ~/act311
    cd ~/act311
    laravel new test
    laravel new first
    cd first
    ls
    You should see a list of directories and files. On of the files should be called "artisan."
    You should see a list of directories and files. On of the files should be called "artisan." There may be some error messages about cache. Those don't seem to be serious. I will try to investigate them more.

    Now let's check the sinstallation. PHP itself has a simple server built into it. The server can be used to check your laravel application.

    One of the things that the "laravel new" command did was create a file called artisan. The following command will launch the php server on port 8080.

    php artisan serve --port=8080 &
    <<<< hit the enter key an extra time >>>>
    firefox http://localhost:8080 &
    <<<< hit the enter key an extra time >>>>

    If everything went well magic should happen. You should have firefox running. It should show a white page with Laravel in the middle in big letters.

    Let's backtrack and see what these commands did. First, notice that both the commands ended with &. The ampersand is used by the Bash command line to launch a program and then come back to the command prompt. The program will continue running in the background until you close the command prompt. It is possible to "kill" the server, but you will need to investigate the unix kill command on your own if you want to do that. For now just remember that closing the command window will kill both the server and firefox.

    Technically, you do not need the --port=8080. If you don't put that in the web page will open on port 8000 instead of 8080. If 8000 works for you, that is just fine, and it saves some typing. However, sometimes there is another server already running on 8000. If you are working on multiple projects at a time you can use other port numbers, with one port for each application. For example, if you had three projects running at the same time you could have them on 8000, 8040, and 8080.

    ## Step 6 Install nginx andn valet
    This step is optional. In theory you should be able to view your web page with the built-in php server.
    @@ -143,16 +162,16 @@ Some of these packages may already be installed.

    Use composer to install the ubuntu fork of valet. I have also used it on Fedora and LinuxMint.

    composer global require cpriego/valet-ubuntu
    composer require cpriego/valet-ubuntu

    Move into the test folder we created earlier. In my case this is

    cd ~/act311/test
    cd ~/act311/first
    Type "ls" and make sure you are in the test database. You should see folders including app and public.

    Now we will wrap up and get vlalet linked to our project.
    Now we will wrap up and get vlalet linked to our project. These commands may take a while to run. I got some error messages, but things still worked for me.

    valet install
    valet park
    valet link
    Now you should be able to open your browser. Go to http://test.dev/ Your Laravel web page should show up.
    Now you should be able to open your browser. Go to http://first.dev/ Your Laravel web page should show up. With valet there is no need to run the php server from artisan.
  7. @jevannoynaert jevannoynaert revised this gist Jan 14, 2017. 1 changed file with 5 additions and 7 deletions.
    12 changes: 5 additions & 7 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -48,21 +48,19 @@ These installs should be straightforward. They should work regardless of what s
    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

    sudo apt install php-common
    sudo apt install curl
    sudo apt install json
    sudo apt install readline
    sudo apt install php-curl
    sudo apt install php-json
    sudo apt install php-readline
    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-xml
    sudo apt install php-json
    sudo apt install php-mcrypt
    sudo apt install php-mcryptsudo
    sudo apt install php-zip
    sudo apt install php-mbstring
    sudo apt install php-xml
    sudo apt install php-gd
    If you want to do it all in one shot, copy and paste the following

    sudo apt install php-common curl json readline php-fpm php-cli php-xml php-json php-mcrypt php-zip php-mbstring php-xml php-gd
    sudo apt install php-common php-curl php-json php-readline php-fpm php-cli php-xml php-mcrypt php-zip php-mbstring php-gd

    You can run the following command to clean up any unneeded packages.

  8. @jevannoynaert jevannoynaert revised this gist Jan 12, 2017. 1 changed file with 35 additions and 5 deletions.
    40 changes: 35 additions & 5 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    Note: This document is not finished.

    ##### Written for Laravel 2.3 and PHP 7
    This is written for Ubuntu, LinuxMint, and oter debian derivatives that use apt or apt-get. I have tested it on Ubuntu 16.04 LTS.
    This is written for Ubuntu, LinuxMint, and oter debian derivatives that use apt or apt-get. I have tested it on Ubuntu 16.04 LTS. Also, this installation may not be the minimum. In particular, some of the php files May not be absolutely necessary, especially if you are not running nginx and valet.

    I have this guide on Fedora using "dnf" instead of apt should work in most places. A few of the PHP bundles are a bit differentently, but It still worked. The Fedora packages seem to be more inclusive, so all of the important PHP components seemed to be loaded.

    @@ -47,13 +47,26 @@ These installs should be straightforward. They should work regardless of what s

    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt
    sudo apt install php-zip
    sudo apt install php-common
    sudo apt install curl
    sudo apt install json
    sudo apt install readline
    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-xml
    sudo apt install php-json
    sudo apt install php-mcrypt
    sudo apt install php-zip
    sudo apt install php-mbstring
    sudo apt install php-xml
    sudo apt install php-gd
    If you want to do it all in one shot, copy and paste the following

    sudo apt install php-common curl json readline php-fpm php-cli php-xml php-json php-mcrypt php-zip php-mbstring php-xml php-gd

    You can run the following command to clean up any unneeded packages.

    sudo apt autoremove

    ### Step 2 Change PHP configuration

    @@ -128,3 +141,20 @@ Some of these packages may already be installed.
    sudo apt install libnss3-tools
    sudo apt install jq
    sudo apt install xsel
    sudo apt install nginx

    Use composer to install the ubuntu fork of valet. I have also used it on Fedora and LinuxMint.

    composer global require cpriego/valet-ubuntu

    Move into the test folder we created earlier. In my case this is

    cd ~/act311/test
    Type "ls" and make sure you are in the test database. You should see folders including app and public.

    Now we will wrap up and get vlalet linked to our project.

    valet install
    valet park
    valet link
    Now you should be able to open your browser. Go to http://test.dev/ Your Laravel web page should show up.
  9. @jevannoynaert jevannoynaert revised this gist Jan 12, 2017. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ problem once you are comfortable with the environment.
    3. Install Composer
    4. Install Laravel
    5. Test Laravel and Artisan
    7. Optionally:
    6. Optionally:
    * Install NGINX server
    * Install Valet

    @@ -53,6 +53,7 @@ This step could have been done as part of the above. However, these installs ma
    sudo apt install php-zip
    sudo apt install php-mbstring
    sudo apt install php-xml
    sudo apt install php-gd

    ### Step 2 Change PHP configuration

    @@ -120,3 +121,10 @@ You should just be able to type "laravel" and see a help menu.
    ls
    You should see a list of directories and files. On of the files should be called "artisan."

    ## Step 6 Install nginx andn valet
    This step is optional. In theory you should be able to view your web page with the built-in php server.

    Some of these packages may already be installed.
    sudo apt install libnss3-tools
    sudo apt install jq
    sudo apt install xsel
  10. @jevannoynaert jevannoynaert revised this gist Jan 11, 2017. 1 changed file with 73 additions and 6 deletions.
    79 changes: 73 additions & 6 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -21,11 +21,10 @@ problem once you are comfortable with the environment.
    ##The general procedure is

    1. Install PHP extensions
    2. Fix PHP configurations in php.ini
    2. Fix PHP configurations
    3. Install Composer
    4. Use Composer to require Laravel
    5. Install Laravel
    6. Test Laravel and Artisan
    4. Install Laravel
    5. Test Laravel and Artisan
    7. Optionally:
    * Install NGINX server
    * Install Valet
    @@ -37,7 +36,7 @@ Both of the following are kind of old. But they are still useful references:

    In the following instructions I install packages one at a time. Some probably find this inefficient. However, I assume people may have problems across time and distributions. In these types of situations I prefer to install one at a time so it is easier to identify exactly which packages fail.

    ## Step 1 install php
    ### Step 1 install php
    Open a command window. Type the following commands. This command also installs the GIT protocol. Git isn't technically necessary, but you should still install it so it is available.

    These installs should be straightforward. They should work regardless of what system you are using.
    @@ -46,10 +45,78 @@ These installs should be straightforward. They should work regardless of what s
    sudo apt install php
    sudo apt install git

    ## Step 2 Install extensions and GIT
    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt
    sudo apt install php-zip
    sudo apt install php-mbstring
    sudo apt install php-xml

    ### Step 2 Change PHP configuration

    Laravel needs mcrypt enabled.
    sudo phpenmod mcrypt

    You may need to enable more, depending largely if you install nginx.

    ### Step 3 Install Composer

    Composer may be installed globally or just for this user. I assume you are going to be running it on your own development machine. It will avoid some hastles if we just install it locally.

    First, change back to your home directory.

    cd ~

    Now fetch the composer installer and run it by pyping it through php.

    curl -sS https://getcomposer.org/installer | php

    After this runs you should have a program in your home directory. It should be named "composer.phar." It is basically the working part of the composer program. you should be able to execute it and get a help screen by typing the following:

    ./composer.phar

    It should give you the same results as just typing

    composer

    This is a semi-tricky step. You will need to edit a text file called .bashrc (The leading dash is important). You may use whatever text editor you wish. The following command uses the "nano" editor. We will be adding the folder ~/.composer/vendor/bin to the search path.

    nano ~/.bashrc

    Go down to the bottom of the file. There might or migh not we a command that starts export PATH. If you find one, add the following statement after the other PATH statements Note that there is a period in front of composer.

    export PATH=~/.composer/vendor/bin:$PATH

    Save the file. Close your terminal window. You can just type "exit" in most cases. Then open it again.

    The .bashrc file executes every time you open a terminal window. By closing it and opening the window we executed .bashrc and added the new directory to the path.

    You can check the path with the following command:

    echo $PATH

    You should see that the path now ends with something like /home/yourID/.composer/vendor/bin

    ### Step 4 Install Laravel

    Type the command. Be sure to include the ~ before 1.1

    composer global require "laravel/installer=~1.1"

    ### Step 5 Test Laravel

    You should just be able to type "laravel" and see a help menu.

    laravel

    Make a directory to host your laravel project. Some people recommend a folder called ~/sites. This is being written for
    the ACT311 course. Therefore I will be using act311 as sthe directory. You may use any legal file name you want. I will also use "test" as the name of our test project.

    mkdir ~/act311
    cd ~/act311
    laravel new test
    ls
    You should see a list of directories and files. On of the files should be called "artisan."

  11. @jevannoynaert jevannoynaert revised this gist Jan 11, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Installing Laravel on Linux
    Note: This document is not finished.

    ##### Written for Laravel 2.3 and PHP 7
    This is written for Ubuntu, LinuxMint, and oter debian derivatives that use apt or apt-get. I have tested it on Ubuntu 16.04 LTS.
    @@ -50,5 +51,5 @@ This step could have been done as part of the above. However, these installs ma

    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt
    sudo apt install php-mcrypt

  12. @jevannoynaert jevannoynaert revised this gist Jan 11, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,7 @@ These installs should be straightforward. They should work regardless of what s
    ## Step 2 Install extensions and GIT
    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt
    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt

  13. @jevannoynaert jevannoynaert revised this gist Jan 11, 2017. 1 changed file with 27 additions and 9 deletions.
    36 changes: 27 additions & 9 deletions Laravel on Linux.md
    Original file line number Diff line number Diff line change
    @@ -19,18 +19,36 @@ problem once you are comfortable with the environment.

    ##The general procedure is

    1. Install PHP
    2. Install PHP extensions
    3. Fix PHP configurations in php.ini
    4. Install Composer
    5. Use Composer to require Laravel
    6. Install Laravel
    7. Test Laravel and Artisan
    8. Optionally:
    1. Install PHP extensions
    2. Fix PHP configurations in php.ini
    3. Install Composer
    4. Use Composer to require Laravel
    5. Install Laravel
    6. Test Laravel and Artisan
    7. Optionally:
    * Install NGINX server
    * Install Valet

    ## Steps
    Both of the following are kind of old. But they are still useful references:
    * [https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04](https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04)
    * [http://tecadmin.net/install-laravel-framework-on-ubuntu/](http://tecadmin.net/install-laravel-framework-on-ubuntu/)
    * [http://tecadmin.net/install-laravel-framework-on-ubuntu/](http://tecadmin.net/install-laravel-framework-on-ubuntu/)

    In the following instructions I install packages one at a time. Some probably find this inefficient. However, I assume people may have problems across time and distributions. In these types of situations I prefer to install one at a time so it is easier to identify exactly which packages fail.

    ## Step 1 install php
    Open a command window. Type the following commands. This command also installs the GIT protocol. Git isn't technically necessary, but you should still install it so it is available.

    These installs should be straightforward. They should work regardless of what system you are using.

    sudo apt update
    sudo apt install php
    sudo apt install git

    ## Step 2 Install extensions and GIT
    This step could have been done as part of the above. However, these installs may be more problematic over time. If these commands don't work for you, it may be necessary to research your specific system.

    sudo apt install php-fpm
    sudo apt install php-cli
    sudo apt install php-mcrypt

  14. @jevannoynaert jevannoynaert renamed this gist Jan 11, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  15. @jevannoynaert jevannoynaert created this gist Jan 11, 2017.
    36 changes: 36 additions & 0 deletions Laravel on Linux
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    # Installing Laravel on Linux

    ##### Written for Laravel 2.3 and PHP 7
    This is written for Ubuntu, LinuxMint, and oter debian derivatives that use apt or apt-get. I have tested it on Ubuntu 16.04 LTS.

    I have this guide on Fedora using "dnf" instead of apt should work in most places. A few of the PHP bundles are a bit differentently, but It still worked. The Fedora packages seem to be more inclusive, so all of the important PHP components seemed to be loaded.

    ## Homestead
    Homestead is a useful tool. but it can be overwhelming at first if you are trying to learn both Laravel and Homestead.
    It is much easier and quicker to whip up little learning projects without Homestead. In my experience Homestead makes
    things easier for people using Windows.

    I do recommend Homestead if you are working on dedicated projects.

    ** Valet
    I like Valet. However, it is one more thing that needs to be installed (two, if you count nginx). My advice to students is
    to try to install valet. If that doesn't work at first, then just use the built-in php server. Worry about fixing the
    problem once you are comfortable with the environment.

    ##The general procedure is

    1. Install PHP
    2. Install PHP extensions
    3. Fix PHP configurations in php.ini
    4. Install Composer
    5. Use Composer to require Laravel
    6. Install Laravel
    7. Test Laravel and Artisan
    8. Optionally:
    * Install NGINX server
    * Install Valet

    ## Steps
    Both of the following are kind of old. But they are still useful references:
    * [https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04](https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04)
    * [http://tecadmin.net/install-laravel-framework-on-ubuntu/](http://tecadmin.net/install-laravel-framework-on-ubuntu/)