Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # How to install Laravel in Ubuntu 16.10
- ===================================
- Open your terminal using `Ctrl+Alt+T` and type the following commands
- ##Step 1: Update & Upgrade
- ```bash
- sudo apt-get update
- sudo apt-get upgrade
- ```
- ##Step 2: Install PHP
- ```bash
- sudo apt-get install php7.0-cli php7.0-zip php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0 php7.0-mysql
- ```
- ##Step 3: Install Composer
- ```bash
- sudo apt-get install composer
- ```
- ##Step 4: Install Laravel
- ```bash
- composer global require "laravel/installer=~1.1"
- ```
- ##Step 5: Add composer to path to access laravel globally
- ```bash
- export PATH="~/.config/composer/vendor/bin:$PATH"
- ```
- ##Step 6: Create a new Laravel application
- ```bash
- laravel new testapp
- ```
- ##Step 7: Install missing packages and their dependencies
- ```bash
- cd testapp
- composer install
- ```
- ##Step 8: Generate APP_KEY for testapp
- ```bash
- php artisan key:generate
- ```
- ##Step 9: Test the application
- ```bash
- php -S localhost:8888 -t public
- ```
- Open a web browser and visit `localhost:8888` to see the laravel welcome page
- ##Step 10: Configuring Database
- Terminate php server in terminal by pressing `Ctrl+C`
- Download mysql-server by typing the following command in the terminal
- ```bash
- sudo apt-get install mysql-server
- ```
- Once done, login to mysql shell
- ```bash
- mysql -u root -p
- ```
- _Enter your root password_
- Create a new user
- ```bash
- CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'laravel';
- GRANT ALL PRIVILEGES ON * . * TO 'laravel'@'localhost';
- ```
- Thus you have successfully create a new user 'laravel' with the password 'laravel' and full privileges.
- Now, logout from mysql shell by typing `\q` and login again from laravel user
- ```bash
- mysql -u laravel -p
- ```
- _Enter password as laravel_
- Create a new database 'testapp'
- ```bash
- create database testapp;
- ```
- Logout from mysql shell by typing `\q`
- ##Step 11: Connect 'testapp' to 'mysql' database
- Open your .env file in 'testapp' directory
- ```bash
- nano .env
- ```
- Inside .env file, set
- ```bash
- DB_DATABASE=testapp
- DB_USERNAME=laravel
- DB_PASSWORD=laravel
- ```
- Save the file by pressing `Ctrl+O` followed by `Enter`. Exit nano editor by pressing `Ctrl+X'
- Run migrations to create tables in mysql database
- ```bash
- php artisan migrate
- ```
- Thus you have successfully installed laravel and configured it to use mysql.
Add Comment
Please, Sign In to add comment