Quantcast
Channel: Websetnet
Viewing all articles
Browse latest Browse all 4268

Install Laravel on CentOS 7

$
0
0

laravelLaravel is a free, open-source PHP web application framework with expressive, elegant syntax. It is intended for the development of web applications following the model–view–controller (MVC) architectural pattern.

Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance etc…

 

In this article we will install Laravel on a Centos 7 VPS.

REQUIREMENTS

We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.

Log in to your server via SSH:

# ssh root@server_ip

UPDATE THE SYSTEM

Make sure your server is fully up to date:

# yum update

Before proceeding, let’s install Apache, MariaDB and PHP 5.6 along with it’s needed dependencies. First, install Remi and Webtatic repositories with the below commands:

# yum install epel-release

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

You can now install LAMP (Linux Apache, MariaDB & PHP):

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

Start MariaDB and Apache, then enable them to start on boot:

# systemctl start mariadb

# systemctl start httpd

# systemctl enable mariadb

# systemctl enable httpd

Next, install Composer which is the tool for dependency management in PHP.

# curl-k -sS https://getcomposer.org/installer | php

Once Composer is installed, you need to move it so that Composer can be available within your machine path. To check your available path locations type the following:

# echo $PATH

The output will provide you with the path locations. Put composer in the /usr/local/bin/ directory:

# mv composer.phar /usr/local/bin/composer

Navigate into a directory where you will download Laravel. We are using /opt :

# cd /opt

Download Laravel and unzip the archive:

# wget https://github.com/laravel/laravel/archive/v4.2.11.zip

# unzip v4.2.11.zip

Then create a directory for your website and move the Laravel installation there:

# mkdir /var/www/html/your_site

# mv laravel-4.2.11/ /var/www/html/your_site

# cd /var/www/html/your_site

Move the files/directories from the laravel-4.2.11 unpacked archive into your website directory and then delete laravel-4.2.11:

# mv laravel-4.2.11/* .

# mv laravel-4.2.11/.* .

# rmdir laravel-4.2.11/

Issue the below command to download and install all dependencies. This can take some time, so feel free to make yourself a cup of tea:

# composer install

Once the installation is completed, set the ownership of your website files/directories to apache:

# chown apache: -R /var/www/html/your_site/

Now, create a virtual host directive for your website. Open a file called let’s say your_site.conf with your favorite text editor. We are using nano:

# nano /etc/httpd/conf.d/your_site.conf

Paste the following:

<VirtualHost *:80>
    DocumentRoot /var/www/html/your_site/public
    ServerName your_domain

    <Directory /var/www/html/your_site/>
        AllowOverride All
    </Directory>
</VirtualHost>

Don’t forget to replace your_domain with your actual domain.

Restart Apache so the changes can take effect:

# systemctl restart httpd

With that out of the way, open your web browser and navigate to http://your_domain to access the Laravel website.

Congratulations, you have successfully installed Laravel on your CentOS 7 VPS.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Viewing all articles
Browse latest Browse all 4268

Trending Articles