Guest User

Untitled

a guest
Dec 27th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. # How to install Laravel in Ubuntu 16.10
  2. ===================================
  3.  
  4. Open your terminal using `Ctrl+Alt+T` and type the following commands
  5.  
  6. ##Step 1: Update & Upgrade
  7. ```bash
  8. sudo apt-get update
  9. sudo apt-get upgrade
  10. ```
  11.  
  12. ##Step 2: Install PHP
  13. ```bash
  14. sudo apt-get install php7.0-cli php7.0-zip php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0 php7.0-mysql
  15. ```
  16.  
  17. ##Step 3: Install Composer
  18. ```bash
  19. sudo apt-get install composer
  20. ```
  21.  
  22. ##Step 4: Install Laravel
  23. ```bash
  24. composer global require "laravel/installer=~1.1"
  25. ```
  26.  
  27. ##Step 5: Add composer to path to access laravel globally
  28. ```bash
  29. export PATH="~/.config/composer/vendor/bin:$PATH"
  30. ```
  31.  
  32. ##Step 6: Create a new Laravel application
  33. ```bash
  34. laravel new testapp
  35. ```
  36.  
  37. ##Step 7: Install missing packages and their dependencies
  38. ```bash
  39. cd testapp
  40. composer install
  41. ```
  42.  
  43. ##Step 8: Generate APP_KEY for testapp
  44. ```bash
  45. php artisan key:generate
  46. ```
  47.  
  48. ##Step 9: Test the application
  49. ```bash
  50. php -S localhost:8888 -t public
  51. ```
  52. Open a web browser and visit `localhost:8888` to see the laravel welcome page
  53.  
  54. ##Step 10: Configuring Database
  55. Terminate php server in terminal by pressing `Ctrl+C`
  56.  
  57. Download mysql-server by typing the following command in the terminal
  58. ```bash
  59. sudo apt-get install mysql-server
  60. ```
  61.  
  62. Once done, login to mysql shell
  63. ```bash
  64. mysql -u root -p
  65. ```
  66. _Enter your root password_
  67.  
  68. Create a new user
  69. ```bash
  70. CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'laravel';
  71. GRANT ALL PRIVILEGES ON * . * TO 'laravel'@'localhost';
  72. ```
  73.  
  74. Thus you have successfully create a new user 'laravel' with the password 'laravel' and full privileges.
  75.  
  76.  
  77. Now, logout from mysql shell by typing `\q` and login again from laravel user
  78. ```bash
  79. mysql -u laravel -p
  80. ```
  81. _Enter password as laravel_
  82.  
  83.  
  84. Create a new database 'testapp'
  85. ```bash
  86. create database testapp;
  87. ```
  88. Logout from mysql shell by typing `\q`
  89.  
  90.  
  91.  
  92. ##Step 11: Connect 'testapp' to 'mysql' database
  93. Open your .env file in 'testapp' directory
  94. ```bash
  95. nano .env
  96. ```
  97. Inside .env file, set
  98. ```bash
  99. DB_DATABASE=testapp
  100. DB_USERNAME=laravel
  101. DB_PASSWORD=laravel
  102. ```
  103. Save the file by pressing `Ctrl+O` followed by `Enter`. Exit nano editor by pressing `Ctrl+X'
  104.  
  105.  
  106. Run migrations to create tables in mysql database
  107. ```bash
  108. php artisan migrate
  109. ```
  110.  
  111. Thus you have successfully installed laravel and configured it to use mysql.
Add Comment
Please, Sign In to add comment