Speed-up-VestaCP-on-CentOS-7

Speed up VestaCP on CentOS 7

Spread the love

We’ll show you, how to speed up VestaCP on CentOS 7. Vesta Control Panel is a simple and easy to use open source hosting control panel. It has a simple and clean interface and lots of useful features that will help you to host your websites on your VPS. Vesta Control Panel currently can be installed on RHEL 5, RHEL 6, CentOS 5, CentOS 6, CentOS 7, Debian 7, Debian 8, Ubuntu 12.04, Ubuntu 12.10, Ubuntu 13.04, Ubuntu 13.10, Ubuntu 14.04 and Ubuntu 16.04 operating systems. Today we are going to learn how to speed up VestaCP on a CentOS 7 VPS.

1. Upgrade PHP

First make sure the system is up to date:

# yum update

Now let’s enable the remi-php70 repository so we can upgrade VestaCP to PHP 7:

# yum-config-manager --enable remi-php70

Update the system again, this command should upgrade all PHP packages to PHP 7:

# yum update

And then restart the php-fpm service:

# systemctl restart php-fpm

2. Install Opcache

Installing Opcache is pretty easy, just run the following command:

# yum install php-opcache

Restart the php-fpm service again:

# systemctl restart php-fpm

Restart Nginx as well:

# systemctl restart nginx

Now you should check if Opcache is enabled by running the following command:

php -i | grep opcache.enable

If Opcache is enabled you should see something like the following output:

opcache.enable => On => On

3. Upgrade MariaDB

First make a backup from all of your databases.

Instead of the conventional mysqldump utility you can use the VestaCP CLI to generate a backup for all of the users on your system, if you want to do that just run:

# v-backup-users

In case you need to restore the backup, first obtain the backup file name by typing in:

# v-list-user-backups <username>

And then by executing the following command you can restore all databases for a specific user:

# v-restore-user <username> <backup_name> no no no <username> no no no

Note: Replace <username> for the username you want to restore the databases for and <backup_name> for the name of the backup obtained by the v-list-user-backups command.

Now, let’s get to upgrading MariaDB finally, start by removing the old MariaDB version:

# yum remove mariadb mariadb-server

Add the repository for MariaDB 10 by creating the repo file with nano and then paste the text below:

# nano /etc/yum.repos.d/MariaDB.repo

# Used to install MariaDB 10 instead of default 5.5
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = https://yum.mariadb.org/10.2/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Now update the system again:

# yum update

And then install MariaDB 10:

# yum install mariadb mariadb-server

After the installation has finished, start MariaDB by running the following command:

# systemctl start mariadb

Then enable the MariaDB service on boot:

# systemctl enable mariadb.service

4. Install Redis

Redis is an in-memory data structure store primarily used as a database and cache.
You can get a huge speed benefit from configuring Redis to cache your pages or to cache your database rows.

You can install Redis by typing in the following command:

# yum install redis

After the yum package manager has finished installing Redis, type in the following command to start Redis:

# systemctl start redis

Now enable the Redis service to start on boot:

# systemctl enable redis.service

5. Configuring WordPress

If you use WordPress for your sites then it would be quite beneficial to install Redis as a caching system for WordPress.
We are going to need the Phpredis extension in order to configure WordPress to use Redis, first install this package:

# yum install php-devel

Then install the Phpredis extension using this command:

# pecl install redis

Press enter when the following message comes up:

enable igbinary serializer support? [no]

After PECL has finished installing Phpredis, open the php.ini file and add the following line at the bottom:

# nano /etc/php.ini

extension=redis.so

Restart php-fpm in order to make the changes effective:

# systemctl restart php-fpm

Now log in to your WordPress backend and install the plugin W3 Total Cache and activate it.In the plugin settings for W3 Total Cache select Redis as page cache and database cache then check the Enable checkbox for both options and click on the Save all settings button.When finished restart Nginx:

# systemctl restart nginx

Then turn on the Redis monitor by typing in the following command:

redis-cli monitor

Now using your browser navigate to your WordPress page, if Redis is working you should see output similar to this:

1510462482.538685 [0 127.0.0.1:48166] "GET" "w3tc_linuxhostsupport.com_0_dbcache_0eacdb46b225fbe864f35d73500d5b5f"
1510462482.539190 [0 127.0.0.1:48166] "SETEX" "w3tc_linuxhostsupport.com_0_dbcache_0eacdb46b225fbe864f35d73500d5b5f" "180" "a:7:{s:10:\"last_error\";s:0:\"\";s:10:\"last_query\";s:205:\"SELECT  wp_comments.comment_ID FROM wp_comments  WHERE ( comment_approved = '1' ) AND comment_post_ID = 1 AND comment_parent IN ( 1 )  ORDER BY wp_comments.comment_date_gmt ASC, wp_comments.comment_ID ASC \";s:11:\"last_result\";a:0:{}s:8:\"col_info\";a:1:{i:0;O:8:\"stdClass\":13:{s:4:\"name\";s:10:\"comment_ID\";s:7:\"orgname\";s:10:\"comment_ID\";s:5:\"table\";s:11:\"wp_comments\";s:8:\"orgtable\";s:11:\"wp_comments\";s:3:\"def\";s:0:\"\";s:2:\"db\";s:14:\"admin_admin_wp\";s:7:\"catalog\";s:3:\"def\";s:10:\"max_length\";i:0;s:6:\"length\";i:20;s:9:\"charsetnr\";i:63;s:5:\"flags\";i:49699;s:4:\"type\";i:8;s:8:\"decimals\";i:0;}}s:8:\"num_rows\";i:0;s:10:\"return_val\";i:0;s:11:\"key_version\";i:1;}"
1510462482.542520 [0 127.0.0.1:48166] "GET" "w3tc_linuxhostsupport.com_0_dbcache_b8bd04fe419b1c9d747a8bccb997d588"
1510462482.543239 [0 127.0.0.1:48166] "GET" "w3tc_linuxhostsupport.com_0_dbcache_a8b6d316b4c822ac63eaf77731ed617b"
1510462482.543760 [0 127.0.0.1:48166] "GET" "w3tc_linuxhostsupport.com_0_dbcache_53058f6b83972cfc3253e30ef06fcaa9"
1510462482.544272 [0 127.0.0.1:48166] "GET" "w3tc_linuxhostsupport.com_0_dbcache_276679217e6dc451b6353e7a1901990c"

Speeding up VestaCP on CentOS 7 is an easy task if you have a Outsourced Hosting Support with us. Feel free to ask our expert Linux Administrators to speed up VestaCP on your CentOS 7 server for you, and it will be taken care of immediately. They are available 24×7, so you can get the help you need at any time.

PS. Feel free to share this blog on how to Speed up VestaCP on CentOS 7 post if you liked it by using the social network shortcuts – you can also leave a comment instead, found under the share buttons.

14 thoughts on “Speed up VestaCP on CentOS 7

  1. redis appears not to be working. I see this error.

    ERROR: `/var/tmp/redis/configure –with-php-config=/usr/bin/php-config –enable-redis-igbinary=no’ failed

    1. I you have CentOS installed on your server, run the following command to install Redis:

      yum install –enablerepo=remi redis-server php-redis

  2. How does VestaCP compare to something like Runcloud or ServerPilot?

    I’m on Runcloud at the moment but am looking into other options and could migrate if it is better.

    1. VestaCP is a hosting control panel more similar to cPanel than ServerPilot/Runcloud.

      It can be on installed on a single server so you can easily manage users, services, websites, databases, emails etc. For more details you can check the official VestaCP documentation.

  3. Could you review the steps? in some I have problems like “the command was not found”. I am using VestaCP in Centos 7 with Nginx + Php-fpm.

      1. Problem 1: # yum-config-manager –enable remi-php70

        Problem 2: # pecl install redis

        When typing these commands, I get messages like “The command was not found” or, “The command does not exist”.

        What is explained in this post is the best way to optimize vestacp?

  4. One more thing, with only redis and opcache is fine. Or can I add some wordpress plugin like wp-rocket or wp-fastest cache?

Leave a Reply

Your email address will not be published. Required fields are marked *