How to install the PHP framework Laravel on CentOS7/Ubuntu15.04

Source: Internet
Author: User
Tags mcrypt composer install how to install laravel fully qualified domain name
Hello everyone, how to install the PHP framework Laravel on CentOS7Ubuntu15.04. This article will describe how to install Laravel on CentOS 7/Ubuntu 15.04. If you are a PHP Web developer, you do not need to consider how to choose from a wide array of modern PHP frameworks. Laravel is the easiest to start and run, saving time and effort, you can enjoy web development. Laravel believes in a universal development philosophy. using simple guidance to create maintainable code is the highest priority, and you will maintain high development efficiency, you can change your code at any time to improve existing functions.

Laravel installation is not cumbersome. you only need to follow this article to install it on CentOS 7 or Ubuntu 15 servers step by step.

1) server requirements

Before installing Laravel, you need to install some of its dependencies, including basic parameter adjustments, such as upgrading the system to the latest version, sudo permission, and installing dependency packages.

When you connect to your server, make sure that you can use the following command to successfully use the EPEL repository and upgrade your server.

CentOS-7
# yum install epel-release# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm# yum update
Ubuntu
# apt-get install python-software-properties# add-apt-repository ppa:ondrej/php5# apt-get update# apt-get install -y php5 mcrypt php5-mcrypt php5-gd
2) firewall installation

System Firewall and SELinux settings are very important for product application security. when you use the test server, you can disable the firewall and use the following command line to set SELinux to permissive) to ensure that the installation programs are not affected by them.

# setenforce 0
3) install Apache, MariaDB, and PHP

The Laravel installer needs to complete LAMP installation throughout the environment, and additional PHP extensions such as OpenSSL, PDO, Mbstring, and Tokenizer need to be installed. If LAMP is already running on your server, skip this step and check whether necessary PHP plug-ins are installed.

To install the complete AMP, run the following command on your server.

CentOS
# yum install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring

To enable automatic startup of MySQL/Mariadb service on CentOS 7, run the following command.

# systemctl start httpd# systemctl enable httpd#systemctl start mysqld#systemctl enable mysqld

After starting the MariaDB service, you need to run the following command to configure a secure password.

#mysql_secure_installation
Ubuntu
# apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql
4) install Composer

Before installing Laravel, let's start installing composer. Installing composer is one of the most important steps to install Laravel, because composer can help us install various Laravel dependencies.

CentOS/Ubuntu

Run the following command in CentOS/Ubuntu to configure composer.

# curl -sS https://getcomposer.org/installer | php# mv composer.phar /usr/local/bin/composer# chmod +x /usr/local/bin/composer

5) install Laravel

Run the following command to download the Laravel installation package from github.

# wget https://github.com/laravel/laravel/archive/develop.zip

Run the following command to decompress the installation package and move the root directory of the document.

# unzip develop.zip# mv laravel-develop /var/www/

Use the compose command to install all the dependencies required by Laravel in the directory.

# cd /var/www/laravel-develop/# composer install

6) key

To encrypt the server, we use the following command to generate an encrypted 32-bit key.

# php artisan key:generateApplication key [Lf54qK56s3qDh0ywgf9JdRxO2N0oV9qI] set successfully

Now put this key in the 'app. php' file, as shown below.

# vim /var/www/laravel-develop/config/app.php

7) virtual host and user

After the composer is installed, assign the permissions and users of the document root directory, as shown below.

# chmod 775 /var/www/laravel-develop/app/storage# chown -R apache:apache /var/www/laravel-develop

Use any editor to open the default configuration file of the apache server, and add the virtual host configuration at the end of the file.

# vim /etc/httpd/conf/httpd.conf
ServerName laravel-developDocumentRoot /var/www/laravel/publicstart Directory /var/www/laravelAllowOverride AllDirectory close

Run the following command to restart the apache server and open the localhost page in the browser.

CentOS
# systemctl restart httpd
Ubuntu
# service apache2 restart
8) Laravel 5 network access

Open your browser and enter the configured IP address or full domain name (Fully qualified domain name). you will see the default page of Laravel 5.

Summary

The Laravel framework is an excellent tool for developing web applications. So, after reading this article, you will learn to install Laravel on Ubuntu 15 and CentOS 7, then you can use the various functions and comfort of this superb PHP framework for your development work.

If you have any comments or suggestions, please reply in the following comments area. we will make our articles easier to understand based on your valuable feedback.

Via: http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/

Author: kasconditioned translator: NearTan proofreader: Caroline

This article was originally compiled by LCTT and launched with the honor of Linux in China

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.