One-click LAMP installation in CentOS 7
Not long ago, CentOS was updated to CentOS 7.0.1406. To support this version, the LAMP one-click installation script has undergone a lot of updates and tests, and many problems have been encountered, which are recorded here.
As CentOS 7 redirects the service to systemctl, some of the boot script needs to be rewritten. This process also takes a lot of time to test. At the same time, some dependent packages originally in CentOS 6 do not exist in CentOS 7, such as libc-client-devel, which is necessary for installing php-imap extensions, without it, compilation of PHP extension imap will inevitably encounter errors, so you can only manually compile and install the imap-2007f, and specify the imap extension path.
Removed some dependency packages that do not exist in both the old and new CentOS, such as libmcrypt-devel, and compiled and installed the latest version.
Some of the most important updates are listed as follows.
1. The method for obtaining public IP addresses is changed.
In CentOS 7, ifconfig is not installed by default, that is, the dependency package net-tools. Therefore, the IP address obtained from ifconfig is changed to the curl outer link to obtain the IP address.
Therefore, to install this script, you must ensure the network connection.
2. Manually install some dependent packages
These dependency packages include pcre, libiconv, libmcrypt, mcrypt, re2c, libedit, and imap.
In CentOS 5, too low pcre version will cause Apache compilation failure; MySQL should use readline function, compile and install libedit; PHP extension imap, rely on libc-client shared library, compile and install imap-2007f and so on.
Some of the errors are not detailed on the Internet, especially for Chinese websites. So let's list it here.
PHP compilation error:
Configure: error: utf8_mime2text () has new signature, but U8T_CANONICAL is missing. This shocould not happen. Check config. log for additional information.
This is caused by the lack of dependency packages for imap extensions. Compile and install imap-2007f steps:
wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gztar -zxf imap-2007f.tar.gzcd imap-2007fmake lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd EXTRACFLAGS=-fPIC IP=4rm -rf /usr/local/imap-2007f/mkdir /usr/local/imap-2007f/mkdir /usr/local/imap-2007f/include/mkdir /usr/local/imap-2007f/lib/cp c-client/*.h /usr/local/imap-2007f/include/cp c-client/*.c /usr/local/imap-2007f/lib/cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a
Note: During 64-bit compilation, the make parameter must contain EXTRACFLAGS =-fPIC, but not 32-bit.
In addition, when compiling PHP imap extensions under CentOS 7, add the following parameters:
--with-imap=/usr/local/imap-2007f --with-imap-ssl
When compiling in CentOS 6, because the dependency package libc-client-devel has been installed, the parameters are as follows:
--with-imap--with-imap-ssl--with-kerberos
3. Added some judgment functions.
Added some judgment functions, such as 64-bit and CentOS 7.
4. Update the Startup Script
Apache STARTUP script/etc/init. d/httpd change, copied to the/usr/local/apache/bin/apachectl file, and to/etc/init. d/httpd status is available, with the configuration file/usr/local/apache/conf/extra/httpd-info.conf added.
5. problems that may occur in CentOS 7
After LAMP is installed, you cannot access the website using an IP address. Check the process and find that httpd and mysqld are also started. The firewall seems to be shut down, and the ping is OK, but it cannot be accessed.
After some troubleshooting, the problem is caused by the latest firewalld in CentOS 7. In this case, we need to replace firewalld with the classic iptables-services.
yum -y install iptables-servicessystemctl mask firewalldsystemctl enable iptablessystemctl stop firewalldsystemctl start iptables
6. PHP component support
So far, one-click installation scripts such as LAMP, LNMP, and LANMP have not been fully supported by PHP components. Many of them are missing. The most typical ones are imap and ldap.
To support these components, I have made a lot of improvements and tests. Put a PHP probe here to support all components and four third-party components.
Although the LAMP one-click installation script has been tested in a large number, there will still be some imperfections. If you encounter problems during use, you can go back to http://teddysun.com/lampto and provide comments. The Installation Log lamp is attached. log sends an email to I [at] teddysun.com.