Manual installation of Ubuntu under apache+mysql+php

Source: Internet
Author: User
Tags administrator password

I. Overview

Because of the project reason, need lamp (linux+apache+mysql+php) environment, the operating system selected as Ubuntu12.04, online installation amp is very simple, a few mouse can, but unfortunately, the use of computers can not be networked, so only offline (manually) installed.

Installing the amp manually seems to have been done a few years ago and now needs to be revisited (note: The installation package for this article is downloaded from the official website). The following is the version of AMP in this article:

MYSQL 5.6

Apache Httpd 2.4.4

php-5.4.14

The installation order is as shown above.

The main purpose of this article is to save the information on the Internet as a record of installation.

Second, the installation procedure of MySQL

1. Download the MySQL 5.6 Deb installation package

2. MySQL's Deb relies on Libaio1,libaio to download the two packages to the Ubuntu website

3. Installing the Asynchronous IO Library

sudo dpkg-ilibaio1_0.3.109-3_amd64.deb

sudo dpkg-ilibaio-dev_0.3.109-3_amd64.deb

4. Install the Deb package

sudo dpkg-i mysql-5.6-debian6.0-i686.deb

The installation should be successful at this time. The following steps are the steps for using MySQL.

5. Prepare for the use of MySQL, set up a dedicated group and account (this article assumes the MySQL account is created, and MySQL is installed under/opt/mysql/server-5.6 and the database data is placed under/usr/local/mysql/data)

Groupadd MySQL

Useradd-r-G MySQL MySQL

Ln-s/opt/mysql/server-5.6/usr/local/mysql

sudo mkdir/usr/local/mysql/data

sudo chown-r MySQL. /usr/local/mysql/data

6. Initializing the database

sudo/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/ Data

7. Start MySQL

Sudo/usr/local/mysql/support-files/mysql.server start

8. Change the MySQL root administrator password

sudo/usr/local/mysql/bin/mysqladmin-u root Password [password you wish to set]

9. Test if you can log in to MySQL

Sudo/usr/local/mysql/bin/mysql-u root-p [optional database name]

Third, the installation of Apache httpd steps

1. Download the httpd-2.4.4.tar.gz installation package, httpd depends on the following 3 packages.

2. Download apr-1.4.6.tar.gz,apr-util-1.5.2.tar.gz package, Apr of all called Apache Portable Runtime.

3. Download the pcre-8.32.tar.gz package, pcre all called Perl Compatible Regular Expressions

4. Compile and install Apr

sudo./configure--prefix=/usr/local/apr

sudo make install

5. Compile and install Apr-util

sudo./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config

sudo make

sudo make install

6. Compile and install Pcre

sudo./configure--prefix=/usr/local/pcre

sudo make install

7. Configure Apache's compilation options

sudo./configure--prefix=/usr/local/apache2--enable-module=most--enable-rewrite--enable-shared=max--enable-so-- with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/

8. Compile and install Apache

sudo make

sudo make install

Some of Apache's usage configuration is not discussed here, it is enough to write a long article, here are some simple configurations.

9. Create a dedicated group and account (this article assumes the Apache account was created and httpd installed under/usr/local/apache2)

Sudogroupadd Apache

Sudouseradd-g Apache Apache

SUDOPASSWD Apache

Sudochown-r Apache:apache/usr/local/apache2

10. Modify the Apache configuration file/usr/local/apache2/conf/httpd.conf, create your own website directory (slightly)

11. Launch Apache

Sudo/usr/local/apache2/bin/apachectl start Apache.

Open the browser, Access http://localhost or http://127.0.0.1, depending on the configuration in your httpd.conf

Iv. installation steps for PHP

1. Download the PHP-5.4.14.TAR.GZ installation package

2. Download the above PHP dependency package Zlib1g_1.2.7.dfsg-13_amd64.deb,liblzma5_5.1.1alpha+20120614-2_amd64.deb under Ubuntu website, libxml2_2.8.0+ Dfsg1-7+nmu1_amd64.deb,libxml2-dev_2.8.0+dfsg1-7+nmu1_amd64.deb

3. Install the dependent packages first, in the order of installation

sudo dpkg-i xxx.deb

4. Configure PHP compilation options

sudo./configure--prefix=/opt/php--with-mysql=/opt/mysql--with-apxs2=/opt/apache/bin/ Apxs--with-config-file-path=/opt/php/etc

Where/opt/mysql is the home directory for MySQL installation,/OPT/APACHE/BIN/APXS is a file that is installed after Apache installation and must be configured correctly

5. Compiling and installing PHP

sudo make

sudo make install

6. Copy php.ini-development or php.ini-production from the PHP installation directory to the PHP configuration file directory specified at compile time/opt/php/etc, similar to the following command

sudo cp Php.ini-xxx/opt/php/etc/php.ini

7. In order to use PHP in Apache, you need to modify the Apache configuration/opt/apache/conf/httpd.conf, which assumes that Apache is installed under/opt/apache, and in this file, locate the " Addtypeapplication "section, add the following after:

AddType application/x-httpd-php. php

Also, verify that the PHP module is being called by Apache at startup, which is the following line in the above file, which is automatically added during the installation of PHP.

LoadModule Php5_module modules/libphp5.so

8. Restart Apache or restart the machine.

9. Verify the installation of PHP. In the Apache Web root directory to create a hello.php file, the file content is as follows, if configured correctly, you can see the server-related information just configured.

<?php

Phpinfo ();

?>

(Note: The individual installation packages mentioned above can be downloaded from here.) )

Manual installation of Ubuntu under apache+mysql+php

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.