Use the source code to compile and install Apache + MySQL + PHP + phpMyAdmin in Ubuntu

Source: Internet
Author: User
Operating System: ubuntu12.04LTS (64-bit): Check whether the C compiler, C compiler, make, and cmake required to compile the latest mysql version. Run the following command to check whether the compiler software is installed: dpkg-l | grepfilename to check whether gcc, g, make, and cmake are installed in sequence.

Operating System: ubuntu12.04LTS (64-bit): Check whether the C compiler, C compiler, make, and cmake required to compile the latest mysql version. Run the following command to check whether the compiler software is installed: dpkg-l | grep filename to check whether gcc, g, make, and cmake are installed in sequence.

Operating System: ubuntu12.04LTS (64-bit)

The steps for compiling and installation are as follows:

Check the installed compilation tool

C compiler, C ++ compiler, make, and cmake required for compiling the latest mysql version.

The command to check whether the compiler software is installed is:

dpkg –l | grep filename

Check whether gcc, g ++, make, and cmake are installed in sequence.

Check whether software installed by default is available and uninstall it.

If you have installed Apache, mysql, and php, you need to stop the service and uninstall the previous software before working.

Uninstall software commands

apt-get remove –purge softnamedpkg –r xxx.deb
Compile and install libxml2

: Libxml2-2.9.0.tar.gz

cd /usr/local/srctar –zvxf libxml2-2.9.0.tar.gzcd libxml2-2.9.0./configure –prefix=/usr/local/libxml2makesudo make install
Compile and install libmcrypt

: Libmcrypt-2.5.7.tar.gz

cd /usr/local/srctar –zvxf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configure --prefix=/usr/local/libmcryptmakesudo make install
Compile and install zlib

: Zlib-1.2.8.tar.gz

cd /usr/local/srctar –zvxf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremakesudo make install

Note that the installation path of the zlib library cannot be specified during installation; otherwise, the zlib location cannot be found during the installation of the library, and the path manually specified cannot be solved.

Install libpng library

: Libpng-1.6.7.tar.gz

cd /usr/local/srctar –zvxf libpng-1.6.7.tar.gzcd libpng-1.6.7./configure --prefix=/usr/local/libpngmakesudo make install

If a specific installation path is specified for the zlib library in the previous step, the system will prompt zlib that there is no installation problem during configure, and return to the zlib source code for execution.

Make clean re-compile and install

Install IIS6

: Repeated src.v6b.tar.gz

You need to manually create the directory required for installation. It cannot be automatically created during installation.

mkdir /usr/local/jpeg6mkdir /usr/local/jpeg6/binmkdir /usr/local/jpeg6/libmkdir /usr/local/jpeg6/includemkdir –p /usr/local/jpeg6/man/man1cd /usr/local/srctar –zvxf jpegsrc.v6b.tar.gzcd jpeg-6b./configure --prefix=/usr/local/jpeg6 –enable-shared –enable-staticmakesudo make install

Possible error: make:./libtool: Command not found (solution reference this article: Linux installation jpeg-6b error:./libtool command not found)

Install freetype

: Freetype-2.4.10.tar.gz

cd /usr/local/srctar –zvxf freetype-2.4.10.tar.gzcd freetype-2.4.10./configure --prefix=/usr/local/freetypemakesudo make install

For error information and solutions, refer to this article: how to compile and install freetype in Linux and how to solve the error. This article: make: [install] Error 1 (ignore) and how to solve the error.

Install the autoconf Library

: Autoconf-2.68.tar.gz

To install autoconf, you need to install m4 software. Otherwise, configure will not pass, and it is best to install it by default without specifying the prefix. Otherwise, it will be troublesome to install php extensions later.

cd /usr/local/srctar –zvxf autoconf-2.68.tar.gzcd autoconf-2.68./configuremakesudo make install
Install the gd library

: Gd-2.0.35.tar.gz

cd /usr/local/srctar –zvxf gd-2.0.35.tar.gzcd gd-2.0.35./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local/libpng --with-freetype=/usr/local/freetypemakesudo make install

When installing the gd library, the png Library cannot be found. In this case, you need to manually modify the gd_png.c file and find

# Include "png. h"

Change to the actual png Library location

Install the Apache server

: Httpd-2.2.26.tar.gz

cd /usr/local/srctar –zvxf httpd-2.2.26.tar.gzcd httpd-2.2.26./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-include-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-supportmakesudo make install

When installing Apache, the dependent libraries may occur. You need to install apr and apr-util in advance. The installation method of pcre is normal compilation and installation (refer to this article: Use source code compilation and installation of apache2.2.26 in Ubuntu)

Enable apache service

cp /usr/local/apache2/bin/apachectl /sbin/apachectl startnetstat -tnl | grep 80vim /etc/rc.loacl
Install mysql database

: Mysql-5.5.25a.tar.gz

cd /usr/local/srctar –zvxf mysql-5.5.25a.tar.gzcd mysql-5.5.25acmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_DEBUG=0makesudo make install

For installation errors and solutions, refer to this article: Ubuntu12.04 compilation and installation of MySQL 5 errors and Solutions

Create a mysql user

groupadd mysqluseradd -r -g mysql mysql

Permission settings and Authorization Table installation

cd /usr/local/mysqlchown -R mysql .chgrp -R mysql .scripts/mysql_install_db --user=mysqlchown -R root .chown -R mysql data

Create a configuration file

cp support-files/my-medium.cnf /etc/my.cnf

Start mysql Service

bin/mysql_safe --user=mysql&netstat -tnl | grep 3306

Configure mysql Service

cp support-files/mysql.server /etc/init.d/mysqlsudo update-rc.d mysql defaultschkconfig --add mysqlchkconfig mysql on

User Account Control

bin/mysql -urootmysql> DELETE mysql.user WHERE Host='localhost'AND User='';mysql>SET PASSWORD FOR 'root'@'localhost'=PASSWORD('123456');

Startup error: unable to start Couldn't find MySQL server (/usr/bin/mysqld_safe )"

sudo rm /etc/mysql/my.cnf

You can.

Install PHP5.3

: Php-5.3.28.tar.gz

cd /usr/local/srctar –zvxf php-5.3.28.tar.gzcd php-5.3.28./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-pdo-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2 --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg6 --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2 --with-mcrypt=/usr/local/libmcrypt --enable-soap --enable-mbstring=all --enable-socketsmakesudo make install

In PHP5.4 make, a problem occurs.

We need to modify the include/gd_io.h under the gd library directory.

vi 
 
  /include/gd_io.h
 

Add void * data in the gdIOCtx structure;

The format is as follows:

typedef struct gdIOCtx{    int (*getC) (struct gdIOCtx *);    int (*getBuf) (struct gdIOCtx *, void *, int);    void (*putC) (struct gdIOCtx *, int);    int (*putBuf) (struct gdIOCtx *, const void *, int);    /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */    int (*seek) (struct gdIOCtx *, const int);    long (*tell) (struct gdIOCtx *);    void (*gd_free) (struct gdIOCtx *);    void (*data);}gdIOCtx;

Create a PHP configuration file

cp php.ini-development /usr/local/php/etc/php.ini

Add apache support for PHP

vi /etc/httpd/httpd.confAddtype application/x-httpd-php .php .phtmlsudo apachectl stopsudo apachectl start

Create phpinfo. php In the Apache web root directory

 

Test whether the environment is successfully installed

Basically, the installation is complete.

Install and configure phpMyAdmin:

: PhpMyAdmin-4.1.1-all-languages.zip

Unzip phpMyAdmin-4.1.1-all-languages.zipmv phpMyAdmin-4.1.1-all-languages.zip phpmyadminmv phpmyadmin/var/www/(assuming/var/www is the web root directory) cd/var/www/phpmyadmincp config. sample. inc. php config. inc. phpvi config. inc. php

Replace

$cfg['Servers'][$i]['extension'] = 'mysqli';

To:

$cfg['Servers'][$i]['extension'] = 'mysql';

Save and exit, and then access phpmyadmin through http: // localhost/phpMyAdmin in the browser.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.