Installing laravel on ubuntu step by step
Follow the following steps exactly to installing laravel on ubuntu operating system
Basic Need :
- apache server installed
- php 5.8 and above
- internet connection
- Root permission for terminal
// notice: in these steps i had use “brijesh” an an example for project name you can user your own porject name by replacing it with yours.
Step1: First install composer
user this link if needed more information // refference: https://getcomposer.org/download/
use these command for installing composer
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" sudo php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" sudo php composer-setup.php sudo mv composer.phar /usr/local/bin/composer sudo chmod +x /usr/local/bin/composer // to un install composer php -r "unlink('composer-setup.php');"
Step 2: Change root directory path (if your server folder is “html” then goto html folder
cd /var/www/html
Step 3: Install Laraven with your project name ex.: brijesh
composer<em> create-project laravel/laravel your-project-name</em>
ex.: composer create-project laravel/laravel brijesh
step 4: Give permission to brijesh , App, Storage , Piublic
sudo chmod -R 755 /var/www/html/brijesh sudo chmod -R 777 /var/www/html/brijesh/app sudo chmod -R 777 /var/www/html/brijesh/storage sudo chmod -R 777 /var/www/html/brijesh/public
Step 5: create virtual host
// copy and past default host file by below comand to your { PROJECT NAME }<em></em> sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/brijesh.conf // edit your .conf file sudo vim /etc/apache2/sites-available/brijesh.conf
// Add this code { replace brijesh with your project name } save and exit
<VirtualHost *:> ServerAdmin admin@brijesh ServerName brijesh.com ServerAlias www.brijesh.com DocumentRoot /var/www/html/brijesh/public/index.php ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory /var/www/html/brijesh> AllowOverride All </Directory> </VirtualHost>
// then press Esc and then write :wq and enter button end
Step 6: enable your vitural host
sudo a2ensite brijesh.conf sudo service apache2 restart
// OPTIONAL STEP Step 7: change host url
</pre> // open host sudo vim /etc/hosts // there look like 127.0.0.1 localhost // add your host name like 127.0.0.1 brijesh.com www.brijesh.com //save, exit and restart apache sudo service apache2 restart
Type in url “www.brijesh.com” or “localhost/brijesh/public/index.php”
if below screen appears brijesh.com
yo yo laravel starts woooo……….
notice : replace brijesh with you project name.
while installing laravel on ubuntu operating system if there is any problem please comment we will reply as soon as possible thanks.