// basic stuff install
sudo apt-get install git
sudo apt-get install unzip
// LAMP
sudo apt-get install tasksel
sudo tasksel install lamp-server
// CURL + Composer
sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext
// enable mods
sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo a2enmod rewrite
sudo systemctl restart apache2
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
//install phpmyadmin
sudo apt-get install phpmyadmin
# later accessible through localhost/phpmyadmin
open file apache2.conf
Include etc/phpmyadmin/apache.conf
//Creating Laravel Project
cd /var/www/html/
sudo composer create-project laravel/laravel work --prefer-dist
sudo chmod -R 777 work
//Creating Virtual Host work.com
sudo leafpad /etc/apache2/sites-available/work.com.conf
#/etc/apache2/sites-available/work.com.conf contains following lines
<VirtualHost *:80>
ServerName work.com
DocumentRoot /var/www/html/work/public
<Directory /var/www/html/work/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
// enable that site
sudo a2ensite work.com
service apache2 reload
// fix hosts file
sudo leafpad /etc/hosts
#/etc/hosts contents following lines
127.0.0.1 work.com
or use this command
sudo -- sh -c "echo '\n127.0.0.1 \twork.com'>> /etc/hosts"
// make permanent aliases:
echo "alias cls='clear'" >> ~/.bash_aliases && source ~/.bash_aliases
echo "alias sudo='sudo '" >> ~/.bash_aliases && source ~/.bash_aliases
echo "alias fm='pcmanfm'" >> ~/.bash_aliases && source ~/.bash_aliases
That's it laravel is installed!
##########################################################################################################
NOW CONFIGURE WORKING ENVIRONMENT
// fix for adding repositories so you can download software from other sources
sudo apt-get install software-properties-common
// install sublime-text 3
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
// install sublime packages
Ctrl + ` or View/Show Console
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
restart sublime-text
then go to Preferences/Package Control and install
#Laravel Blade Highlighter
#Sidebar-Enhancements
#LaravelCollective HTML Form Snippets
"CodeComplice",
"Laravel Helper Completions",
"Terminal"
// this is for removing and uninstalling sublime text
sudo apt-get purge sublime-text-installer
sudo rm -r /opt/sublime_text
sudo rm -r /usr/bin/subl
sudo rm -r /usr/share/applications/sublime.desktop
sudo rm -r /home/laravel/Desktop/sublime-text.desktop
sudo rm -r /home/laravel/.config/sublime-text-3
// how to create snippets for html or any code
got to Tools/New Snippet
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$1</title>
</head>
<body>
$2
</body>
</html>
]]></content>
<tabTrigger>html</tabTrigger>
</snippet>
paste that ^ and save as *.sublime-snippet inside sublime/packages/user folder
// change default server directory *OPTIONAL!
sudo leafpad /etc/apache2/sites-available/000-default.conf
and change the following line to what you want:
DocumentRoot /var/www/html
Also do a
sudo leafpad /etc/apache2/apache2.conf
and find this
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change /var/www/ to your preferred directory //mine is /var/www/html/work/public
and save it.
After you saved your changes, just restart the apache2 webserver and you'll be done :)
sudo service apache2 restart
// make laravel app to be the landing (localhost) site instead of apache2 /*optional
sudo a2dissite 000-default
// this is to enable it
sudo a2ensite 000-default
########################################################################################################
CONFIGURE SOME EXTRA STUFF TO MAKE CODING EASIER
//install form and html and input classes
../laravel_folder/composer.json
-----------------------------------------------------
"require": {
"laravelcollective/html": "5.2.*"
}
-----------------------------------------------------
../laravel_folder/config/app.php
-----------------------------------------------------
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
------------------------------------------------------
in terminal go to laravel_app_folder and run
sudo composer update
That's it everything set for working with Laravel 5.2
################################################################
// install generators for migrations
sudo composer require laracasts/generators --dev
inside app/Providers/AppServiceProvider.php change public function register
public function register()
{
if ($this->app->environment() == 'local') {
$this->app->register('Laracasts\Generators\GeneratorsServiceProvider');
}
}
now you can do this
sudo php artisan make:migration:schema create_roles_table --schema="name:string"
sudo php artisan make:migration:schema remove_user_id_from_posts_table --schema="user_id:integer"
sudo php artisan make:migration:pivot tags posts
phpMyAdmin
https://help.ubuntu.com/lts/serverguide/phpmyadmin.htmlsudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl reload apache2.service
No comments:
Post a Comment