30 things to be done after minimal RHEL/CentOS 7 installation (2)

Source: Internet
Author: User
Tags centos server free ssh ssh server ssh keygen

30 things to be done after minimal RHEL/CentOS 7 installation (2)

7. install PHP

PHP is a server-side scripting language used for basic web services. It is also often used as a general programming language. Install PHP in CentOS with minimal installation:

  1. # yum install php

After installing php, restart the Apache service to render PHP in the Web browser.

  1. # systemctl restart httpd.service

Next, create the following php script under the Apache document root directory to verify PHP.

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

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

  1. # php /var/www/html/phpinfo.php
  2. Or
  3. # links http://127.0.0.1/phpinfo.php

Verify PHP

8. Install the MariaDB Database

MariaDB is a branch of MySQL. RHEL and its derivative versions have been migrated from MySQL to MariaDB. This is a mainstream database management system and a required tool. No matter what type of server you are configuring, you will need it either later or later. Install MariaDB on CentOS with minimal installation, as shown below:

  1. # yum install mariadb-server mariadb

Install MariaDB Database

Start MariaDB and configure it to automatically start when it is started.

  1. # systemctl start mariadb.service
  2. # systemctl enable mariadb.service

Allow mysql (mariadb) services to use the firewall (LCTT; if you need to connect to the database on another server, try to use the internal network instead of exposing the database service to the public internet .)

  1. # firewall-cmd –add-service=mysql

Now it is time to ensure the security of the MariaDB server (LCTT Note: This step is mainly to set the mysql management password ).

  1. # /usr/bin/mysql_secure_installation

Protect MariaDB Databases

Please read:

  • Install LAMP on CentOS 7.0 (Linux, Apache, MariaDB, PHP/PhpMyAdmin)
  • Create an Apache VM on CentOS 7.0
9. install and configure the SSH server

SSH is the default protocol for Linux Remote Management. SSH is one of the most important software installed and running on the minimal CentOS server.

Check the installed SSH version.

  1. # SSH -V

Check the SSH Version

Use a safer SSH protocol instead of the default protocol, and change the port number to further enhance security. Edit the SSH configuration file '/etc/ssh/ssh_config '.

Remove the comment in the following line or delete 1 from the Protocol line, and then the line looks like this (LCTT: SSH v1 is an out-of-date insecure protocol ):

  1. # Protocol 2, 1 (originally)
  2. Protocol2 (now)

This change forces SSH to use Protocol 2, which is considered safer than Protocol 1, and also ensures that the port number 22 is changed to another in the configuration.

Protect SSH Login

Cancel the 'root login' in SSH. You can use the su to switch to the root account only after logging on with a common user account. This further enhances security. Open and edit the configuration file '/etc/ssh/sshd_config' and change PermitRootLogin yes to PermitRootLogin no.

  1. # PermitRootLogin yes (originally)
  2. PermitRootLoginno (now)

Cancel SSH Root Login

Finally, restart the SSH service to enable the changes.

  1. # systemctl restart sshd.service

See:

  • 5 best practices for encrypting and protecting SSH servers
  • Use SSH Keygen to log on to SSH without a password in five simple steps
  • Implement "password-free SSH key verification" in PuTTY"
10. Install GCC (GNU Compiler set)

GCC is the GNU Compiler set. It is a compilation system developed by a GNU project that supports multiple programming languages ). No default installation is available for CentOS with minimal installation. Run the following command to install the gcc compiler.

  1. # yum install gcc

Install GCC on CentOS

Check the installed gcc version.

  1. # gcc --version

Check the GCC version

11. install Java

Java is a generic class-based, object-oriented programming language. The minimal CentOS server is not installed by default (LCTT Note: if you do not have any Java application, you do not need to install it ). Run the following command to install Java from the Library.

  1. # yum install java

Install Java

Check the installed Java version.

  1. # java -version

Check Java version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.