Linux

How To Reinstall Linux Kernel on CentOS 7 (Solving Kernel Panic Error)

How To Reinstall Linux Kernel on CentOS 7 (Solving Kernel Panic Error) &-8211; this Article or News was published on this date:2020-09-27 11:36:02 kindly share it with friends if you find it helpful

The kernel panic error problem generally occurs after we update our Linux CentOS system. However, errors when updating Linux kernel versions are usually the main trigger for kernel panic errors. We encountered a kernel panic error on our CentOS 7 server right after we updated our system. This problem makes our CentOS 7 server unable to boot after we run the reboot command.

Kernel panic errors can also be triggered by missing initramfs files, which are generally caused by incomplete updates Linux kernel. If your CentOS 7.7 server experiences a kernel panic error that makes your server unable to boot with the latest version of the Linux kernel, you can follow the tutorial below to reinstall the Linux kernel.

1.) The first step, please reinstall your Linux kernel. Well, the latest Linux kernel version of CentOS 7.7 is kernel-3.10.0-1062.1.2.el7.

$ yum reinstall kernel-3.10.0-1062.1.2.el7.x86_64

NOTE: Please replace kernel-3.10.0-1062.1.2.el7.x86_64 with the latest kernel version that you want to install.

2.) Let’s update your system with this simple command

$ yum update

3.) OK All Done, now you can reboot your sytem and you should see your CentOS 7.7 server can restart properly.

$ reboot

How To Upgrade MariaDB v5.5 to MariaDB v10.4 on VestaCP CentOS 7.7

How To Upgrade MariaDB v5.5 to MariaDB v10.4 on VestaCP CentOS 7.7 &-8211; this Article or News was published on this date:2020-09-27 11:35:56 kindly share it with friends if you find it helpful

VestaCP is an open source control panel, lightweight and absolutely free. This control panel is designed to be very lightweight which can work seamlessly with Apache web server + Nginx as a reverse proxy, or Nginx web server + PHP-FPM (PHP FastCGI Process Manager). VestaCP also supports almost all Linux operating systems, including RHEL / CentOS (5, 6, 7), Debian (7, 8, 9) and Ubuntu (12.04 LTS to 18.10).

Well, in this guide I will show you how to upgrade MariaDB v5.5 to MariaDB v10.4 on your VestaCP server. As we know that VestaCP with CentOS 7+ has been using MariaDB v5.5 for a long time as their default database server. MariaDB v5.5 is the oldest stable version that is still maintained by MariaDB Corporation AB (formerly SkySQL) to date. On the other hand, this company has released the latest and most up-to-date version of its MariaDB v10.4. So we need to run our server with MariaDB v10.4 to get the better performance and stability for our server.

Basically upgrading MariaDB on VestaCP is exactly the same as we install MariaDB on a virtual private server without panels. It’s easy enough to upgrade, we just need to add the custom MariaDB YUM repository on our CentOS server. Please note that to run MariaDB v10 + we need at least 1GB of memory / RAM, and always use the x86_64 (64-bit) system.

***UPGRADE MariaDB v5.5 to MariaDB v10.0

1.) First of all, please log in to your CentOS server via the SSH terminal (you can use PuTTy if you work with Windows on your side) or other software if you are running Linux in front of you. Please note that we need root access to upgrade MariaDB on VestaCP.

2.) We need to create a MariaDB.repo file, and then add the custom MariaDB v10.0 YUM repository under the /etc/yum.repos.d/ directory.

$ nano /etc/yum.repos.d/MariaDB.repo
- MariaDB 10.0 CentOS repository list - created 2019-10-22 04:52 UTC
- http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

3.) Remove MariaDB v5.5 from your server.

$ yum remove mariadb-server mariadb-client
$ yum remove mariadb
$ yum autoremove

4.) Install and Configure MariaDB v10.0

$ yum clean all
$ yum update (and then please press "NO")
$ yum install MariaDB-server MariaDB-client

5.) Fix &-038; Rename mysqld.log.rpmsave to mysqld.log

$ mv -f /var/log/mariadb/mariadb.log.rpmsave /var/log/mariadb/mariadb.log
$ mkdir /var/run/mariadb/
$ chkconfig mysql on
$ service mysql restart

6.) Run mysql_upgrade

$ mysql_upgrade -u root -p

7.) Configure and Secure your MariaDB v10.0 installation.

$ sudo mysql_secure_installation

8.) Now, check your MariaDB database version

$ mysql -V

***NEXT: UPGRADE MariaDB v10.0 to MariaDB v10.1

Now, after we successfully upgrade MariaDB v5.5 to MariaDB v10.0, we can proceed to the next step to upgrade MariaDB v10.0 to MariaDB v10.1.

1.) Remove the MariaDB 10.1 YUM repository from your MariaDB.repo file. And then paste MariaDB 10.2 YUM repo into your MariaDB.repo file.

$ nano /etc/yum.repos.d/MariaDB.repo
- MariaDB 10.1 CentOS repository list - created 2019-10-22 05:11 UTC
- http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

2.) Remove MariaDB v10.0 from your VestaCP

$ yum remove mariadb-server mariadb-client
$ yum remove mariadb
$ yum autoremove

3.) Install MariaDB v10.1

$ yum clean all
$ yum update (and then please press "NO")
$ yum install MariaDB-server MariaDB-client

4.) Restart your MariaDB v10.1 database server

$ chkconfig mariadb on
$ service mariadb restart

5.) Run mysql_upgrade

$ mysql_upgrade -u root -p

6.) Configure and Secure MariaDB

$ sudo mysql_secure_installation

7.) Now, check your MariaDB database version

$ mysql -V

***NEXT: UPGRADE MariaDB v10.1 to MariaDB v10.2

1.) Remove the current MariaDB 10.1 YUM repository from your MariaDB.repo file. And then paste MariaDB 10.2 YUM repo into your MariaDB.repo file.

$ nano /etc/yum.repos.d/MariaDB.repo
- MariaDB 10.2 CentOS repository list - created 2019-10-22 05:21 UTC
- http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

2.) Remove MariaDB v10.1

$ yum remove mariadb-server mariadb-client
$ yum remove mariadb
$ yum autoremove

3.) Install MariaDB v10.2

$ yum clean all
$ yum update (please press "NO")
$ yum install MariaDB-server MariaDB-client

4.) Restart your MariaDB v10.2 database server

$ chkconfig mariadb on
$ service mariadb restart

5.) Run mysql_upgrade

$ mysql_upgrade -u root -p

6.) Configure and Secure your MariaDB installation

$ sudo mysql_secure_installation

7.) Now, check your MariaDB database version

$ mysql -V

***NEXT: UPGRADE MariaDB v10.2 to MariaDB v10.3

1.) Add the custom MariaDB v10.3 YUM repository to your MariaDB.repo file under the /etc/yum.repos.d/ directory. However, just like the previous step, you need to delete MariaDB 10.2 CentOS repository list from your MariaDB.repo file.

$ nano /etc/yum.repos.d/MariaDB.repo
- MariaDB 10.3 CentOS repository list - created 2019-10-22 05:31 UTC
- http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

2.) Remove MariaDB v10.2 installation from your VestaCP

$ yum remove mariadb-server mariadb-client
$ yum remove mariadb
$ yum autoremove

3.) Install and Configure MariaDB v10.3

$ yum clean all
$ yum update (please press "NO")
$ yum install MariaDB-server MariaDB-client

4.) Restart your MariaDB v10.3 database server

$ chkconfig mariadb on
$ service mariadb restart

5.) Run mysql_upgrade

$ mysql_upgrade -u root -p

6.) Configure and Secure your MariaDB v10.3 installation

$ sudo mysql_secure_installation

7.) Now, check your MariaDB database version

$ mysql -V

***NEXT: UPGRADE MariaDB v10.3 to MariaDB v10.4

1.) Just like the previous step, you should delete MariaDB 10.3 repo and then add the custom MariaDB 10.4 YUM repository to your current MariaDB.repo file.

$ nano /etc/yum.repos.d/MariaDB.repo
- MariaDB 10.4 CentOS repository list - created 2019-10-22 05:35 UTC
- http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

2.) Remove MariaDB v10.3 database server

$ yum remove mariadb-server mariadb-client
$ yum remove mariadb
$ yum autoremove

3.) Install and Configure MariaDB v10.4

$ yum clean all
$ yum update (please press "NO")
$ yum install MariaDB-server MariaDB-client

4.) Now, let’s restart MariaDB v10.4 database server

$ chkconfig mariadb on
$ service mariadb restart

5.) Run mysql_upgrade command

$ mysql_upgrade -u root -p

6.) Configure and Secure your MariaDB v10.3 installation

$ sudo mysql_secure_installation

7.) Now, check your MariaDB database version

$ mysql -V

8.) OK… All DONE!!!

Now, your VestaCP server is running with the latest and most up-to-date version of MariaDB v10.4 database server.

How To Install and Tuning Memcached on VestaCP CentOS 7

How To Install and Tuning Memcached on VestaCP CentOS 7 &-8211; this Article or News was published on this date:2020-09-27 11:35:48 kindly share it with friends if you find it helpful

If you currently have a WordPress-based website, you will know how important the database cache for your WP site. Especially if your site has super busy traffic every day. Of course, the role of database cache will be very important to balance your server load, and can help your site to handle high traffic.

There are actually two database cache options that we can use on VestaCP server, including Memcached and Redis. However, in this guide I will show you how to install Memcached on a CentOS 7 server with Vesta Control Panel. This guide should work well on CentOS 6, but it requires a number of different settings. Well, installing Memcached together with its Memcache extension is very easy.

1.) First, install Memcached and the Memcache extension. Login to your CentOS 7 server as “root user” and then run this commands.

$ yum install memcached php-pecl-memcached php-pecl-memcache

2.) You can customize Memcached settings according to your WordPress site requirements. However, make sure to adjust the values in the Memcached configuration to match your server specifications, especially memory allocation. OK, now open the Memcached configuration file.

$ nano /etc/sysconfig/memcached
; Default memcached config
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

The default values are as you can see above. Well, you can adjust it according to your needs. For example, we are allowed to change the default value of CACHESIZE=”64″ to 128 or 256, and so on. The CACHESIZE value is the maximum amount of memory allocation that will be used by Memcached. Please note that the default value of CACHESIZE=”64″ is a memory allocation of 64MB which will be used for object storage. So if you change it to 256 or 512 then we will need a memory allocation of 256MB or 512MB. So make sure your server has enough memory (RAM) allocation.

Meanwhile, MAXCONN is the maximum number of simultaneous connections allowed by Memcached. For example, we can increase the MAXCONN value from 1024 to 2048 or 3072, according to our server’s needs. Especially if you have a very busy server, you can increase the CACHESIZE value up to 2GB and MAXCONN 4096. But make sure your server has enough free memory allocation. Then if you want to change the default Memcached port, make sure to add your custom Memcached port to the whitelist on your Firewall rule. For example, we can change the default Memcached port from 11211 to 37509.

; Custom memcached config
PORT="37509"
USER="memcached"
MAXCONN="2048"
CACHESIZE="256"
OPTIONS=""

3.) Next, open the 50-memcached.ini and 40-memcache.ini files in the /etc/php.d/ and /etc/php-zts.d/ directories respectively. Then UNCOMMENT the lines “session.save_handler” and “session.save_path” as follows:

$ nano /etc/php-zts.d/50-memcached.ini
; Use memcache as a session handler
session.save_handler=memcached
; Defines a comma separated list of server urls to use for session storage
session.save_path="localhost:37509"
$ nano /etc/php-zts.d/40-memcache.ini
; Use memcache as a session handler
session.save_handler=memcache
; Defines a comma separated of server urls to use for session storage
session.save_path="tcp://localhost:37509?persistent=1&weight=1&timeout=1&retry_interval=15"

4.) Well, if your VestaCP uses Nginx + PHP-FPM, make sure to adjust the php.ini values like this:

$ session.save_handler = files
$ session.save_path = /var/lib/php/session
$ soap.wsdl_cache_dir = /var/lib/php/wsdlcache

Then set directory permissions to 777 and 775:

$ chmod 777 /var/lib/php/session/
$ chmod 775 /var/lib/phpMyAdmin/temp/

5.) OK All DONE…!!! Restart your Memcached service and web server.

$ service memcached restart
$ chkconfig memcached on
$ service php-fpm restart
$ service nginx restart

If you’re using an Apache web server (HTTPD), simply run the following command:

$ service httpd restart

6.) Finally, if you use a WordPress-based site, you can install the W3 Total Cache plugin in order to integrate Memcached into your WP site. Then make sure to enable Memcached as Database Cache and Object Cache Methods. For more details about WordPress + Memcached + W3 Total Cache, I will give you a more complete tutorial next time.

CONCLUSION

Installing Memcached on a CentOS 7 server with VestaCP is very easy. If you run a WordPress-based site on your VestaCP server, be sure to always install Memcached to reduce CPU load and to make your server environment more stable, and more scalable. The most important thing is that Memcached can improve your site’s load time much faster, thanks to the Memcached database cache which can be seamlessly integrated into the WordPress CMS.

How To Fix Missing Kernel-Headers on CentOS 7

How To Fix Missing Kernel-Headers on CentOS 7 &-8211; this Article or News was published on this date:2020-09-27 11:35:39 kindly share it with friends if you find it helpful

In this guide I will show you how to fix missing kernel-headers on CentOS 7 server. If you get the same error message like this, your CentOS 7 system might have missing kernel-header problems.

$ Error: Package: glibc-headers-2.17-106.el7_2.6.x86_64 (updates)
$ Requires: kernel-headers >= 2.2.1
$ Error: Package: glibc-headers-2.17-106.el7_2.6.x86_64 (updates)
$ Requires: kernel-headers
$ You could try using --skip-broken to work around the problem
$ You could try running: rpm -Va --nofiles --nodigest
$ Error: yum install failed

SOLUTION:

To solve the missing kernel-headers problem on CentOS 7, simply run the following command to install the necessary packages.

$ yum install kernel-headers --disableexcludes=all

OTHER SOLUTIONS:

If the above solution doesn’t work well on your CentOS 7 server, you can follow other solutions below.

1.) First of all, we need to edit the yum.conf file under the /etc/ directory. Because your CentOS 7 system is most likely to exclude kernel packages, so we need to fix this.

$ nano /etc/yum.conf

2.) Please look for the exclude=kernel line, well we need to comment or delete this line.

Change from:

$ exclude=kernel*

To:

$ -exclude=kernel*

3.) Finally, let’s install kernel-headers on your CentOS 7 system.

$ yum install kernel-headers

How To Set Correct Permissions (CHMOD) on Linux with Single Command

How To Set Correct Permissions (CHMOD) on Linux with Single Command &-8211; this Article or News was published on this date:2020-09-27 11:35:31 kindly share it with friends if you find it helpful

Setting the correct permissions (CHMOD) for all files and folders in a Linux server environment is very important. The correct permission will secure all files and folders on your website. Of course, we don’t want our website files and folders to be publicly accessible. For example, WordPress has strict standards permission for both files and folders – 644 for files (600 for wp-config.php and .htaccess files) and 755 for folders.

Well, what happens if we accidentally set file and folder permissions with incorrect values – for example set chmod to 777? Obviously it will harm your site and will make it easy for someone to get access to your website. That’s why we need to set the correct permissions for both files and folders/directories.

In this tutorial I will guide you on how to set the correct permissions (chmod) on a Linux server with a single command. This guide should be used in almost all Linux distributions, including Fedora/RHEL/CentOS and Debian/Ubuntu servers. However, make sure you have root privileges to run this command via the SSH terminal.

1.) Set Folder Permissions to 755 (-rwxr-xr-x)

$ find /var/www/html/yourdomain.com/public -type d -exec chmod 755 {} ;

This single command will allow you to set the correct folder permissions to 755 (-rwxr-xr-x). This command will also set all sub-folders under the public directory to 755.

If you want to set folder permissions to other values (775 for example) you must change 755 to 775. However, please make sure to change the correct directory path according to your site/server directory path. For example, the public directory of your site is located at /home/user/domain.com/public_html, here you need to change the directory path from:

$ /var/www/html/yourdomain.com/public

To

$ /home/user/domain.com/public_html

2.) Set File Permissions to 644 (-rw-r–r–)

$ find /var/www/html/yourdomain.com/public -type f -exec chmod 644 {} ;

This command will allow you to set the correct file permissions to 644 for all files under the public folder. With the single command above, you can also change the file permission value to another value, for example you can change from 644 to 600 (this will make your file more secure).

Just like setting the folder permissions above, here you must also set the correct public folder path according to the public directory path of your site. So, you can replace from:

$ /var/www/html/yourdomain.com/public

To

$ /home/user/domain.com/public_html