In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following is a detailed tutorial on the installation and configuration of Nginx, PHP7, Mysql, JDK, Tomcat and Redis in Centos 7.2. the secret of the text lies in being close to the topic. So, no gossip, let's take a look at the following, I believe that after reading Centos 7.2 installation and configuration of Nginx, PHP7, Mysql, JDK, Tomcat, Redis detailed tutorials this article will certainly benefit you.
Centos 7.2install and configure Nginx, PHP7, Mysql, JDK, Tomcat, Redis, RAP
The following operations are performed in Aliyun ECS (Centos 7.2) environment. Other system environments may be slightly different, for reference only.
Software update
Due to the compatibility of system drivers, the current CVM ECS Linux does not support kernel upgrade operations (for more instructions, please see ECS instructions).
Usually get a new server, I like to upgrade the software first. Ariyun ECS does not recommend upgrading the kernel and operating system version of the server, so it should be removed when updating the system software.
The following is to check the server kernel and system version, you can see before and after the software upgrade, whether to eliminate the difference.
Uname-a
Lsb_release-a
First open the / etc/yum.conf (vi / etc/yum.conf) file, and then add the following two lines of code after [main] so that the kernel and system version are not upgraded when the software is updated.
Exclude=kernel
Exclude=centos-release
Picture description
Then update the software, the-y parameter is in the execution process, the interaction encountered by default yes, if you want to see the software update information, you can remove the-y parameter.
Yum-y update
Reference: Ali Cloud ECS (LINUX) update does not upgrade kernel configuration instructions
Hostname modification
View hostname directive
Hostname
The default hostname of Aliyun ECS is randomly generated, which is not very comfortable. You can modify the / etc/hostname file to change the current hostname to the name you want.
Vim / etc/hostname
Then, press ESC to enter: wq save (vim basic directive). Reboot to see if the hostname has changed.
PS: temporarily modify the hostname, and the original hostname will remain after restart.
Hostname Hostnam
Directly use yum to install the software, which may be a stable version, but not a new version. Here, change the source or compile and install the software to install the version you want.
Install NGINX
Before changing the source, you can check the version information of the system default source Nginx and compare it with the source change.
Yum info nginx
1. To change the source, first create a new repo, such as nginx.repo
Vim / etc/yum.repos.d/nginx.repo
two。 The editing content is as follows
[nginx]
Name=nginx repo
Baseurl= http://nginx.org/packages/mainline/centos/7/$basearch/
Gpgcheck=0
Enabled=1
Mainline version is configured here. If you want to use the stable version, delete the mainline in baseurl.
3. Carry out installation
Yum install nginx
4. View version
Nginx-v
5. Start the service
Systemctl start nginx
6. View statu
Systemctl status nginx
At this point, Nginx has been installed, access the server IP address (the domain name has been resolved, you can also use the domain name to access), check to see if there is a welcome page.
Picture description
Reference: nginx.org
Firewall configuration
If you do not see the welcome page after the above steps, it may be caused by the firewall configuration (port 80 is not open). The default firewall for Centos 7 is FirewallD.
FirewallD has image interface tool firewall-config and command line tool firewall-cmd. Command line tool firewall-cmd is usually used on the server.
View firewall running status
Firewall-cmd-state
Enable the FirewallD service
Systemctl start firewalld
View FirewallD status
Systemctl status firewalld
View FirewallD configuration
Firewall-cmd-list-all
Enable port 80 of TCP in the default region, and add the parameter permanent, which means that the configuration will take effect permanently after reloading. The configuration without this parameter will take effect immediately, but it will become invalid after FirewallD reloading.
Firewall-cmd-permanent-add-port=80/tcp
When the firewall is on, you only need to open port 80 (the default port for Nginx) to access the page.
Close the default zone TCP port 80
Firewall-cmd-permanent-remove-port=80/tcp
Enable HTTP service (the default configuration equals to opening port TCP 80)
Firewall-cmd-permanent-add-service=http
Turn off the HTTP service (the default configuration equals to shutting down port TCP 80)
Firewall-cmd-permanent-remove-service=http
Overload configuration
Firewall-cmd-reload
Picture description
Reference: CetnOS 7 default firewall FirewallD instructions
Install PHP
The REMI repository provides updated versions of the core packages of CentOS and RHEL, especially the latest PHP/MySQL series
You can use the following command to view warehouse changes at any time during installation
Yum repolist all
Before installing the REMI repository, install the EPEL repository first, because some packages in REMI depend on EPEL
Yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Next, install the REMI repository
Yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Then install the configuration management tools of yum to facilitate the configuration of yum repository
Yum install yum-utils
Enable remi-php71 warehouse
Yum-config-manager-enable remi-php71
Finally, install PHP
Yum install php
After the installation is complete, check the PHP version and extension information
Php-version
Php-modules
Reference: Remi's RPM repository
Install PHP-FPM, simply understand that PHP-FPM is the manager of FastCGI, and FastCGI handles PHP scripts forwarded by Nginx.
Yum install php-fpm
Reference: what is PHP-FPM
Configure Nginx
Now that Nginx, PHP, and PHP-FPM are all installed, how do you get the PHP script running?
First, configure Nginx. The simple configuration is as follows:
Picture description
Then under the www directory, write an index.php, which reads as follows:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.