How To Install Nette PHP Framework on CentOS 7

Install Nette PHP Framework on CentOS 7

In this tutorial, we will show you how to install and configure of Nette PHP Framework on your CentOS 7.  For those of you who didn’t know, Nette Framework is a popular tool for PHP web development It is designed to be as usable and as friendly as possible. It focuses on security and performance and is definitely one of the safest PHP frameworks. Nette Framework speaks your language and helps you to easily build better websites.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step-by-step installation of Nette PHP Framework in CentOS 7.

Install Nette PHP Framework on CentOS 7

Step 1. First, we need to add EPEL repository to our system.

yum install epel-release
yum -y update

Step 2. Install LAMP server.

A CentOS 7 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

Step 3. Install Composer.

Download and install Composer by executing the following command:

curl -sS | php

Sample result:

[[email protected] ~]# curl -sS | php
#!/usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended.
Composer works with 5.3.2+ for most people, but there might be edge case issues.


Composer successfully installed to: /root/composer.phar
Use it: php composer.phar

Once the process completes, you can make the ‘composer.phar’ file executable by running the following command:

chmod +x composer.phar

Now use the following commands to make composer available globally for all users in your system, which can be used for all PHP applications on that system:

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

Use the following command to update it to the latest version for the composer:

composer self-update

You can also check the version of the composer by running the below command:

composer -V

Step 4. Create Nette Application.

Let’s navigate to web document root and use composer to create a new Nette application using the following commands:

cd /var/www/html
composer create-project nette/sandbox myapp

We will need to change some folders permissions:

chown -R apache.apache myapp
chmod -R 755 myapp
chmod -R 777 myapp/tmp myapp/log

Step 5. Access Nette Application.

At this stage, you have successfully configured the Nette framework on your localhost system. Open your favorite browser and navigate to  http://localhost/myapp/www/ and complete the required steps to finish the installation.

Install Nette PHP Framework on CentOS 7

Step 5. Configuring Apache web server for Nette.

We will create an Apache virtual host for your Craft CMS website. First, create ‘/etc/httpd/conf.d/vhosts.conf’ file with using a text editor of your choice:

nano /etc/httpd/conf.d/vhosts.conf

IncludeOptional vhosts.d/*.conf

Next, create the virtual host:

mkdir /etc/httpd/vhosts.d/
nano /etc/httpd/vhosts.d/

Add the following lines:

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html/nette/www"
ErrorLog "/var/log/httpd/"
CustomLog "/var/log/httpd/" combined

<Directory "/var/www/html/nette/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted

Save and close the file. Restart the apache service for the changes to take effects:

systemctl restart httpd.service

Congratulations! You have successfully installed Nette PHP Framework. Thanks for using this tutorial for installing the Nette PHP Framework on your CentOS 7 system. For additional help or useful information, we recommend you check the official Nette PHP Framework website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!