How to Reconfigure Installed Package in Ubuntu and Debian

dpkg-reconfigure is a powerful command line tool used to reconfigure an already installed package. It is one of the several tools offered under dpkg – the core package management system on Debian/Ubuntu Linux. It works in conjunction with debconf, the configuration system for Debian packages. Debconf registers the configuration of all installed packages on your system.

This tool can actually be used to reconfigure an entire Ubuntu or Debian system installation. Simply provide the name(s) of package(s) to reconfigure, and it will ask a number of configuration questions, in the same way when the package was initially installed on your system.

It can allow you to retrieve the settings of an installed package, as well as change the current settings of that package as recorded in decconf. A common category of packages you can reconfigure are those whose configurations are determined by questions in the package installation script, usually shown via a graphical interface during the package installation process, for example phpmyadmin.

View Configurations Of Installed Package

To view current configurations of an installed package “phpmyadmin“, use the debconf-show utility as shown.

$ sudo debconf-show phpmyadmin

View Installed Package Configurations

View Installed Package Configurations

Reconfigure Installed Package in Debian and Ubuntu

If you have already installed a package, for instance phpmyadmin, you can reconfigure it by passing the package name to dpkg-reconfigure as shown.

$ sudo dpkg-reconfigure phpmyadmin

Once you have run the command above, you should be able to start reconfiguring phpmyadmin as shown in the following screenshot. You will be asked a series of questions, select the settings you want and complete the process.

Reinstall Database for PhpMyAdmin

Reinstall Database for PhpMyAdmin

Configure Web Server for PhpMyAdmin

Configure Web Server for PhpMyAdmin

When the phpmyadmin reconfiguration process is done, you will see the some useful information concerning the new package settings as shown in the following screenshot.

PhpMyAdmin Information

PhpMyAdmin Information

There are some useful options which allow you to change its default behavior, we will explain some of the practically useful ones, as follows.

The -f flag is used to choose the frontend (such as dailog, readline, Gnome, Kde, Editor or noninteractive) to use.

$ sudo dpkg-reconfigure -f readline phpmyadmin

You can permanently change the default frontend via the debconf, by running the following command.

$ sudo dpkg-reconfigure debconf

Use the Up and Down keys to select an option, and press the TAB key to choose Ok and press Enter.

Change dpkg-reconfigure Frontend

Change dpkg-reconfigure Frontend

Also choose which questions to ignore according to priority level, as shown in the screenshot and press Enter.

Change Debconf Priority

Change Debconf Priority

To specify the minimum priority of questions that will be displayed, directly from the command line, use the -poption.

$ sudo dpkg-reconfigure -p critical phpmyadmin

Some packages may be in an inconsistent or broken state, in such a case, you can use the -f flag to force dpkg-reconfigure to reconfigure a package. Remember to use this flag with caution!

$ sudo dpkg-reconfigure -f package_name

For more information, see the dpkg-reconfigure man page.

$ man dpkg-reconfigure

That’s it for now! If you have any questions concerning how to use dpkg-reconfigure, or any additional thoughts to share, reach us via the comments section below.

Source

How to Setup and Configure Network Bonding or Teaming in RHEL/CentOS 7

When a system administrator wants to increase the bandwidth available and provide redundancy and load balancing for data transfers, a kernel feature known as network bonding allows to get the job done in a cost-effective way.

Read more about how to increase or bandwidth throttling in Linux

Linux Inside: The Ideal Blog for Sysadmins & Geeks@tecmint

How to Limit the Network Bandwidth Used by Applications in a Linux with Tricklehttp://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/ 
Via @tecmint

See Linux Inside: The Ideal Blog for Sysadmins & Geeks’s other Tweets

In simple words, bonding means aggregating two or more physical network interfaces (called slaves) into a single, logical one (called master). If a specific NIC (Network Interface Card) experiences a problem, communications are not affected significantly as long as the other(s) remain active.

Read more about network bonding in Linux systems here:

  1. Network Teaming or NiC Bondin in RHEL/CentOS 6/5
  2. Network NIC Bonding or Teaming on Debian based Systems
  3. How to Configure Network Bonding or Teaming in Ubuntu

Enabling and Configuring Network Bonding or Teaming

By default, the bonding kernel module is not enabled. Thus, we will need to load it and ensure it is persistent across boots. When used with the --first-time option, modprobe will alert us if loading the module fails:

# modprobe --first-time bonding

The above command will load the bonding module for the current session. In order to ensure persistency, create a .conf file inside /etc/modules-load.d with a descriptive name, such as /etc/modules-load.d/bonding.conf:

# echo "# Load the bonding kernel module at boot" > /etc/modules-load.d/bonding.conf
# echo "bonding" >> /etc/modules-load.d/bonding.conf

Now reboot your server and once it restarts, make sure the bonding module is loaded automatically, as seen in Fig. 1:

Check Network Bonding Module Loaded in Kernel

Check Network Bonding Module Loaded in Kernel

In this article we will use 3 interfaces (enp0s3enp0s8, and enp0s9) to create a bond, named conveniently bond0.

To create bond0, we can either use nmtui, the text interface for controlling NetworkManager. When invoked without arguments from the command line, nmtui brings up a text interface that allows you to edit an existing connection, activate a connection, or set the system hostname.

Choose Edit connection –> Add –> Bond as illustrated in Fig. 2:

Create Network Bonding Channel

Create Network Bonding Channel

In the Edit Connection screen, add the slave interfaces (enp0s3enp0s8, and enp0s9 in our case) and give them a descriptive (Profile) name (for example, NIC #1NIC #2, and NIC #3, respectively).

In addition, you will need to set a name and device for the bond (TecmintBond and bond0 in Fig. 3, respectively) and an IP address for bond0, enter a gateway address, and the IPs of DNS servers.

Note that you do not need to enter the MAC address of each interface since nmtui will do that for you. You can leave all other settings as default. See Fig. 3 for more details.

Network Bonding Teaming Configuration

Network Bonding Teaming Configuration

When you’re done, go to the bottom of the screen and choose OK (see Fig. 4):

Configuration of bond0

Configuration of bond0

And you’re done. Now you can exit the text interface and return to the command line, where you will enable the newly created interface using ip command:

# ip link set dev bond0 up

After that, you can see that bond0 is UP and is assigned 192.168.0.200, as seen in Fig. 5:

# ip addr show bond0

Check Network Bond Interface Status

Check Network Bond Interface Status

Testing Network Bonding or Teaming in Linux

To verify that bond0 actually works, you can either ping its IP address from another machine, or what’s even better, watch the kernel interface table in real time (well, the refresh time in seconds is given by the -n option) to see how network traffic is distributed between the three network interfaces, as shown in Fig. 6.

The -d option is used to highlight changes when they occur:

# watch -d -n1 netstat -i

Check Kernel Interface Table

Check Kernel Interface Table

It is important to note that there are several bonding modes, each with its distinguishing characteristics. They are documented in section 4.5 of the Red Hat Enterprise Linux 7 Network Administration guide. Depending on your needs, you will choose one or the other.

In our current setup, we chose the Round-robin mode (see Fig. 3), which ensures packets are transmitted beginning with the first slave in sequential order, ending with the last slave, and starting with the first again.

The Round-robin alternative is also called mode 0, and provides load balancing and fault tolerance. To change the bonding mode, you can use nmtui as explained before (see also Fig. 7):

Changing Bonding Mode Using nmtui

Changing Bonding Mode Using nmtui

If we change it to Active Backup, we will be prompted to choose a slave that will the only one active interface at a given time. If such card fails, one of the remaining slaves will take its place and becomes active.

Let’s choose enp0s3 to be the primary slave, bring bond0 down and up again, restart the network, and display the kernel interface table (see Fig. 8).

Note how data transfers (TX-OK and RX-OK) are now being made over enp0s3 only:

# ip link set dev bond0 down
# ip link set dev bond0 up
# systemctl restart network

Bond Acting in Active Backup Mode

Bond Acting in Active Backup Mode

Alternatively, you can view the bond as the kernel sees it (see Fig. 9):

# cat /proc/net/bonding/bond0

Check Network Bond as Kernel

Check Network Bond as Kernel

Summary

In this chapter we have discussed how to set up and configure bonding in Red Hat Enterprise Linux 7 (also works on CentOS 7 and Fedora 22+) in order to increase bandwidth along with load balancing and redundancy for data transfers.

As you take the time to explore other bonding modes, you will come to master the concepts and practice related with this topic of the certification.

Source

How to Configure Network Bonding or Teaming in Ubuntu

Network Interface Bonding is a mechanism used in Linux servers which consists of binding more physical network interfaces in order to provide more bandwidth than a single interface can provide or provide link redundancy in case of a cable failure. This type of link redundancy has multiple names in Linux, such as BondingTeaming or Link Aggregation Groups (LAG).

Read AlsoHow to Setup Network Bonding or Teaming in RHEL/CentOS

To use network bonding mechanism in Ubuntu or Debian based Linux systems, first you need to install the bonding kernel module and test if the bonding driver is loaded via modprobe command.

$ sudo modprobe bonding

Check Network Bonding in Ubuntu

Check Network Bonding in Ubuntu

On older releases of Debian or Ubuntu you should install ifenslave package by issuing the below command.

$ sudo apt-get install ifenslave

To create a bond interface composed of the first two physical NCs in your system, issue the below command. However this method of creating bond interface is ephemeral and does not survive system reboot.

$ sudo ip link add bond0 type bond mode 802.3ad
$ sudo ip link set eth0 master bond0
$ sudo ip link set eth1 master bond0

To create a permanent bond interface in mode 0 type, use the method to manually edit interfaces configuration file, as shown in the below excerpt.

$ sudo nano /etc/network/interfaces
# The primary network interface
auto bond0
iface bond0 inet static
	address 192.168.1.150
	netmask 255.255.255.0	
	gateway 192.168.1.1
	dns-nameservers 192.168.1.1 8.8.8.8
	dns-search domain.local
		slaves eth0 eth1
		bond_mode 0
		bond-miimon 100
		bond_downdelay 200
		bound_updelay 200

Configure Bonding in Ubuntu

Configure Bonding in Ubuntu

In order to activate the bond interface, either restart network service, bring down the physical interface and rise the bond interface or reboot the machine in order for the kernel to pick-up the new bond interface.

$ sudo systemctl restart networking.service
or
$ sudo ifdown eth0 && ifdown eth1 && ifup bond0

The bond interface settings can be inspected by issuing the below commands.

$ ifconfig 
or 
$ ip a

Verify Bond Interface in Ubuntu

Verify Bond Interface in Ubuntu

Details about the bond interface can be obtained by displaying the content of the below kernel file using cat command as shown.

$ cat /proc/net/bonding/bond0

Check Bonding Information in Ubuntu

Check Bonding Information in Ubuntu

To investigate other bond interface messages or to debug the state of the bond physical NICS, issue the below commands.

$ tail -f /var/log/messages

Check Bond Interface Messages

Check Bond Interface Messages

Next use mii-tool tool to check Network Interface Controller (NIC) parameters as shown.

$ mii-tool

Check Bond Interface Link

Check Bond Interface Link

The types of Network Bonding are listed below.

  • mode=0 (balance-rr)
  • mode=1 (active-backup)
  • mode=2 (balance-xor)
  • mode=3 (broadcast)
  • mode=4 (802.3ad)
  • mode=5 (balance-tlb)
  • mode=6 (balance-alb)

The full documentations regarding NIC bonding can be found at Linux kernel doc pages.

Source

How to Install OpenSSL from Source in CentOS and Ubuntu

OpenSSL is a full-featured software library that contains an open-source implementation of the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols, used for securing information transmitted over computer networks.

It is a general-purpose cryptography library and supports a number of different cryptographic algorithms including AES, Blowfish; MD5, MD4, SHA-1, SHA-2 cryptographic hash functions; RSA, DSA, Diffie–Hellman key exchange, Elliptic curve and many others.

In this article, we will explain how to install the latest stable version of OpenSSL from sources on CentOS and Ubuntu based distributions.

Step 1: Install Development Tools

1. To compile OpenSSL manually from sources, you need to first install few dependencies such as “Development Tools” under RHEL/CentOS/Fedora or “build-essential” in Debian/Ubuntu as shown.

------------------- On CentOS, RHEL & Fedora ------------------- 
# yum group install 'Development Tools' && yum install perl-core libtemplate-perl zlib-devel 

------------------- On Ubuntu & Debian -------------------
$ sudo apt update && apt install build-essential checkinstall zlib1g-dev libtemplate-perl

Step 2: Compile OpenSSL from Sources

2. Next, download the latest stable version of OpenSSL (v1.0.2 at the time of writing, which is a Long Term Support (LTS) release, supported until 31st December 2019), from the download page using following wget command and unpack it using tar command.

$ wget -c https://www.openssl.org/source/openssl-1.0.2p.tar.gz
$ tar -xzvf openssl-1.0.2p.tar.gz

3. Now, move into the extracted directory, configure, build, after a successful build, test the libraries and install OpenSSL in the default location, which is /usr/local/ssl, by running the following commands.

$ cd openssl-1.0.2p/
$ ./config
$ make
$ make test
$ sudo make install 

4. Once you have successfully installed OpenSSL, you can move into the installation directory and view the various sub-directories and files using ls command.

$ cd /usr/local/ssl/
$ ls -l

drwxr-xr-x. 2 root root  4096 Aug 22 06:37 bin
drwxr-xr-x. 2 root root  4096 Aug 22 06:37 certs
drwxr-xr-x. 3 root root  4096 Aug 22 06:37 include
drwxr-xr-x. 4 root root  4096 Aug 22 06:37 lib
drwxr-xr-x. 6 root root  4096 Aug 22 06:36 man
drwxr-xr-x. 2 root root  4096 Aug 22 06:37 misc
-rw-r--r--. 1 root root 10835 Aug 22 06:37 openssl.cnf
drwxr-xr-x. 2 root root  4096 Aug 22 06:37 private

The following are important directories you need to take note of:

  • bin – contains the openssl binary and some utility scripts.
  • include/openssl – contains the header files needed for building your own programs that use libcrypto or libssl.
  • lib – contains the OpenSSL library files.
  • lib/engines – contains the OpenSSL dynamically loadable engines.
  • man – contains the OpenSSL man-pages.
  • share/doc/openssl/html – contains HTML rendition of the man-pages.
  • certs – the default location for certificate files.
  • private – the default location for private key files.

5. To check the version of OpenSSL you have just installed, run the following command.

$ /usr/local/ssl/bin/openssl version

OpenSSL 1.0.2p  14 Aug 2018

6. To use the newly installed OpenSSL version on your system, you need to add the directory /usr/local/ssl/bin/to your PATH, in the file ~/.bashrc (or the equivalent for your shell).

$ vim ~/.bashrc

Add this line at the bottom of the file.

export PATH="/usr/local/ssl/bin:${PATH}"

Save and close the file and reload the configuration using the command below.

$ source .bashrc

7. Now open a new terminal window and run the following commands to confirm that the new OpenSSL binary is located in your PATH and that you can run it without typing its full path.

$ whereis openssl

openssl: /usr/bin/openssl /usr/lib64/openssl /usr/include/openssl /usr/local/ssl/bin/openssl /usr/share/man/man1/openssl.1ssl.gz
$ openssl version 	

OpenSSL 1.0.2p  14 Aug 2018

That’s all! In this article, we have explained how to install the latest OpenSSL version from source on Linux systems. If you have any questions, use the command form below to reach us.

Source

How to Install LAMP Stack with PhpMyAdmin in Ubuntu 18.04

LAMP stack is composed of packages such as ApacheMySQL/MariaDB and PHP installed on a Linux system environment for hosting websites and apps.

Read AlsoInstall Apache, MariaDB, PHP and PhpMyAdmin in Ubuntu 18.04

PhpMyAdmin is a free, open source, well known, fully-featured, and intuitive web-based frontend for administering MySQL and MariaDB database. It supports various database operations, and has many features that allow you to easily manage your databases from a web interface; such as importing and exporting data in various formats, generating complex and useful queries using Query-by-example (QBE), administering multiple servers, and much more.

Requirements:

  1. Minimal Ubuntu 18.04 server Installation.
  2. Access to server via SSH (if you don’t have direct access).
  3. Root user privileges or use sudo command to run all commands.

In this article, we will explain how to install LAMP stack with PhpMyAdmin in Ubuntu 18.04.

Step 1: Install Apache Web Server on Ubuntu 18.04

1. First start by updating your software packages and then install Apache web server using following commands.

$ sudo apt update
$ sudo apt install apache2

2. After the installation process is complete, the apache service should start automatically and will be enabled to start at system boot time, you can check if it’s up and running using following command.

$ sudo systemctl status apache2

3. If you have a system firewall enabled and running, you need to open the ports 80 and 443 to allow client connection requests to apache web server via HTTP and HTTPS respectively, then reload the firewall settings as shown.

$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw reload

4. Now verify your Apache installation by testing default test page at the below URL from a web browser.

http://domain_name/
OR
http://SERVER_IP/

If you see the apache default web page, it means your installation is working fine.

Check Apache Web Page

Check Apache Web Page

Step 2: Install MariaDB on Ubuntu 18.04

5. Now install MariaDB, is a free, open source database management system forked from MySQL and it is a community developed project being led by the original developers of MySQL.

$ sudo apt install mariadb-server mariadb-client

6. The MariaDB services should start automatically after installation, check its status to ensure that it is up and running.

$ sudo systemctl status mysql

7. The MariaDB installation is not secure by default, you need to execute a security script that comes with the package. You will be asked to set a root password to ensure that nobody can log into the MariaDB.

$ sudo mysql_secure_installation

Once you execute the script, it will ask you to enter current password for root (enter for none):

Then enter yes/y to the following security questions:

  • Set root password? [Y/n]: y
  • Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
  • Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
  • Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Secure Mariadb Installation in Ubuntu 18.04

Secure Mariadb Installation in Ubuntu 18.04

Step 3: Install PHP on Ubuntu 18.04

8. PHP is one of the most widely used server side scripting language used to generate dynamic content on websites and apps. You can install PHP (default version is PHP 7.2) and other modules for web deployments using following command.

$ sudo apt install php php-common php-mysql php-gd php-cli

9. Once PHP installed, you can test your PHP setup by creating a simple info.php page in your web server document root, using this single command.

 
$ echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

10. Then open a web browser, and enter this URL to view the php information page.

http://domain_name/info.php
OR
http://SERVER_IP/info.php

Test PHP Info in Ubuntu 18.04

Test PHP Info in Ubuntu 18.04

Step 4: Install PhpMyAdmin on Ubuntu 18.04

11. Finally, you can install phpMyAdmin for administrating MySQL/MariaDB databases from the comfort of a web browser, by running following command.

$ sudo apt install phpmyadmin

Through the package installation process, you will be asked to choose the web server that should be automatically configured to run phpMyAdmin, select apache by pressing the space bar and press Enter.

Select PhpMyAdmin Web Server

Select PhpMyAdmin Web Server

PhpMyAdmin Configuration

PhpMyAdmin Configuration

12. Next, enter the password for the MySQL/MariaDB administrative user so the installer can create database for phpmyadmin.

Set Password for Phpmyadmin

Set Password for Phpmyadmin

13. Once everything installed, you can now restart the apache2 service to effect the recent changes.

$ sudo systemctl restart apache2

Note: If the PhpMyAdmin package has not been enable to work with apache web server automatically, run the following commands to copy the phpmyadmin apache configuration file located under /etc/phpmyadmin/ to apache webserver available configurations directory /etc/apache2/conf-available/ and then activate it using the a2enconf utility, and restart apache service effect the recent changes, as follows.

$ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf 
$ sudo a2enconf phpmyadmin
$ sudo systemctl restart apache2

14. Lastly, from a web browser, and type the following URL to access you phpMyAdmin web frontend.

http://domain_name/phpmyadmin
OR
http://SERVER_IP/phpmyadmin

Use the root credentials to authenticate in the phpMyAdmin, as shown in the following screen shot.

PhpMyAdmin Login

PhpMyAdmin Login

Important: Starting from MySQL 5.7, root login requires sudo command, therefore the root login will fail via phpmyadmin, you may need to create another admin user account. Access the mariadb shell using the root account from a terminal, and run the following commands to create a new user:

$ sudo mysql -u root -p
MariaDB [(none)]> CREATE USER 'admin'@'localhost' IDENTIFIED BY '=@!#254tecmint';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;

Now log into PhpMyAdmin using the new admin credentials to administer your databases.

PhpMyAdmin MySQL Database Administration

PhpMyAdmin MySQL Database Administration

To secure your PhpMyAdmin web interface, check this article: 4 Useful Tips to Secure PhpMyAdmin Web Interface.

That’s it! In this article, we have explained how to setup LAMP stack with the latest PhpMyAdmin in Ubuntu 18.04. Use the comment form below to send us your queries, or thoughts about this guide.

Source

How to Install Lighttpd with PHP, PHP-FPM and MariaDB on CentOS 7

Lighttpd is an open source, secure, fast, flexible and more optimized web server designed for speed-critical environments with less memory utilization as compared to other web servers.

It can handle up-to 10,000 connections parallel in one server with effective cpu-load management and comes with advanced feature set such as FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more.

Lighttpd is the excellent solution for every Linux server, due to its high speed io-infrastructure that allows us to scale several times better performance with the same hardware than with other alternative web-servers.

In this tutorial, we will explain how to install Lighttpd with PHP-FPM and MariaDB on CentOS/RHEL 7distributions with hostname tecmint.example.com and IP address 192.168.0.103.

Step 1: Install Lighttpd on CentOS 7

1. To install Lighttpd, first you need to update your system software packages and available repositories using following command.

# yum -y update

2. Next, you need to enable EPEL repository on your system and update software packages using following commands.

# yum -y install epel-release
# yum -y update

3. Once you’ve enabled EPEL repository, you can now install Lighttpd by running the following command.

# yum install lighttpd

4. Once the Lighttpd packages are installed, you can start and enable the service to automatically start at boot time and make sure to verify the status using the following commands.

# systemctl start lighttpd
# systemctl enable lighttpd
# systemctl status lighttpd

If you see any error message similar to below in the status, you need to fix few things to get it start properly without displaying any error messages.

Dec 10 02:14:26 tecmint.com lighttpd[1463]: 2018-12-10 02:14:26: (network.c.167) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address...ONLY changes
Dec 10 02:14:26 tecmint.com lighttpd[1463]: 2018-12-10 02:14:26: (server.c.1352) can't have more connections than fds/2:  1024 1024
Hint: Some lines were ellipsized, use -l to show in full.

Open the file called /etc/lighttpd/lighttpd.conf with any editor.

# vi /etc/lighttpd/lighttpd.conf

Change the line that says server.use-ipv6 from enable to disable. It will fix error messages shown above.

##
## Use IPv6?
##
server.use-ipv6 = "disable"

Now try again to start Lighttpd, it should work 100% without any error messages.

# systemctl restart lighttpd
# systemctl status lighttpd

5. Now verify the version of Lighttpd installed on your system using the following command.

# lighttpd -v

lighttpd/1.4.51 (ssl) - a light and fast webserver

6. Now you need to allow HTTP and HTTPS traffic on your firewall.

# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

7. Now open your browser and point to the following URL to see your Lighttpd web server working.

http://Your-Domain.com
OR
http://Your-IP-addr

Check Lighttpd Page

Check Lighttpd Page

The default document root directory for Lighttpd is /var/www/lighttpd/ and the main configuration file is located under /etc/lighttpd/lighttpd.conf.

Step 2: Installing MariaDB as MySQL in CentOS 7

8. Next, install MySQL support for Lighttpd using following commands.

# yum -y install mariadb mariadb-server

9. Once the installation is complete, start, enable and verify the status of MariaDB using following commands.

# systemctl start mariadb.service
# systemctl enable mariadb.service
# systemctl status mariadb.service

10. Finally, you will need to secure your MariaDB installation by issuing the following command.

# mysql_secure_installation

You will be prompted a few different questions regarding your MariaDB installation and how you would like to secure it. You can change the database root user password, disable the test database, disable anonymous users, and disable root login remotely.

Sample Output
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): Enter OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!

11. Try connecting to MySQL server and review the existing databases on your database server with following commands on the terminal.

# mysql -u root -p
Sample Output
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]>

Step 3: Installing PHP and PHP-FPM with FastCGI on CentOS 7

12. To enable PHP-FPM with FastCGI support, first you need to install PHP along with necessary extensions using following command.

# yum -y install php php-mysqlnd php-pdo php-gd php-mbstring

13. Once PHP installed, now enable PHP-FPM and FastCGI support for Lighttpd, to do this you need to install these packages too.

# yum -y install php-fpm lighttpd-fastcgi

14. Now open a file called /etc/php-fpm.d/www.conf.

# vi /etc/php-fpm.d/www.conf

Set the user and group to lighttpd.

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = lighttpd
; RPM: Keep a group allowed to write in log dir.
group = lighttpd

15. Now start PHP-FPM service and make sure to enable it to automatically start at boot time using the following commands.

# systemctl start php-fpm.service
# systemctl enable php-fpm.service

Step 4: Enabling PHP and PHP-FPM with FastCGI in Lighttpd

16. Here, we need to modify three files /etc/php.ini/etc/lighttpd/modules.conf and /etc/lighttpd/conf.d/fastcgi.conf to enable PHP support for Lighttpd.

Open first file /etc/php.ini.

# vi /etc/php.ini

Un-comment the following line that says line cgi.fix_pathinfo=1.

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=1

Then open second file called /etc/lighttpd/modules.conf.

# vi /etc/lighttpd/modules.conf

Un-comment the following line that says include “conf.d/fastcgi.conf”.

##
## FastCGI (mod_fastcgi)
##
include "conf.d/fastcgi.conf"

Next, open third file called /etc/lighttpd/conf.d/fastcgi.conf.

# vi /etc/lighttpd/conf.d/fastcgi.conf

Now add the following container at the bottom of the file and save it.

fastcgi.server += ( ".php" =>
        ((
                "host" => "127.0.0.1",
                "port" => "9000",
                "broken-scriptfilename" => "enable"
        ))
)

Restart the Lighttpd service to reflect changes and enable PHP support.

# systemctl restart lighttpd

Step 5: Testing PHP and PHP-FPM with FastCGI Support in Lighttpd

17. As We said above that the default document root for Lighttpd is /var/www/lighttpd/. So, here we will create a phpinfo.php file into this directory.

# vi /var/www/lighttpd/info.php

Add the following lines to it. This small piece of code will display information about PHP installation with their versions.

<?php
phpinfo();
?>

18. Open your browser and navigate to the following links.

http://Your-Domain.com
OR
http://Your-IP-addr

Check PHP Support in CentOS 7

Check PHP Support in CentOS 7

You will see working information of PHPPHP-FPM and MySQL with lots of other modules that are already enabled.

Source

How to Perform Graphical Installation of “Red Hat Enterprise or CentOS 7.0” Remotely Using VNC Mode

This tutorial concentrates on how to perform a graphical installation of Red Hat Enterprise or CentOS 7.0 from a remote point in VNC Direct Mode using Anaconda included locally VNC server and how to partition a hard-disk smaller than 2TB with a GPT Partition Table Layout on non-UEFI systems.

Install CentOS Remotely Using VNC

Install RHEL/CentOS 7 Remotely Using VNC

In order to access the graphical installation, your remote system that will control the installation process, requires a VNC viewer program installed and running on your machine.

Requirements

  1. Installation of RHEL 7.0
  2. Installation of CentOS 7.0
  3. An VNC client installed on a remote system

Step 1: Boot RHEL/CentOS Media Installer in VNC Mode

1. After the installer bootable media has been created, place your DVD/USB into your system appropriate drive, start the machine, select your bootable media and on the first prompt press TAB key and the boot options should appear.

In order to start b>Anaconda VNC server with a password to restrict access to installation and force your hard-disk smaller than 2TB in size to be partitioned with a GPT valid partition table, append the following options to boot menu command line.

inst.gpt inst.vnc inst.vncpassword=password resolution=1366x768

Install Linux in VNC Mode

Installing CentOS in VNC Mode

 

As you can see I’ve added an extra option to force graphical installation resolution to a custom size – replace resolution values with your desired values.

2. Now press Enter key to start the installer and wait until it reaches the message where it shows you the VNC IP Address and Port number to enter, in order to connect, on client side.

Connect VNC Client

Connect VNC Client

That’s it! Now the installation process is ready to be configured from a remote system using a VNC Client.

Step 2: Configure VNC Clients on Remote Systems

3. As a previously mentioned, in order to be able to perform a VNC installation remote systems requires a running VNC Client. The following VNC clients are available, depending on your Operating System.

For RHEL/CentOS 7.0 installed with a Graphical User Interface open Remote Desktop Viewer, hit on Connectbutton and choose VNC for Protocol and add VNC IP Address and Port presented on the system where you perform the installation.

Remote Desktop Viewer

Remote Desktop Viewer

Connect to Remote VNC

Connect to Remote VNC

Enter VNC IP Address

Enter VNC IP Address

4. After the VNC Client connects to installer, you will be prompted to enter the VNC installer password. Enter the password, hit Authenticate and a new window with CentOS/RHEL Anaconda graphical interface should appear.

From here, you can continue with the installation process in the same manner as you would do it from a directly connected monitor, using the same procedure as described RHEL/CentOS 7.0 Installation Guide links provide above.

Authenticate to Remote VNC

Authenticate to Remote VNC

Welcome to CentOS 7 Installation

Welcome to CentOS 7 Installation

5. For Debian based distributions (Ubuntu, Linux Mint, etc) install Vinagre package for GNOME desktop environment and use the same procedure as explained above.

$ sudo apt-get install vinagre

Install Vinagre in Ubuntu

Install Vinagre Package

Remote CentOS Installation

Remote CentOS 7 Installation

6. For Windows based systems install the TightVNC Viewer program by downloading it using the following link.

  1. http://www.tightvnc.com/download.php

Download TightVNC Viewer

Download TightVNC Viewer

TightVNC Connection

TightVNC Connection

Remote CentOS Installation Process

Remote CentOS 7 Installation Process

7. If you want to see details about your disk partition layout which now uses GPT on a disk smaller than 2TB, go to Installation Destination, select your disk and the partition table should be visible and a new biosboot partition should be automatically created.

If you opted for Automatically create partitions, in the contrary case you should create one as Standard Partition with Bios Boot as a File System and 1 MB in size on non-UEFI systems.

CentOS Standard Partition Table

CentOS 7 Standard Partition Table

CentOS Partition Table Changes

CentOS 7 Partition Table Changes

As a last note, if you are planning to use MBR Partition Layout on a disk smaller than 2TB on UEFI based systems, you must initially reformat your hard-disk, and, then create a Standard Partition with EFI System Partition (efi) as File System with a minimal value of 200 MB in size, regardless of your partitioning scheme.

Source

How to Install Asterisk on CentOS 7

Asterisk is an open source framework used for building communication applications. You can use it to turn a local computer or server to communication server. It is used to power IP PBX systems, VoIP gateways, conference servers and other solutions. It’s used by all kind of organizations worldwide and finally, but not last it is free and open source.

In this tutorial, we are going to show you how to install Asterisk on CentOS 7 (instructions also works on RHEL 7), but before we start, we will need to make some preparations so Asterisk can run smoothly after the installation.

Step 1: Disable SELinux on CentOS 7

To do this, first SSH to your system and using your favorite command line text editor, open /etc/selinux/configand disable SELINUX.

# vim /etc/selinux/config

SELinux line should look like this:

SELINUX=disabled

Now reboot your system. Once it comes back SSH again to that system.

Step 2: Install Required Packages

Asterisk has quite a few requirements that need to be installed. You can use the following yum command to install required packages as shown.

# yum install -y epel-release dmidecode gcc-c++ ncurses-devel libxml2-devel make wget openssl-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel

Before we continue further, create a new user through which we will use asterisk.

# adduser asterisk -c "Asterisk User"
# su asterisk

Next, install PJSIP, is a free open source multimedia communication library that implements standard based protocols such as SIP,SDP,RTP,STUN,TURN and ICE. It is the Asterisk SIP channel driver that should improve the clarity of the calls.

To get the latest version, first let’s create a temporary directory where we will build the package from source.

$ mkdir ~/build && cd ~/build

Now go the PJSIP download page and grab the package or use the following wget command to download the package directly in terminal.

Note that by the writing of this article the latest version is 2.8, this may change in future, thus make sure to use the latest version:

$ wget https://www.pjsip.org/release/2.8/pjproject-2.8.tar.bz2

Once the download is complete, extract the file and change to that directory.

$ tar xvjf pjproject-2.8.tar.bz2
$ cd pjproject-2.8

The next step is to prepare the package to be compiled. You can use the following command:

$ ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr

You should not see any errors or warnings. Ensure that all dependencies are met:

$ make dep

And now we can complete the install and link libraries with:

$ make && sudo make install && sudo ldconfig

Finally ensure that all libraries are installed and present:

$ ldconfig -p | grep pj

You should get the following output:

        libpjsua2.so.2 (libc6,x86-64) => /lib64/libpjsua2.so.2
        libpjsua2.so (libc6,x86-64) => /lib64/libpjsua2.so
        libpjsua.so.2 (libc6,x86-64) => /lib64/libpjsua.so.2
        libpjsua.so (libc6,x86-64) => /lib64/libpjsua.so
        libpjsip.so.2 (libc6,x86-64) => /lib64/libpjsip.so.2
        libpjsip.so (libc6,x86-64) => /lib64/libpjsip.so
        libpjsip-ua.so.2 (libc6,x86-64) => /lib64/libpjsip-ua.so.2
        libpjsip-ua.so (libc6,x86-64) => /lib64/libpjsip-ua.so
        libpjsip-simple.so.2 (libc6,x86-64) => /lib64/libpjsip-simple.so.2
        libpjsip-simple.so (libc6,x86-64) => /lib64/libpjsip-simple.so
        libpjnath.so.2 (libc6,x86-64) => /lib64/libpjnath.so.2
        libpjnath.so (libc6,x86-64) => /lib64/libpjnath.so
        libpjmedia.so.2 (libc6,x86-64) => /lib64/libpjmedia.so.2
        libpjmedia.so (libc6,x86-64) => /lib64/libpjmedia.so
        libpjmedia-videodev.so.2 (libc6,x86-64) => /lib64/libpjmedia-videodev.so.2
        libpjmedia-videodev.so (libc6,x86-64) => /lib64/libpjmedia-videodev.so
        libpjmedia-codec.so.2 (libc6,x86-64) => /lib64/libpjmedia-codec.so.2
        libpjmedia-codec.so (libc6,x86-64) => /lib64/libpjmedia-codec.so
        libpjmedia-audiodev.so.2 (libc6,x86-64) => /lib64/libpjmedia-audiodev.so.2
        libpjmedia-audiodev.so (libc6,x86-64) => /lib64/libpjmedia-audiodev.so
        libpjlib-util.so.2 (libc6,x86-64) => /lib64/libpjlib-util.so.2
        libpjlib-util.so (libc6,x86-64) => /lib64/libpjlib-util.so
        libpj.so.2 (libc6,x86-64) => /lib64/libpj.so.2
        libpj.so (libc6,x86-64) => /lib64/libpj.so

Step 3: Install Asterisk in CentOS 7

We are now ready to initiate the installation of Asterisk. Navigate back to our ~/build directory:

$ cd ~/build

Go to Asterisk download page and grab the the latest version or you can use the following wget command to download the file in terminal.

$ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz

By the writing of this tutorial, the latest Asterisk version is 16. Make sure that you are downloading the latest version of Asterisk, when you are following the steps.

Now extract the archive and navigate to the newly created directory:

$ tar -zxvf asterisk-16-current.tar.gz
$ cd asterisk-16.0.0

This is the time to mention, that if you wish to enable mp3 support to play music while client is on hold, you will need to install few more dependencies. These steps are optional:

# yum install svn
# ./contrib/scripts/get_mp3_source.sh

After the second step, you should get output similar to these:

A    addons/mp3
A    addons/mp3/MPGLIB_README
A    addons/mp3/common.c
A    addons/mp3/huffman.h
A    addons/mp3/tabinit.c
A    addons/mp3/Makefile
A    addons/mp3/README
A    addons/mp3/decode_i386.c
A    addons/mp3/dct64_i386.c
A    addons/mp3/MPGLIB_TODO
A    addons/mp3/mpg123.h
A    addons/mp3/layer3.c
A    addons/mp3/mpglib.h
A    addons/mp3/decode_ntom.c
A    addons/mp3/interface.c

Start by running the configure script to prepare the package for compiling:

$ sudo contrib/scripts/install_prereq install
$ ./configure --libdir=/usr/lib64 --with-jansson-bundled
$ make menuselect

If you get any missing dependencies install them. In my case, I got the following error:

configure: error: patch is required to configure bundled pjproject

To go around this simply run:

# yum install patch 

And re-run the configure script. Now lets start the build process:

$ make menuselect

After few seconds, you should get a list of features to enable:

Asterisk Modules

Asterisk Modules

If you attempt to use music on hold feature, you will need to enable the “format_mp3” feature from “Add-ons” section. Save your list and run the following command:

make && sudo make install

To install the sample configuration files, use the command below:

sudo make samples

To start Asterisk on boot, use:

sudo make config

As root user update the ownership of the following directories and files:

# chown asterisk. /var/run/asterisk
# chown asterisk. -R /etc/asterisk
# chown asterisk. -R /var/{lib,log,spool}/asterisk

Finally let’s test our installation with:

$ sudo service asterisk start
$ sudo asterisk -rvv

You should see output similar to this one:

Asterisk 16.0.0, Copyright (C) 1999 - 2018, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 16.0.0 currently running on asterisk (pid = 3985)
asterisk*CLI>

If you want to see a list of available commands type:

asterisk*CLI> core show help

To exit the Asterisk prompt, simply type:

asterisk*CLI> exit

Asterisk will still be running in the background.

Conclusion

Now you have a running Asterisk server and you can start connecting phones and extensions and adjust your configuration per your needs. For more details how to achieve this, it is recommended to use the Asterisk Wiki page. If you have any questions or comments, please let us know in the comment section below.

Source

How to Install CentOS Web Panel (CWP) on CentOS 7

CentOS Web Panel (CWP) is a free web hosting control panel that offers easy managemet of multiple servers (both Dedicated and VPS) without the need to access server through SSH for every small task that you need to complete. It is a feature rich control panel, which comes with a high number of options and features for quick server management.

CentOS Web Panel Features

Here are some of the most beneficial features and services offered by CentOS Web Panel.

  • Apache Web Server ( Mod Security + Automatic updated rules optional).
  • PHP 5.6 (suPHP, SuExec + PHP version switcher).
  • MySQL/MariaDB + phpMyAdmin.
  • Email – Postfix and Dovecot, mailboxes, RoundCube web interface ((Antivirus, Spamassassin optional).
  • CSF (Config Server Firewall).
  • Backups ( this feature is optional).
  • Easy user management interface.
  • Setups Server for Web Hosting with WordPres.
  • FreeDNS Server.
  • Live Monitoring.
  • File System Lock (means, no more website hacking due to locking of files from changes).
  • Server configuration AutoFixer.
  • cPanel Account Migration.
  • TeamSpeak 3 Manager (Voice) and Shoutcast Manager (video streaming).

Thare are lots more features offered by CWP, that you can check out here.

The latest version of CWP is 0.9.8.651 and was released on 21st April 2018, which includes few bug fixes regarding loading time improvements.

CentOS Web Panel Demo

New Root Admin Panel Login:
Non SSL Login: http://demo1.centos-webpanel.com:2030
SSL Login: https://79.137.25.230:2031
Username: root
Password: admin123

New End user Panel Login:
Non SSL Login: http://demo1.centos-webpanel.com:2082
SSL Login: https://79.137.25.230:2083
Username: testacc
Password: admin123

Requirements of CentOS Web Panel Installer:

To avoid getting any problems, please make sure to read all of the following important instructions thoroughly prior to the CWP installation process.

  1. Only install CWP on a freshly installed CentOS 7 server without any configuration changes.
  2. Minimum RAM requirement for 32-bit 512MB and 64-bit 1GB with 10GB of free space.
  3. Only static IP addresses are currently supported, no support for dynamic, sticky, or internal IP addresses.
  4. There isn’t any uninstaller for removing CWP after installation, you must reload the OS to remove it.

For the better performances we suggest you to order a Linode VPS with minimal CentOS 7 install.

Install CentOS Web Panel (CWP) on CentOS 7

For the purpose of this article, I will be installing CWP (CentOS Web Panel) on a local CentOS 7 server with a static IP address 192.168.0.104 and hostname cwp.tecmint.com.

Setup Hostname

1. To start the CWP installation, login into your server as root and make sure to set the correct hostname.

Important: The hostname and domain name must be different on your server (for example, if domain.com is your domain on your server, then use hostname.domain.com as your fully qualified hostname).

# hostnamectl set-hostname cwp.tecmint.com
# hostnamectl

Set Hostname in CentOS 7

Set Hostname in CentOS 7

Setup Server IP Addresses

2. To setup network, we will use nmtui (NetworkManager Text User Interface) utility, which offers a graphical user interface to configure networking by controlling Network Manager.

# yum install NetworkManager-tui
# nmtui

Set Static IP Address in CentOS 7

Set Static IP Address in CentOS 7

Installing CentOS Web Panel

3. After setting hostname and static IP address, now you need update your server to the latest version and install wget utility to fetch and install the CWP installation script.

# yum -y update
# yum -y install wget
# cd /usr/local/src
# wget http://centos-webpanel.com/cwp-el7-latest
# sh cwp-el7-latest

Install CentOS Web Panel Script

Install CentOS Web Panel Script

Please be patient as the installation progress can take between 10 and 20 minutes to complete. Once the install has finished you should see a screen saying “CWP” installed and list of credentials required to access the panel. Make sure to copy or write down the information and keep it safe:

Once ready, press “ENTER” for server reboot. If the system does not reboot automatically simply type “reboot” to reboot the server.

# reboot

CentOS Web Panel Installation Summary

CentOS Web Panel Installation Summary

CentOS Web Panel Configuration

4. After server reboot, login into server as root, once login you will see different welcome screen with information about the logged users and the current disk space usage.

CentOS Web Panel Server Login

CentOS Web Panel Server Login

Now log in to your CentOS Web Panel server using the link provided by the installer on your server.

CentOS WebPanel Admin GUI: http://SERVER-IP:2030/
Username: root
Password: your root password

CentOS Web Panel Admin Login

CentOS Web Panel Admin Login

CentOS Web Panel Dashboard

CentOS Web Panel Dashboard

For additional configuration instruction, please check out wiki/documentation site.

In this article, we’ve explained how to install CentOS Web Panel on CentOS 7. If you have any questions or comments, please do not hesitate to submit them in the comment section below.

Source

How to Install or Upgrade to Kernel 5.0 in CentOS 7

Although some people use the word Linux to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries.

During normal operations, the kernel is responsible for performing two important tasks:

  1. Acting as an interface between the hardware and the software running on the system.
  2. Managing system resources as efficiently as possible.

To do this, the kernel communicates with the hardware through the drivers that are built into it or those that can be later installed as a module.

For example, when an application running on your machine wants to connect to a wireless network, it submits that request to the kernel, which in turns uses the right driver to connect to the network.

Suggested Read: How to Upgrade Kernel in Ubuntu

With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions.

Ready to update your kernel on CentOS 7 or one of their derivatives such as RHEL 7 and Fedora? If so, keep reading!

Step 1: Checking Installed Kernel Version

When we install a distribution it includes a certain version of the Linux kernel. To show the current version installed on our system we can do:

# uname -sr

The following image shows the output of the above command in a CentOS 7 server:

Check Kernel Version in CentOS 7

Check Kernel Version in CentOS 7

If we now go to https://www.kernel.org/, we will see that the latest kernel version is 5.0 at the time of this writing (other versions are available from the same site).

This new Kernel 5.0 version is a long-term release and will be supported for 6 years, earlier all Linux Kernel versions were supported for 2 years only.

One important thing to consider is the life cycle of a kernel version – if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date. For more info, refer to the kernel Releases page.

Step 2: Upgrading Kernel in CentOS 7

Most modern distributions provide a way to upgrade the kernel using a package management system such as yum and an officially-supported repository.

Important: If you looking to run custom compiled Kernel, then you should read our article that explains How to Compile Linux Kernel on CentOS 7 from sources.

However, this will only perform the upgrade to the most recent version available from the distribution’s repositories – not the latest one available in the https://www.kernel.org/. Unfortunately, Red Hat only allows to upgrade the kernel using the former option.

As opposed to Red HatCentOS allows the use of ELRepo, a third-party repository that makes the upgrade to a recent version a kernel.

To enable the ELRepo repository on CentOS 7, do:

# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm 

Enable ELRepo in CentOS 7

Enable ELRepo in CentOS 7

Once the repository has been enabled, you can use the following command to list the available kernel.relatedpackages:

# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Yum – Find Available Kernel Versions
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo-kernel: mirror-hk.koddos.net
Available Packages
kernel-lt.x86_64                        4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-devel.x86_64                  4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-doc.noarch                    4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-headers.x86_64                4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-tools.x86_64                  4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-tools-libs.x86_64             4.4.176-1.el7.elrepo        elrepo-kernel
kernel-lt-tools-libs-devel.x86_64       4.4.176-1.el7.elrepo        elrepo-kernel
kernel-ml.x86_64                        5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-devel.x86_64                  5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-doc.noarch                    5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-headers.x86_64                5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-tools.x86_64                  5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-tools-libs.x86_64             5.0.0-1.el7.elrepo          elrepo-kernel
kernel-ml-tools-libs-devel.x86_64       5.0.0-1.el7.elrepo          elrepo-kernel
perf.x86_64                             5.0.0-1.el7.elrepo          elrepo-kernel
python-perf.x86_64                      5.0.0-1.el7.elrepo          elrepo-kernel

Next, install the latest mainline stable kernel:

# yum --enablerepo=elrepo-kernel install kernel-ml
Install Kernel 5.0 in CentOS 7
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.net.in
 * elrepo: mirror-hk.koddos.net
 * elrepo-kernel: mirror-hk.koddos.net
 * epel: repos.del.extreme-ix.org
 * extras: centos.mirror.net.in
 * updates: centos.mirror.net.in
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:5.0.0-1.el7.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================
 Package                Arch        Version                 Repository        Size
====================================================================================
Installing:
 kernel-ml              x86_64      5.0.0-1.el7.elrepo      elrepo-kernel     47 M

Transaction Summary
====================================================================================
Install  1 Package

Total download size: 47 M
Installed size: 215 M
Is this ok [y/d/N]: y
Downloading packages:
kernel-ml-5.0.0-1.el7.elrepo.x86_64.rpm                           |  47 MB  00:01:21     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kernel-ml-5.0.0-1.el7.elrepo.x86_64                1/1 
  Verifying  : kernel-ml-5.0.0-1.el7.elrepo.x86_64                1/1 

Installed:
  kernel-ml.x86_64 0:5.0.0-1.el7.elrepo                                                                                                                                                                            

Complete!

Finally, reboot your machine to apply the latest kernel, and then select latest kernel from the menu as shown.

Select Latest Kernel Version

Select Latest Kernel Version

Login as root, and run following command to check the kernel version:

# uname -sr

Verify Kernel Version

Verify Kernel Version

Step 3: Set Default Kernel Version in GRUB

To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows:

Open and edit the file /etc/default/grub and set GRUB_DEFAULT=0. This means that the first kernel in the GRUB initial screen will be used as default.

GRUB_TIMEOUT=5
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Next, run the following command to recreate the kernel configuration.

# grub2-mkconfig -o /boot/grub2/grub.cfg
Set Default Kernel Version in Grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.0.0-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-4.20.0-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.20.0-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-4.19.11-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.19.11-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-4.19.0-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.19.0-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-1e2b46dbc0c04b05b592c837c366bb76
Found initrd image: /boot/initramfs-0-rescue-1e2b46dbc0c04b05b592c837c366bb76.img
done

Reboot and verify that the latest kernel is now being used by default.

Booting Default Kernel Version in CentOS 7

Booting Default Kernel Version in CentOS 7

Congratulations! You have upgraded your kernel in CentOS 7!

Summary

In this article we have explained how to easily upgrade the Linux kernel on your system. There is yet another method which we haven’t covered as it involves compiling the kernel from source, which would deserve an entire book and is not recommended on production systems.

Although it represents one of the best learning experiences and allows for a fine-grained configuration of the kernel, you may render your system unusable and may have to reinstall it from scratch.

Source

WP2Social Auto Publish Powered By : XYZScripts.com