Como instalar o Laravel no Ubuntu 16.04

Como instalar o Laravel no Ubuntu 16.04

Alguém instalou o laravel 5 no Ubuntu 16.04? Acabei de mudar para o Ubuntu 16.04 e estou tentando instalar o framework laravel 5 nele usando o compositor. Mas toda vez que tento criar um projeto isso me dá esses erros

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/laravel v5.2.0 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.15 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.23 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.24 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.27 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.29 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.31 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/framework v5.2.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.31 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.30 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.29 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.26 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.25 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.24 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.23 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.22 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.21 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.20 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.19 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.18 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.16 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for laravel/laravel ^5.2 -> satisfiable by laravel/laravel[v5.2.0, v5.2.15, v5.2.23, v5.2.24, v5.2.27, v5.2.29, v5.2.31].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/5.6/cli/php.ini
    - /etc/php/5.6/cli/conf.d/10-opcache.ini
    - /etc/php/5.6/cli/conf.d/10-pdo.ini
    - /etc/php/5.6/cli/conf.d/20-calendar.ini
    - /etc/php/5.6/cli/conf.d/20-ctype.ini
    - /etc/php/5.6/cli/conf.d/20-exif.ini
    - /etc/php/5.6/cli/conf.d/20-fileinfo.ini
    - /etc/php/5.6/cli/conf.d/20-ftp.ini
    - /etc/php/5.6/cli/conf.d/20-gettext.ini
    - /etc/php/5.6/cli/conf.d/20-iconv.ini
    - /etc/php/5.6/cli/conf.d/20-json.ini
    - /etc/php/5.6/cli/conf.d/20-phar.ini
    - /etc/php/5.6/cli/conf.d/20-posix.ini
    - /etc/php/5.6/cli/conf.d/20-readline.ini
    - /etc/php/5.6/cli/conf.d/20-shmop.ini
    - /etc/php/5.6/cli/conf.d/20-sockets.ini
    - /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
    - /etc/php/5.6/cli/conf.d/20-sysvsem.ini
    - /etc/php/5.6/cli/conf.d/20-sysvshm.ini
    - /etc/php/5.6/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

eu leio artigosAqui um delesdigamos que o Ubuntu 16.04 vem com PHP7 como padrão, mas ainda podemos usar PHP5. No entanto, tentei PHP7 e PHP5 e ainda obtive os mesmos erros! Alguma ideia? Obrigado

Responder1

Como instalar o Laravel no Ubuntu 16.04

Atualização: Laravel 5.4

Devido ao grande interesse por esta questão decidi atualizá-la e criar um pequeno script bash para instalar tudo que você precisa para trabalhar com o Laravel (este é com o NGINX)

https://github.com/emilas44/laravel-5.4-on-Ubuntu/blob/master/script.sh

Você pode simplesmente copiá-lo e editá-lo como quiser...talvez você já tenha alguns componentes instalados que estão dentro do script, nesse caso você pode deletar livremente as partes que não precisa.


Laravel 5.2 está abaixo:

instalação de coisas básicas (opcional)

sudo apt-get install git
sudo apt-get install zip

LÂMPADA

sudo apt-get install tasksel
sudo tasksel install lamp-server

ONDULAÇÃO

sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext

ativar mods

sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo a2enmod rewrite
sudo systemctl restart apache2

Compositor

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

instalar o phpmyadmin

sudo apt-get install phpmyadmin     

posteriormente acessível através de localhost/phpmyadmin

Criando Projeto Laravel

cd /var/www/html/
sudo composer create-project laravel/laravel work --prefer-dist
sudo chmod -R 777 work (do not set 777 on "live" server!)

Criando Host Virtual work.com

sudo gedit /etc/apache2/sites-available/work.com.conf

e cole isso dentro desse documento


#/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>

ativar esse site

sudo a2ensite work.com
service apache2 reload

corrija o arquivo hosts para que você possa acessá-lo através do navegador da web

sudo gedit /etc/hosts //space between gedit and destination!

        #/etc/hosts contents following lines                                
        127.0.0.1       work.com

ou use este comando

sudo -- sh -c "echo '\n127.0.0.1 \twork.com'>> /etc/hosts"

É isso que o laravel está instalado!

Fiz um tutorial no youtube de como acertar....Com todas as coisas que você precisa para trabalhar com laravel. Aqui está o link: https://www.youtube.com/watch?v=A6TdaRIsG6g

Responder2

Eu atualizei o php 5.6.11 para 5.6.21.

Então, no meu caso eu tive que executar:

sudo apt-get install php5.6-mbstring

PS: Como atualizei de 5.6.11 para 5.6.21 a seguir:

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php 
sudo apt-get update 
sudo apt-get install php5.6

Motivo da atualização:zend_mm_heap corrompidodurante a atualização do compositor.

Responder3

Estas são as etapas que tive que seguir para instalar o Laravel 5 no Ubuntu Server 16.04 após uma nova atualização

Primeiro tive que remover completamente todo o PHP, como afirmou Mohammad Barhoush:

  • sudo apt-get -y purge php.*

Então reinstalei o PHP com:

  • sudo apt install php libapache2-mod-php
  • sudo apt install php-cli
  • sudo apt install php-mysql

Depois de reinstalar o PHP versão 7.0, instalei os pacotes adicionais relacionados que Mohhammad recomendou:

  • sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext php-gd

E habilitei os mods

  • sudo phpenmod mcrypt

  • sudo phpenmod mbstring

    E finalmente depois de tudo esse compositor ainda estava sendo chato reclamando que não tinha a extensão zip para a, composer updateentão instalei o seguinte:

  • sudo apt-get install php7.0-zip

Depois disso, funcionou perfeitamente, sem erros!

Estas foram as etapas necessárias para que o laravel 5 funcionasse vindo da versão LTS anterior do Ubuntu Server. Espero que isso tenha ajudado! Atenciosamente :)

-Derick

Responder4

A solução do oerdnj funciona, após a instalação mbstringvocê deve habilitá-la php.iniantes de executar composer install. No meu caso, o laravel requer ext-mbstring e ext-dom:
apt-get install php-dom

informação relacionada