Environment
name | version | remark |
---|---|---|
OS | CentOS 7.2 | |
repo | Remi | |
Apache | 2.4 | |
PHP | 7.0 | repo: remi-php70 |
Mysql | 5.6 | |
Java | JDK8 |
Add Remi’s RPM Repository
1 | # if there is no epel repo |
Install Apache (httpd)
1 | sudo yum install httpd |
Install MySQL
1 | # add mysql yum repo |
1 | mysql -V |
Install PHP7 and Modules
1 | sudo yum --enablerepo=remi-php70 install php php-mbstring php-xml php-pdo php-mysql |
Install Composer
Composer official site: https://getcomposer.org
Manually install
1 | # download latest snapshot |
Install Java8
According to the official guide, Java (JVM) version
Only Oracle’s Java and the OpenJDK are supported. The same JVM version should be used on all Elasticsearch nodes and clients.
We recommend installing the Java 8 update 20 or later, or Java 7 update 55 or later. Previous versions of Java 7 are known to have bugs that can cause index corruption and data loss. Elasticsearch will refuse to start if a known-bad version of Java is used.
The version of Java to use can be configured by setting the JAVA_HOME environment variable.
1 | # oracle jdk 8u102 |
Other Configurations
MySQL Import Tuning
At the beginning, login mysql , then run following commands:
1 | SET autocommit=0; |
then import sql files, and at the end
1 | COMMIT; |
SELinux Settings
As centos enable SELinux as default, and SELinux is preventing httpd from read access on the file and access db, we need to allow them.
Note: if cloud server disable the SELinux or allow relevant httpd services, the following commands doesn’t need, so try to see SELinux status first.
1 | # show se status |
Apache Configuration
Apache modules
Apache modules: mod_rewrite, mod_deflate, mod_filter
Google PageSpeed Module (optional)
Official site: https://developers.google.com/speed/pagespeed/module/
Apache Listen to Not Standard Port
We may want a service such as Apache to be allowed to bind and listen for incoming connections on a non-standard port. By default, the SELinux policy will only allow services access to recognized ports associated with those services.
A full list of ports that services are permitted access by SELinux can be obtained with:
1 | sudo semanage port -l |
If we wanted to allow Apache to listen on tcp port 82, we can add a rule to allow that using the ‘semanage’ command:
1 | sudo semanage port -a -t http_port_t -p tcp 82 |