Compiling Apache 2.4+MySQL 5.7+PHP 5.6 tutorial in Ubuntu (17-12-29 revised version) - Big cats will also be cute

Compiling Apache 2.4+MySQL 5.7+PHP 5.6 tutorial under Ubuntu (17-12-29 revised version)

Author: Big cats can also be cute Classification: Classification: Personal log Published on: 2017-3-4 23:43 ė 20661 views six 5 comments
Hello, everyone. This time I bring you a relatively technical article. Please don't spray it. This article is relatively suitable for novices.
This time, I will show you how to compile Apache 2.4, MySQL 5.7 and PHP 5.6 on Ubuntu. It's like asking why there is no PHP 7.0 or above. Don't worry, because at present, Big Cat hasn't researched it himself, and I will update it at the end of the article
There are many articles about how to install Ubuntu (Ubuntu), so I will not repeat them. Go directly to the installation tutorial. The user name of the Ubuntu system we use this time is ubuntu, and the password is 123. In order to prevent novices from not understanding the special instructions, you can go to the Linunx system introductory tutorial to watch the previous release of Big Cat SSH initial experience article.
Since the software compiled this time is all developed in C, you need to install gcc in make mode, so make should also be installed. Zip is standby to prevent some software packages from being suffixed with. zip
Run the following statement in the command interface
sudo apt-get install make gcc zip build-essential
 Click to enlarge the picture


① , install Apache (apr1.5. x or older)
1. Installation dependency package APR
Download( Download the latest version

cd ~
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz

 Click to enlarge the picture

Unpack APR
tar zxvf apr-1.5.2.tar.gz
 Click to enlarge the picture


Compile APR


2. Install the dependency package APR util
Download( Download the latest version
cd ~
wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz


Unzip APR util
tar zxvf apr-util-1.6.1.tar.gz


3. Install the dependent package PCRE
Download( Download the latest version

cd ~
https://nchc.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz


Unpack PCRE
tar zxvf pcre-8.41.tar.gz


Compile PCRE

4. Official installation of Apache
Download( Download the latest version
cd ~
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz

Unzip Apache
tar zxvf httpd-2.4.29.tar.gz

Compile Apache
sudo apt-get install libssl-dev


② . Install Apache (apr1.6. x)
1. Install the dependent package PCRE
Download( Download the latest version
cd ~
https://nchc.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz


Unpack PCRE
tar zxvf pcre-8.41.tar.gz


Compile PCRE


2. Download Apache( Download the latest version

cd ~
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz


Unzip Apache
tar zxvf httpd-2.4.29.tar.gz


Enter the dependent package storage directory
cd ~/httpd-2.4.29/srclib


Download and decompress apr, apr util( Download the latest version

3. Compile and install Apache
cd ~/httpd-2.4.29
sudo apt-get install libssl-dev libexpat1-dev


5. Configure Apache
1、 Modify Profile
sudo vim /usr/local/apache/conf/httpd.conf

About 160 and 161 lines, change the English words after User and Group to Apache

 Click to enlarge the picture

About 182 lines, set ServerAdmin as the administrator's mailbox, such as: admin@dmyhm.net

About 192 lines, delete the pound sign in front of ServerName, and set the host name, such as www.dmyhm.net

 Click to enlarge the picture

Press i to enter editing, press Shift+Q to exit editing status after editing, and then enter wq to save and exit editing
2、 Add running groups and users to Apache


So far, the installation of Apache has been completed. Let's start Apache to see whether the installation has been completed
Start Apache
sudo /usr/local/apache/bin/apachectl start
If you see the figure below, it means that the startup is successful. If there is an error, please solve it according to the error. If you don't understand, please consult Big Cat. I will try my best to help you solve it

Enter the IP address in the browser to see It works! Indicates that Apache is already running

Install MySQL
Download( Download the latest version
cd ~
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
Unzip MySQL
tar xvf mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
Install each deb package in the following order


sudo dpkg-preconfigure mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
In this step, you need to enter the root password of the database
 Click to enlarge the picture
Installing these packages requires installing dependent packages


Modify Profile
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
--Binding IP modification
Find the line bind address=127.0.0.1
Change to bind address=0.0.0.0
It is not recommended to modify the online environment, because if the 3306 port of the server is open, this operation will allow remote connections
Unused bag, big cat. I don't know what's the use
Start MySQL

sudo service mysql start

 Click to enlarge the picture

If you need to test the connection, please follow the steps below

 Click to enlarge the picture
Install PHP
Download( Download the latest version
cd ~
wget http://cn.php.net/distributions/php-5.6.30.tar.gz
Unzip PHP
tar zxvf php-5.6.30.tar.gz
Install Dependent Packages

Installed lib ssl dev Prompt: configure: error: Cannot find OpenSSL's libraries
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib

Libgmp dev has been installed. Prompt: configure: error: Unable to locate gmp h
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

Libldap2 dev has been installed. Prompt: configure error: Cannot find header file 'ldap. h'
#For 32-bit systems, the directory is/usr/lib/i386-linux-gnu
cd /usr/lib/x86_64-linux-gnu
sudo ln -s /usr/include/ldap.h ldap.h

Close Apache before compiling php
sudo /usr/local/apache/bin/apachectl stop
Compiling PHP

This screen indicates that PHP pre compilation is successful. Now you can execute the make command to compile and install

 Click to enlarge the picture

sudo make
sudo make install
Modify the Apache configuration file httpd.conf
Add PHP to Apache about 388 lines
AddType application/x-httpd-php .html .htm .php .phtml
AddType application/x-httpd-php-source .html .htm .phps
Add. php to the Apache default document. Add about 250 lines after index.html. Add the space+index.php. For example, "index. php". No quotation marks are required
Start Apache
sudo /usr/local/apache/bin/apachectl start
Create a php file
sudo touch /usr/local/apache/htdocs/phpinfo.php
Edit this php file
sudo vim /usr/local/apache/htdocs/phpinfo.php
And write to the document
<? php
phpinfo();
?>
Then save

Finally, enter ip+phpinfo. php to see the result, for example: "192.168.128.129/phpinfo. php"

 Click to enlarge the picture

So far, the entire installation process has been completed. This article has more content than pictures. If you have any questions, please contact Big Cat.

The operating system used in this tutorial is Ubuntu 16.04 LTS

This article is from Big Cat Huimeng. Please indicate the source and the corresponding link when reprinting.

zero
After reading this article, your mood is:
 
nausea
anger
Strongly like
be moved
pass by
boring
Lei Gui
follow

comment

  1. Delight 2017-06-18 01:56  Safari 10.1   Mac OS X 10.12.4
    Here comes the novice
    1. Big cats can also be cute 2017-07-05 19:43  Google Chrome 57.0.2987.110   Windows 7
      @Xinxin: [Stamp] Are you a novice?
      1. Delight 2017-07-06 05:44  Safari 10.1   Mac OS X 10.12.4
        @Big cat can also be cute: I really can't...
      2. Big cats can also be cute 2017-07-06 09:11  Google Chrome 59.0.3071.115   Windows
        @Xinxin: [No words] Is your server not Linux?
      3. Delight 2017-07-06 09:39  Safari 10.1   Mac OS X 10.12.4
        @Big cats will also be cute: OK...

Comment

E-mail addresses will not be made public. Required items have been used * tagging