所有软件下载网址:
r.aminglinux.com
软件下载存放地址:
/usr/local/src/
二进制免编译安装:
mysq5.6下载lhttp://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
[root@ligenkelong src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
解压安装:
[root@ligenkelong src]# tar -zxvf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
[root@ligenkelong src]# mv mysql-5.6.43-linux-glibc2.12-x86_64 /usr/local/mysql
[root@ligenkelong mysql]# useradd mysql
[root@ligenkelong mysql]# mkdir /data
[root@ligenkelong mysql]# ./scripts/mysql_install_db --user=mysql -- #初始化
datadir=/data/mysql
遇到dumper错误:
[root@ligenkelong mysql]# yum install -y perl-Module-Instal
l
配置mysql文件:
复制配置文件:
[root@ligenkelong mysql]# cp support-files/my-default.cnf /etc/my.cnf
编辑配置文件:
启动脚本:
[root@ligenkelong mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@ligenkelong mysql]# chmod 755 /etc/init.d/mysqld
[root@ligenkelong mysql]# vim /etc/init.d/mysqld
[root@ligenkelong mysql]# chkconfig --add mysqld
[root@ligenkelong mysql]# chkconfig mysqld on
[root@ligenkelong mysql]#
[root@ligenkelong mysql]# service mysqld on
[root@ligenkelong mysql]# cd /usr/local/src/
[root@ligenkelong src]# wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@ligenkelong src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb/
[root@ligenkelong mariadb]# cp support-files/my-small.cnf ../my.cnf
[root@ligenkelong local]# vim my.cnf
[root@ligenkelong mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
[root@ligenkelong mariadb]# vim /etc/init.d/mariadb
[root@ligenkelong src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
[root@ligenkelong src]# wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.5.tar.gz
[root@ligenkelong src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.39.tar.gz
解压三个包,之后
[root@ligenkelong src]# ./configure --prefix=/usr/local/apr
[root@ligenkelong src]# make && make install
[root@ligenkelong src]# cd apr-util-1.6.1
[root@ligenkelong src]# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr
如果出现问题:cannot find the library
[root@ligenkelong src]# yum install -y expat-devel
[root@ligenkelong src]# cd httpd-2.4.38 ^C
[root@ligenkelong src]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
安装库文件:
[root@ligenkelong src]# yum -y install pcre-devel
[root@ligenkelong src]# make && make install
[root@ligenkelong src]# wget http://cn2.php.net/distributions/php-5.6.39.tar.bz2
[root@ligenkelong src]# cd php-5.6.39
[root@ligenkelong php-5.6.39]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir -with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
报错一:
configure: xml2-config no found. libxml2 installation
[root@ligenkelong php-5.6.39]# yum -y install libxml2-devel
报错二:
configure:cannot find openssl’s
[root@ligenkelong php-5.6.39]# yum -y install openssl openssl-devel
报错三:
resinstall the bzip2 distribution
[root@ligenkelong php-5.6.39]# yum install -y bzip2-devel
报错四:
png.h not found:
[root@ligenkelong php-5.6.39]# yum install -y libpng-devel
报错五:
freetype.h not found:
[root@ligenkelong php-5.6.39]# yum install -y freetype-devel
报错六:
mcrypt.h not found
yum install -y libmcrypt-devel
成功后,执行
make && make install
安装php7:
步骤基本相似
[root@ligenkelong htdocs]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysql=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
四.apache和php结合:
httpd主配置文件
[root@ligenkelong htdocs]# vim /usr/local/apache2.4/conf/httpd.conf
修改如下:
ServerName
防火墙打开80端口
AddType application/x-httpd-php .php
DirectiryIndex inidex.html index.php
[root@ligenkelong htdocs]# /usr/local/apache2.4/bin/apachectl -M
[root@ligenkelong htdocs]# /usr/local/apache2.4/bin/apachectl graceful
[root@ligenkelong htdocs]# /usr/local/apache2.4/bin/apachectl -t