30 Things to Do After Minimal RHEL/CentOS 7 Installation

7. Install PHP

PHP is a server-side scripting language for web based services. It is frequently used as general-purpose programming language as well. Install PHP on CentOS Minimal Server as.

# yum install php

After installing php, make sure to restart Apache service to render PHP in Web Browser.

# systemctl restart httpd.service

Next, verify PHP by creating following php script in the Apache document root directory.

# echo -e "<?php\nphpinfo();\n?>"  > /var/www/html/phpinfo.php

Now view the PHP file, we just created (phpinfo.php) in Linux Command Line as below.

# php /var/www/html/phpinfo.php
OR
# links http://127.0.0.1/phpinfo.php
Verify PHP

Verify PHP

8. Install MariaDB Database

MariaDB is a fork of MySQL. RedHat Enterprise Linux and its derivatives have shifted to MariaDB from MySQL. It is the Primary Database management System. It is again one of those tools which is necessary to have and you will need it sooner or later no matter what kind of server you are setting. Install MariaDB on CentOS Minimal Install server as below.

# yum install mariadb-server mariadb
Install MariaDB Database

Install MariaDB Database

Start and configure MariaDB to start automatically at boot.

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

Allow service mysql (mariadb) through firewall.

# firewall-cmd --add-service=mysql

Now it’s time to secure MariaDB server.

# /usr/bin/mysql_secure_installation
Secure MariaDB Database

Secure MariaDB Database

Read Also:

  1. Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in CentOS 7.0
  2. Creating Apache Virtual Hosts in CentOS 7.0

9. Install and Configure SSH Server

SSH stands for Secure Shell which is the default protocol in Linux for remote management. SSH is one of those essential piece of software which comes default with CentOS Minimal Server.

Check Currently Installed SSH version.

# SSH -V
Check SSH Version

Check SSH Version

Use Secure Protocol over the default SSH Protocol and change port number also for extra Security. Edit the SSH configuration file ‘/etc/ssh/sshd_config‘.

Uncomment the line below line or delete 1 from the Protocol string, so the line seems like:

# Protocol 2,1 (Original)
Protocol 2 (Now)

This change force SSH to use Protocol 2 which is considered to be more secure than Protocol 1 and also make sure to change the port number 22 to any in the configuration.

Secure SSH Login

Secure SSH Login

Disable SSH ‘root login‘ and allow to connect to root only after login to normal user account for added additional Security. For this, open and edit configuration file ‘/etc/ssh/sshd_config‘ and change PermitRootLogin yes t PermitRootLogin no.

# PermitRootLogin yes (Original) 
PermitRootLogin no (Now)
Disable SSH Root Login

Disable SSH Root Login

Finally, restart SSH service to reflect new changes..

# systemctl restart sshd.service

Read Also:

  1. 5 Best Practices to Secure and Protect SSH Server
  2. SSH Passwordless Login Using SSH Keygen in 5 Easy Steps
  3. No Password SSH Keys Authentication” with PuTTY

10. Install GCC (GNU Compiler Collection)

GCC stands for GNU Compiler Collection is a compiler system developed by GNU Project that support various programming languages. It is not installed by default in CentOS Minimal Install. To install gcc compiler run the below command.

# yum install gcc
Install GCC in CentOS

Install GCC GNU Compiler

Check the version of installed gcc.

# gcc --version
Check GCC Version

Check GCC Version

11. Install Java

Java is a general purpose class based, object-oriented Programming language. It is not installed by default in CentOS Minimal Server. Install Java from repository as below.

# yum install java
Install Java on CentOS

Install Java

Check version of Java Installed.

# java -version
Check Java Version

Check Java Version

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

76 Responses

  1. Paul says:

    I followed this guide. Its really helpful. As you said quite extensively about installing apache, databases and others.

    Can you also provide a guide regarding how to upload a site in CentOS after doing all this?

  2. Ambady Bala says:

    I am wondering why httpd,php is installed after installing virtualbox. Initially it is installed, will it conflict

  3. Samuel Wamala says:

    Resourceful tutorial for Linux enthusiast.

  4. Gary J. Morin says:

    There is a mistake in the SSH section. The config file is NOT ‘ssh-config’. That is meant for the SSH client not the server. The SSH server settings are in ‘sshd-config’. As a noob, it took me a while to figure out why my changes had no effect on the server.

    Otherwise, this has been a great resource for someone like me learning Linux for the first time. Thanks!

    • Ravi Saive says:

      @Gary,

      Thanks for notifying, yes it should sshd_config for configuring SSH Server. We’ve corrected in the article.

  5. Graham Leach says:

    One of the commands didn’t work for me, the one related to opening up the httpd port through firewalld. I got a syntax error

    I got a successful execution with the following command, because I did not choose to assign http a funky port, just the standard one (80)

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

    If you want to use a custom port for httpd, use this command, which specifies the port/protocol:

    # firewall-cmd --permanent --zone=public --add-port=2888/tcp 
    

    SOURCE:
    https://stackoverflow.com/questions/24729024/open-firewall-port-on-centos-7

  6. Panos says:

    Thank you for getting this information together, it is very helpful for people not familiar to minimal dekstop-less installations.

Leave a Reply to Paul Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.