- Recently, I have been playing Apache mysql redis, etc., so I summarized the pitfalls I encountered. If I still encounter problems with the step-by-step installation, just leave a message at the bottom of the article and communicate together... I don't want to talk anymore, I'm starting to wave...
- Install centos 7After the system needs to be configured with IP and other information,
- vi /etc/sysconfig/network-scripts/ifcfg-eth0
- BOOTPROTO=static
- The way the network card obtains the ip address, Static (static ip address) dhcp (obtains the ip through the dhcp protocol)
- HWADDR=00:50:56:8E:47:EE network card physical address
- IPADDR=10.0.0.193 Network card IP address
- IPV6INIT=no Whether to enable IPV6
- IPV6_AUTOCONF=no
- NETMASK=255.255.255.0 Network mask corresponding to network card
- NETWORK=192.168.1.0 The network address corresponding to the network card
- ONBOOT=yes Whether to set this network interface when the system is started. When set to yes, this device will be activated when the system is started. Default setting is yes
- service network restart Restart the service or/etc/init.d/network restart
- What you need to change is IPADDR DNS1 GATEWAY DEVICE , just install your own machine and modify it.
- After the modifications are completed, the service network restarts and then ping Baidu to see if you can ping. If you can ping, it means you can surf the Internet.
- Next step, turn off the firewall. The wall of centos 7 is firewall
- systemctl stop firewall.service #Stop firewall
- systemctl disable firewall.service #Disable firewall from booting
- firewall-cmd-state #Check the default firewall state (not running is displayed after turning off, running is displayed after turning on)
- The next step is to upload the apache-dependent package. First, cd it to the root directory and then create a new tools folder, mkdir tools. Upload the dependent package and apache file to the tools below apr-1.6.3.tar.gz 、apr-util-1.6.1.tar.gz、pcre-8.41.zip、openssl-1.0.2n.tar.gz、httpd-2.4.29.tar.gz。
- Start decompressing:
- tar -xzvf apr-1.6.3.tar.gz
- tar -xzvf apr-util-1.6.1.tar.gz
- You need to install uzip yum install -y unzip zip first
- unzip pcre-8.41.zip
- Install apr-1.6.3
- Enter the installation directory
- cd /tools/apr-1.6.3/
- Install and compile
- Install gcc first yum -y install gcc
- ./ configure –prefix=/usr/local/apr
- rm: cannot remove 'libtoolT': No such file or director appears
- cd apr-1.6.3
- modify
- vi configure
- 9365 #RM=$ac_cv_prog_RM
- 9355 #ac_cv_prog_RM=“rm”
- make && make install will not report errors.
- Enter the installation directory
- cd /tools/apr-util-1.6.1/
- yum install -y libxml2-devel
- ./ configure –prefix=/usr/local/apr-util/ –with-apr=/usr/local/apr/bin/apr-1-config
- In CentOS7 minimum installation version, compile and install apr-util error:
- fatal error: expat.h: No such file or director
- Solution: yum install expat-devel
- make && make install
- Enter the installation directory
- cd /tools/pcre-8.41/
- Install and compile
- yum -y install gcc+ gcc-c++
- ./ configure –prefix=/usr/local/pcre
- make && make install
- Enter the installation directory
- tar -xvf openssl-1.0.2n.tar.gz
- cd openssl-1.0.2n
- yum install perl*
- ./ config -fPIC –prefix=/usr/local/openssl –openssldir=/usr/local/openssl
- make && make install
- Install gcc online
- #yum install gcc*
- cd /tools will install the package httpd-2.4.29Copy.tar.gz to the/tools directory
- #tar zxvf httpd-2.4.29.tar.gz
- #cd /tools/httpd-2.4.29
- yum install zlib-devel
- ./ configure –prefix=/opt/apache/apache-2.4.29 –enable-deflate –enable-expires –enable-headers –enable-ssl –enable-cgi –with-zlib –with-mpm=worker –enable-so –enable-rewrite –enable-module=shared –enable-mods-shared=most ap_cv_void_ptr_lt_long=no –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –with-pcre=/usr/local/pcre –with-ssl=/usr/local/openssl –enable-unique –enable-unique_id
- make && make install but an error was reported later
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString’
- /usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler’
- collect2: error: ld returned 1 exit status
- make[2]: *** [htpasswd] Error 1
- make[2]: Leaving directory `/usr/local/httpd-2.4.26/support’
- make[1]: *** [all-recursive] Error 1
- make[1]: Leaving directory `/usr/local/httpd-2.4.26/support’
- make: *** [all-recursive] Error 1
- ① Install libxml2-devel
- 1 [root@test_01 ~]# yum install -y libxml2-devel
- ② Delete the apr-util directory and recompile the installation
- 1
- 2
- 3
- 4
- 5
- [root@test_01 ~]#rm -rf /usr/local/apr-util
- [root@test_01 ~]# cd /tools/apr-util-1.6.1/
- [root@test_01 apr-util-1.6.1]# make clean
- [root@test_01 apr-util-1.6.1]#./ configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
- [root@test_01 apr-util-1.6.1]#make && make install
- Recompile apache and install it will be ok
- Enter the post-installation directory:
- # cd /opt/apache/apache-2.4.29/bin
- Check the process mode:
- # ./ apachectl -l
- Compiled in modules:
- core.c
- worker.c
- http_core.c
- mod_so.c
- Start Apache Web Server:
- #./ apachectl start
- ServerName localhost:80
- Then the browser opens the address and it works appears
- Open the following to boot apache
- Stop Apache Web Server:
- #./ apachectl stop
- 1. Copy the apachectl file to/etc/init.d, and then add the link to/etc/rc.d/rc5.d.
- The order is as follows:
- cp /opt/apache/apache-2.4.29/bin/apachectl /etc/init.d/httpd
- ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S85httpd
- 2. Running chkconfig-list to find that there is no httpd in the list. Adding it by chkconfig-add httpd may remind you that the httpd service does not support chkconfig and you need to edit/etc/rc.d/init.d/httpd
- Add the following comment information:
- # chkconfig: 345 85 15
- # description: Activates/Deactivates Apache Web Server
- 345Represents which linux levels need to be activated httpd, and the activation sequence number is85, the closing sequence number is15
- 3. Run chkconfig-list, httpd exists, and you can use service httpd start and service httpd stop to start and stop services
- startup
- chkconfig –level 2345 httpd on
- The tutorial is finished. If you encounter any problems with apache, you can leave messages and communicate with each other...
program development
Apache installation and automatic startup under centos 7
Recently play Apache mysql redis, etc., so the pit encountered to summarize the next, step by step installation If you still encounter problems, the article […]