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:
# yum install php
After installing php, restart the Apache service to render PHP in the Web browser.
# systemctl restart httpd.service
Next, create the following php script under the Apache document root directory to verify PHP.
# 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 ).
# php /var/www/html/phpinfo.php
Or
# 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:
# yum install mariadb-server mariadb
Install MariaDB Database
Start MariaDB and configure it to automatically start when it is started.
# systemctl start mariadb.service
# 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 .)
# 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 ).
# /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.
# 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 ):
# Protocol 2, 1 (originally)
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.
# PermitRootLogin yes (originally)
PermitRootLoginno (now)
Cancel SSH Root Login
Finally, restart the SSH service to enable the changes.
# 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.
# yum install gcc
Install GCC on CentOS
Check the installed gcc version.
# 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.
# yum install java
Install Java
Check the installed Java version.
# java -version
Check Java version