mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #2671 from ictlyh/master
[Translated] tech/30 Things to Do After Minimal RHEL or CentOS 7 Installation--2
This commit is contained in:
commit
a046e8c7c8
@ -1,145 +0,0 @@
|
||||
Translating by ictlyh
|
||||
30 Things to Do After Minimal RHEL/CentOS 7 Installation--2
|
||||
================================================================================
|
||||
### 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/ww/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](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-PHP.jpeg)
|
||||
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](http://www.tecmint.com/wp-content/uploads/2015/04/Install-MariaDB-Database.jpeg)
|
||||
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](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-MariaDB.jpeg)
|
||||
Secure MariaDB Database
|
||||
|
||||
Read Also:
|
||||
|
||||
- [Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in CentOS 7.0][1]
|
||||
- [Creating Apache Virtual Hosts in CentOS 7.0][2]
|
||||
|
||||
### 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](http://www.tecmint.com/wp-content/uploads/2015/04/Check-SSH-Version.jpeg)
|
||||
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/ssh_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](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-SSH.jpeg)
|
||||
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](http://www.tecmint.com/wp-content/uploads/2015/04/Disable-SSH-Root-Login.jpeg)
|
||||
Disable SSH Root Login
|
||||
|
||||
Finally, restart SSH service to reflect new changes..
|
||||
|
||||
# systemctl restart sshd.service
|
||||
|
||||
Read Also:
|
||||
|
||||
- [5 Best Practices to Secure and Protect SSH Server][3]
|
||||
- [SSH Passwordless Login Using SSH Keygen in 5 Easy Steps][4]
|
||||
- [No Password SSH Keys Authentication” with PuTTY][5]
|
||||
|
||||
### 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](http://www.tecmint.com/wp-content/uploads/2015/04/Install-GCC-in-CentOS.jpeg)
|
||||
Install GCC GNU Compiler
|
||||
|
||||
Check the version of installed gcc.
|
||||
|
||||
# gcc --version
|
||||
|
||||
![Check GCC Version](http://www.tecmint.com/wp-content/uploads/2015/04/Check-GCC-Version.jpeg)
|
||||
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](http://www.tecmint.com/wp-content/uploads/2015/04/Install-java.jpeg)
|
||||
Install Java
|
||||
|
||||
Check version of Java Installed.
|
||||
|
||||
# java -version
|
||||
|
||||
![Check Java Version](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Java-Version.jpeg)
|
||||
Check Java Version
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/2/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/install-lamp-in-centos-7/
|
||||
[2]:http://www.tecmint.com/apache-virtual-hosting-in-centos/
|
||||
[3]:http://www.tecmint.com/5-best-practices-to-secure-and-protect-ssh-server/
|
||||
[4]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
|
||||
[5]:http://www.tecmint.com/ssh-passwordless-login-with-putty/
|
@ -0,0 +1,143 @@
|
||||
安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情--2
|
||||
================================================================================
|
||||
### 7. 安装 PHP ###
|
||||
|
||||
PHP 是用于 web 基础服务的服务器端脚本语言。它也经常被用作通用编程语言。在最小化安装的 CentOS 中安装 PHP。
|
||||
|
||||
# yum install php
|
||||
|
||||
安装完 php 之后,确认重启 Apache 服务以便在 Web 浏览器中渲染 PHP。
|
||||
|
||||
# systemctl restart httpd.service
|
||||
|
||||
下一步,通过在 Apache 文档根目录下创建下面的 php 脚本验证 PHP。
|
||||
|
||||
# echo -e "<?php\nphpinfo();\n?>" > /var/ww/html/phpinfo.php
|
||||
|
||||
现在在 Linux 命令行中查看我们刚才创建的 PHP 文件(phpinfo.php)。
|
||||
|
||||
# php /var/www/html/phpinfo.php
|
||||
或者
|
||||
# links http://127.0.0.1/phpinfo.php
|
||||
|
||||
![验证 PHP](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-PHP.jpeg)
|
||||
验证 PHP
|
||||
|
||||
### 8. 安装 MariaDB 数据库 ###
|
||||
|
||||
MariaDB 是 MySQL 的一个分支。红帽企业版 Linux 以及它的衍生版已经从 MySQL 迁移到 MariaDB。这是个主要的数据库管理系统。这又是一个你必须拥有的工具,不管你在配置怎样的服务器,或迟或早你都会需要它。在最小化安装的 CentOS 上安装 MariaDB,如下所示。
|
||||
|
||||
# yum install mariadb-server mariadb
|
||||
|
||||
![安装 MariaDB 数据库](http://www.tecmint.com/wp-content/uploads/2015/04/Install-MariaDB-Database.jpeg)
|
||||
安装 MariaDB 数据库
|
||||
|
||||
启动被配置 MariaDBs 随机启动。
|
||||
|
||||
# systemctl start mariadb.service
|
||||
# systemctl enable mariadb.service
|
||||
|
||||
允许 mysql(mariadb) 服务通过防火墙
|
||||
|
||||
# firewall-cmd –add-service=mysql
|
||||
|
||||
现在是时候确保 MariaDB 服务器安全了。
|
||||
|
||||
# /usr/bin/mysql_secure_installation
|
||||
|
||||
![保护 MariaDB 数据库](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-MariaDB.jpeg)
|
||||
保护 MariaDB 数据库
|
||||
|
||||
请阅读:
|
||||
|
||||
- [在 CentOS 7.0 上安装 LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin)][1]
|
||||
- [在 CentOS 7.0 上创建 Apache 虚拟主机][2]
|
||||
|
||||
### 9. 安装和配置 SSH 服务器 ###
|
||||
|
||||
SSH 表示 Secure Shell,是 Linux 远程管理的默认协议。 SSH 是随最小化 CentOS 服务器一起发布的最重要的软件之一。
|
||||
|
||||
检查当前已安装的 SSH 版本。
|
||||
|
||||
# SSH -V
|
||||
|
||||
![检查 SSH 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-SSH-Version.jpeg)
|
||||
检查 SSH 版本
|
||||
|
||||
在默认的 SSH 协议上使用安全协议,更改端口号进一步加强安全。编辑 SSH 的配置文件 ‘/etc/ssh/ssh_config’。
|
||||
|
||||
去掉下面行的注释或者从协议行中删除 1,然后行看起来像这样:
|
||||
|
||||
# Protocol 2,1 (原来)
|
||||
Protocol 2 (现在)
|
||||
|
||||
这个改变强制 SSH 使用 协议 2,它被认为比协议 1 更安全,同时也确保在配置中更改端口号 22 为其它。
|
||||
|
||||
![保护 SSH 登录](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-SSH.jpeg)
|
||||
保护 SSH 登录
|
||||
|
||||
取消 SSH ‘root login’ 然后允许只有当以普通用户账号登录后才能连接到 root 以进一步加强安全。为了做到这个,打开并编辑配置文件 ‘/etc/ssh/sshd_config’ 并更改 PermitRootLogin yes 为 PermitRootLogin no。
|
||||
|
||||
# PermitRootLogin yes (原来)
|
||||
PermitRootLogin no (现在)
|
||||
|
||||
![取消 SSH Root 登录](http://www.tecmint.com/wp-content/uploads/2015/04/Disable-SSH-Root-Login.jpeg)
|
||||
取消 SSH Root 登录
|
||||
|
||||
最后,重启 SSH 服务启用更改。
|
||||
|
||||
# systemctl restart sshd.service
|
||||
|
||||
请查看:
|
||||
|
||||
- [加密和保护 SSH 服务器的 5 个最佳实践][3]
|
||||
- [5 个简单步骤实现使用 SSH Keygen 无密码登录 SSH][4]
|
||||
- [在 PuTTY 中实现 “无密码 SSH 密钥验证”][5]
|
||||
|
||||
### 10. 安装 GCC (GNU 编译器集) ###
|
||||
|
||||
GCC 表示 GNU 编译器集,是一个 GNU 项目开发的支持多种编程语言的编译系统。在最小化安装的 CentOS 没有默认安装。运行下面的命令安装 gcc 编译器。
|
||||
# yum install gcc
|
||||
|
||||
![在 CentOS 上安装 GCC](http://www.tecmint.com/wp-content/uploads/2015/04/Install-GCC-in-CentOS.jpeg)
|
||||
在 CentOS 上安装 GCC
|
||||
|
||||
检查安装的 gcc 版本。
|
||||
|
||||
# gcc --version
|
||||
|
||||
![检查 GCC 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-GCC-Version.jpeg)
|
||||
检查 GCC 版本
|
||||
|
||||
### 11. 安装 Java ###
|
||||
|
||||
Java是一种通用的基于类的,面向对象的编程语言。在最小化 CentOS 服务器中没有默认安装。按照下面命令从库中安装 Java。
|
||||
|
||||
# yum install java
|
||||
|
||||
![在 CentOS 上安装 Java](http://www.tecmint.com/wp-content/uploads/2015/04/Install-java.jpeg)
|
||||
安装 Java
|
||||
|
||||
检查安装的 Java 版本。
|
||||
|
||||
# java -version
|
||||
|
||||
![检查 Java 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Java-Version.jpeg)
|
||||
检查 Java 版本
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/2/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[ictlyh](https://github.com/ictlyh)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/install-lamp-in-centos-7/
|
||||
[2]:http://www.tecmint.com/apache-virtual-hosting-in-centos/
|
||||
[3]:http://www.tecmint.com/5-best-practices-to-secure-and-protect-ssh-server/
|
||||
[4]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
|
||||
[5]:http://www.tecmint.com/ssh-passwordless-login-with-putty/
|
Loading…
Reference in New Issue
Block a user