Top

LAMP-1

我的环境是Centos 7.4

1. 安装Apache

1.1 安装相关依赖

[root@server src]# yum install apr-devel apr-util-devel -y

1.2 下载源码包并解压

[root@server src]# wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.38.tar.gz
[root@server src]# tar xf httpd-2.4.38.tar.gz
[root@server src]# cd httpd-2.4.38

1.3 编译并安装

[root@server httpd-2.4.38]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite
[root@server httpd-2.4.38]# make && make install
[root@server httpd-2.4.38]# ln -s /usr/local/apache/bin/* /usr/bin/

2. 安装Mysql

2.1 安装相关依赖

[root@server httpd-2.4.38]# yum install cmake make ncurses-devel ncurses -y

2.2 下载源码包并解压

[root@server httpd-2.4.38]# cd /usr/src/
[root@server src]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.43.tar.gz
[root@server src]# tar xf mysql-5.6.43.tar.gz
[root@server src]# cd mysql-5.6.43

2.3 编译并安装

[root@server mysql-5.6.43]# cmake  .  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql55/ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BIG_TABLES=1 -DWITH_DEBUG=0
[root@server mysql-5.6.43]# make -j4 && make -j4 install
[root@server mysql-5.6.43]# cp support-files/my-default.cnf /etc/my.cnf
[root@server mysql-5.6.43]# ln -s /usr/local/mysql55/bin/* /usr/bin/
[root@server mysql-5.6.43]# mkdir -p  /data/mysql
[root@server mysql-5.6.43]# useradd  mysql
[root@server mysql-5.6.43]# /usr/local/mysql55/scripts/mysql_install_db --user=mysql --datadir=/data/mysql/ --basedir=/usr/local/mysql55/
[root@server mysql-5.6.43]# cp support-files/mysql.server /etc/init.d/mysqld && chmod 755  /etc/init.d/mysqld
[root@server mysql-5.6.43]# /etc/init.d/mysqld restart

3. 安装PHP

3.1 下载源码包并解压

[root@server mysql-5.6.43]# cd /usr/src/
[root@server src]# wget http://mirrors.sohu.com/php/php-5.3.28.tar.bz2
[root@server src]# tar jxf php-5.3.28.tar.bz2 
[root@server src]# cd php-5.3.28

3.2 编译并安装

[root@server php-5.3.28]# sed -i 's/void)/void *compiler_globals)/g' /usr/src/php-5.3.28/Zend/zend_language_parser.h 
[root@server php-5.3.28]# ./configure --prefix=/usr/local/php5 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-apxs2=/usr/local/apache/bin/apxs
[root@server php-5.3.28]# make -j4 && make -j4 install

3.3 修改http

[root@server php-5.3.28]# echo "AddType  application/x-httpd-php .php" >> /usr/local/apache/conf/httpd.conf
[root@server php-5.3.28]# echo "ServerName localhost:80" >> /usr/local/apache/conf/httpd.conf

4. 先这样-下回奉上2的.