Linux Service Article 12: Source package Build Lamp Server

Source: Internet
Author: User

Lab environment: One Apache server, one MySQL server, one PHP server

Step one: Install the Apache server

1. Install Apr

Yum Install gcc-c++-y

Yum-y Install Epel-release

Tar zxf apr-1.5.2.tar.gz

CD apr-1.5.2

./configure--prefix=/usr/local/apr;echo $?

Make && make Install;echo $?

Cd..

650) this.width=650; "title=" 2.png "alt=" wkiol1xipets18djaak7iyusfzs532.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 72/63/wkiol1xipets18djaak7iyusfzs532.jpg "/>

2, Installation Apr-util

Yum-y Install Epel-release

Tar zxf apr-1.5.2.tar.gz

CD apr-util-1.5.2

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr;echo $?

Make && make Install;echo $?

Cd..

650) this.width=650; "title=" 1.png "alt=" wkiol1xipastzrxmaal4nmaotn4535.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 72/63/wkiol1xipastzrxmaal4nmaotn4535.jpg "/>

3, Installation httpd2.4.12

Yes|yum Install Pcre-devel Openssl-devel

Tar jxf httpd-2.4.12.tar.bz

CD httpd-2.4.12

./configure--prefix=/usr/local/httpd24--sysconfdir=/etc/httpd24--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/-- Enable-modules=most--enable-mpms-shared=all--with-mpm=event;echo $?

Make && make Install;echo $?

650) this.width=650; "title=" 3.png "style=" Float:none; "alt=" wkiom1xiprcj4mzsaao8i0z0ovo121.jpg "src=" http:/ S3.51cto.com/wyfs02/m01/72/66/wkiom1xiprcj4mzsaao8i0z0ovo121.jpg "/>

650) this.width=650; "title=" 4.png "style=" Float:none; "alt=" wkiol1xipy3g0xc7aajexj3jdfm845.jpg "src=" http:/ S3.51cto.com/wyfs02/m02/72/63/wkiol1xipy3g0xc7aajexj3jdfm845.jpg "/>

Second, the installation of MySQL service

1. Install dependent libraries

Yes | Yum install gcc gcc-c++ make cmake ncurses-devel bison perl Lrzsz

650) this.width=650; "title=" 1.png "style=" Float:none; "alt=" wkiom1xirz2i2fakaaef0dc78cs461.jpg "src=" http:/ S3.51cto.com/wyfs02/m00/72/67/wkiom1xirz2i2fakaaef0dc78cs461.jpg "/>

Error! Because Yum installed the old version of the GPG keys caused. The solution is:

rpm--import/etc/pki/rpm-gpg/rpm*

650) this.width=650; "title=" 2.png "style=" Float:none; "alt=" wkiol1xir7vq1w-uaadvahwojsm392.jpg "src=" http:/ S3.51cto.com/wyfs02/m02/72/63/wkiol1xir7vq1w-uaadvahwojsm392.jpg "/>

2. Build Users and Groups

Groupadd MySQL

Useradd mysql-s/sbin/nologin-m-G MySQL

3. Authorization

Mkdir/data/mysqldata-p

Mkdir/usr/local/mysql-p

chown-r mysql.mysql/data/mysqldata/

4. sock file on MySQL

The Mysql.sock file is generated during MySQL runtime and disappears after the service is stopped!

You can specify his path at compile time.

-dmysql_unix_addr=/data/mysqldata/mysqldata.sock

You can also modify the MY.CNF configuration file after compilation is complete
Socket =/data/mysqldata/mysqldata.sock

5. Compile and install

Wget–c http://download.softagency.net/MySQL/Downloads/MySQL-5.5/mysql-5.5.44.tar.gz

Tar XF mysql-5.5.44.tar.gz

CD mysql-5.5.44

Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysqldata-dwith_myisam_storage_engine=1- Dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_tcp_port=3306-denabled_ local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation= Utf8_general_ci-dwith_debug=0-dmysql_user=mysql-dmysql_unix_addr=/data/mysqldata/mysqldata.sock;echo $?

650) this.width=650; "title=" 4.png "alt=" wkiol1xium3scspoaakcs2jmfi0765.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/63/wkiol1xium3scspoaakcs2jmfi0765.jpg "/>

Make && make install; echo $?

650) this.width=650; "title=" 6.png "alt=" wkiol1xiwt_ynhtbaalxsslukii047.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/64/wkiol1xiwt_ynhtbaalxsslukii047.jpg "/>

7. View the installed directory

MySQL installation directory:

650) this.width=650; "title=" 7.png "alt=" wkiom1xiwwtdvd9raal9ndwfxqg496.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/67/wkiom1xiwwtdvd9raal9ndwfxqg496.jpg "/>

Data Catalog:

650) this.width=650; "title=" 8.png "alt=" wkiom1xiwdvxf7goaabgsbtnlly133.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/67/wkiom1xiwdvxf7goaabgsbtnlly133.jpg "/>

8. Copy the MY-LARGE.CHF file from the MySQL installation file to the MY.CNF in the data directory and authorize the user

Cp-arp/soft/mysql-5.5.44/support-files/my-large.cnf/data/mysql3306/my.cnf

Chown-r MySQL. /data/mysql3306/my.cnf

9, Configuration My.cnf

Vim/data/mysqldata/my.cnf

650) this.width=650; "title=" 9.png "alt=" wkiom1xixhcx0ibaaag0m_9_75c770.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/67/wkiom1xixhcx0ibaaag0m_9_75c770.jpg "/>

Add 2 lines of content:

Write Data Directory

DataDir =/data/mysqldata

Basedir =/data/app/mysqldata

As a MySQL master server

Log-bin=mysql-bin

Binlog_format=mixed

Server-id = 1

650) this.width=650; "title=" 11.png "alt=" wkiom1xixfcsgjxhaagw0bduucu203.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 72/67/wkiom1xixfcsgjxhaagw0bduucu203.jpg "/>

10. Initialize the database

cd/usr/local/mysql/

./scripts/mysql_install_db--basedir=/usr/local/mysql/--datadir=/data/mysqldata/--user=mysql

650) this.width=650; "title=" 13.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/72/64/ Wkiol1xiyshtg3unaajw4n4ev4g339.jpg "alt=" Wkiol1xiyshtg3unaajw4n4ev4g339.jpg "/>

650) this.width=650; "title=" 14.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/72/68/ Wkiom1xiykssfsjkaambfyugwfy826.jpg "alt=" Wkiom1xiykssfsjkaambfyugwfy826.jpg "/>

11. Start MySQL

Mkdir/data/sh-p

cd/data/sh/

Vim mysql_3306_start.sh

/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/DATA/MYSQLDATA/MY.CNF &

Set Password after startup

chmod mysql_3306_start.sh

Next set the root password/data/app/mysql3306/bin/mysqladmin-uroot password ' 123.com '

This article from "Bershir-system operation and Maintenance" blog, reproduced please contact the author!

Linux Service Article 12: Source package Build Lamp Server

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.