centos7下源码编译配置 apache2.4+mysql5.6+php7.1
2017-08-27 23:29
435 查看
1:安装mysql:
这里选用mysql5.6版本,5.7版本编译时间需要几个小时。
编译安装环境:
下载mysql5.6
编译源码:
新建下目录:
配置一些信息:
看到最后输出:Build
files have been written to:xxxxxxx证明编译成功
编译源码:
修改文件权限:
设置配置文件:
配置如下:
启动Mysql:
设置开机启动:
文件目录
/data/mysql/data //存储数据表目录
/etc/my.cnf //mysql 配置文件
/usr/local/mysql //mysql安装目录
/usr/local/mysql/bin/mysql -u 账户 -p 密码 //登录到mysql
/usr/local/mysql/support-files/mysql.server start|stop|restart //启动暂停重启
2:安装Apache:
这里选用Apache2.4版本。
Apache2.4依赖包:
apr-1.46.tar.gz 下载:wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.2.tar.gz
apr-util-1.5.1.tar.gz 下载:wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
pcre-8.32.tar.gz 下载:wget https://ftp.pcre.org/pub/pcre/pcre-8.32.tar.gz
apache2.4 下载:wget http://apache.fayea.com//httpd/httpd-2.4.27.tar.gz
安装apr:
安装apr-util:
安装pcre:
安装apache2.4:
配置文件:
启动服务:
浏览器输入localhost,显示"It works!"
(注:实体机不能访问虚拟机web服务器,可以输入 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT(将此处的80改为自己的web服务器的端口号))
3:安装PHP7:
php-7.1.2.tar.gz:下载:wget http://cn2.php.net/get/php-7.1.2.tar.gz/from/this/mirror
安装php:
最后到php的解压目录复制一下php的配置文件
重启Apache服务,然后写一个简单的检测文件吧。
把PHP加入环境变量
在文件末尾加上如下两行代码
这里选用mysql5.6版本,5.7版本编译时间需要几个小时。
编译安装环境:
yum -y installmake gcc-c++ cmake bison-devel ncurses-devel gcc\ autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel*
下载mysql5.6
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz
tarxvf mysql-5.6.16.tar.gz
cd mysql-5.6.16
编译源码:
新建下目录:
mkdir /usr/local/mysql
mkdir /data/mysql/data
配置一些信息:
cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DMYSQL_DATADIR=/data/mysql/data\ -DSYSCONFDIR=/etc\ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci
看到最后输出:Build
files have been written to:xxxxxxx证明编译成功
编译源码:
make && make install(备注:编译时间比较慢,耐心等待...)
修改文件权限:
groupadd mysql useradd -r -g mysql mysql cd /usr/local/mysql chown -R mysql:mysql . scripts/mysql_install_db --user=mysql --ldata=/data/mysql/data chown -R root . chown -R mysql data
设置配置文件:
vim /etc/my.cnf
配置如下:
[client] port=3306 socket=/tmp/mysql.sock [mysqld] port=3306 bind-address=127.0.0.1 basedir=/usr/local/mysql datadir=/data/mysql/data socket=/tmp/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 ############# default settings ################ # time zone default-time-zone = system character-set-server = utf8 default-storage-engine = InnoDB [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
启动Mysql:
cd /usr/local/mysql/support-files ./mysql.server start
设置开机启动:
chkconfig --add mysql ##有的系统需要下面的 chkconfig --level 345 mysql on
文件目录
/data/mysql/data //存储数据表目录
/etc/my.cnf //mysql 配置文件
/usr/local/mysql //mysql安装目录
/usr/local/mysql/bin/mysql -u 账户 -p 密码 //登录到mysql
/usr/local/mysql/support-files/mysql.server start|stop|restart //启动暂停重启
2:安装Apache:
这里选用Apache2.4版本。
Apache2.4依赖包:
apr-1.46.tar.gz 下载:wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.2.tar.gz
apr-util-1.5.1.tar.gz 下载:wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
pcre-8.32.tar.gz 下载:wget https://ftp.pcre.org/pub/pcre/pcre-8.32.tar.gz
apache2.4 下载:wget http://apache.fayea.com//httpd/httpd-2.4.27.tar.gz
安装apr:
#tar -zxvf apr-1.46.tar.gz #cd apr-1.46 #./configure --prefix=/usr/local/apr #make #make install
安装apr-util:
#tar -zxvf apr-util-1.5.1.tar.gz #cd apr-util-1.5.1 #./configure --with-apr=/usr/local/apr #make #make install
安装pcre:
#tar -zxvf pcre-8.32.tar.gz #cd pcre-8.32 #./configure --prefix=/usr/local/pcre(此处出现configure: error: You need a C++ compiler for C++ support #sudo apt-get install g++) #make #make install
安装apache2.4:
#tar -zxvf httpd-2.4.4.tar.gz #cd httpd-2.4.4 #./configure --prefix=/usr/local/apache --enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr/ --with-pcre=/usr/local/pcre/ #make #make install
配置文件:
vim /usr/local/apache/conf/httpd.conf 在“#ServerName www.example.com:80”下面添加一行如下: ServerName localhost:80
启动服务:
usr/local/apache/bin/apachectl start
浏览器输入localhost,显示"It works!"
(注:实体机不能访问虚拟机web服务器,可以输入 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT(将此处的80改为自己的web服务器的端口号))
3:安装PHP7:
php-7.1.2.tar.gz:下载:wget http://cn2.php.net/get/php-7.1.2.tar.gz/from/this/mirror
安装php:
#tar zxvf php-7.1.2.tar.gz #cd php-7.1.2 #./configure --prefix=/usr/local/php7 \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip #make #make install
最后到php的解压目录复制一下php的配置文件
#cp php.ini-development /usr/local/php/lib/php.ini
重启Apache服务,然后写一个简单的检测文件吧。
<?php phpinfo(); ?>
把PHP加入环境变量
#vim /etc/profile
在文件末尾加上如下两行代码
PATH=$PATH:/usr/local/php7/bin export PATH然后执行命令
#source /etc/profile或执行点命令
#./profile使其修改生效,执行完可通过
#echo $PATH命令查看是否添加成功
相关文章推荐
- 年终福利,PHP7+Apache2.4+MySQL5.6 源码编译安装,环境配置,搭建你自己的LAMP环境
- 年终福利,PHP7+Apache2.4+MySQL5.6 源码编译安装,环境配置,搭建你自己的LAMP环境
- CentOS 6.3 安装配置Apache2.2.6的方法(源码编译安装)
- centos 7下编译安装Apache httpd 2.4
- centos64位lamp配置第二步:源码编译apache2.2.25
- CentOS 6.6 编译安装 PHP5.6+MYSQL5.6+APACHE2.4
- CentOS6.8 x64+Nginx1.3.8/Apache-httpd 2.4.3+PHP5.4.8(php-fpm)+MySQL5.5.28+CoreSeek4.1源码编译安装
- Linux[Centos6.3] 源码编译安装配置 SVN+Apache
- centos6下源码编译安装LAMP平台(apache2.4+php5.4+mysql5.5.30)
- CentOS 源码编译安装APACHE2.4
- Centos7下编译安装配置Nginx+PHP+MySql环境
- php5.6+MySQL5.6+Apache2.4下载、安装及配置
- centos7.2源码安装Apache2.4
- centos 7下源码编译安装php支持PostgreSQL
- centos7 apache2.4 多站点配置
- Ubuntu 14.02下编译及配置apache2.4(python CGI)
- Centos编译安装Apache 2.4.6笔记 配置
- CentOS 7 + Apache 2.4 + Flask 0.11 + Python 3.4 + Virtualenv配置过程
- CentOS 6编译安装Apache 2.4
- 【hadoop之翊】——CentOS6.5 Linux上面编译Hadoop2.4源码