设为首页 收藏本站
查看: 474|回复: 0

[经验分享] CentOS+Apache+Mysql+PHP+phpMyadmin源码安装

[复制链接]

尚未签到

发表于 2018-11-23 08:20:37 | 显示全部楼层 |阅读模式
系统版本

CentOS-6.4-x86_64-minimal

系统调整

  

vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
service network restart
vi /etc/selinux/config
SELINUX=disabled
vi /etc/init/start-ttys.conf
env ACTIVE_CONSOLES=/dev/tty[1-2]
vi /etc/sysconfig/init
ACTIVE_CONSOLES=/dev/tty[1-2]
vi /etc/sysctl.conf
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
service iptables stop  &&  chkconfig iptables off
service ip6tables stop  &&  chkconfig ip6tables off
service postfix stop  &&  chkconfig postfix off
yum update
yum install -y vim-common vim-enhanced man gcc-c++ fontconfig cmake openssl-devel


软件获取



mysql-5.6.14         http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.14.tar.gz

apache-2.2.26        http://mirrors.sohu.com/apache/httpd-2.2.26.tar.gz

php-5.5.9            http://mirrors.sohu.com/php/php-5.5.9.tar.gz

libxml2-2.9.0        ftp://xmlsoft.org/libxml2/libxml2-2.9.0.tar.gz

curl-7.36.0          http://curl.haxx.se/download/curl-7.36.0.tar.gz

jpegsrc.v9a          http://www.ijg.org/files/jpegsrc.v9a.tar.gz

libpng-1.5.18        ftp://ftp.simplesystems.org/pub/png/src/libpng15/libpng-1.5.18.tar.gz

freetype-2.5.3       http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.5.3.tar.gz

libmcrypt-2.5.7      ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

autoconf-2.69        http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

phpMyAdmin-4.1.8-all-languages    http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.8/phpMyAdmin-4.1.8-all-languages.tar.gz

  
软件安装

安装mysql


[root@lh ~]# yum install -y ncurses-devel
[root@lh ~]# tar zxvf /var/ftp/pub/mysql-5.6.14.tar.gz -C /usr/src/
[root@lh mysql-5.6.14]# cmake .
[root@lh mysql-5.6.14]# make && make install
[root@lh mysql-5.6.14]# groupadd -r mysql
[root@lh mysql-5.6.14]# useradd -r mysql -g mysql -s /sbin/nologin
[root@lh mysql-5.6.14]# chown -R mysql:mysql /usr/local/mysql/
[root@lh mysql-5.6.14]# ls -ld /usr/local/mysql/
drwxr-xr-x 13 mysql mysql 4096 12月  5 12:38 /usr/local/mysql/
[root@lh scripts]# cd /usr/local/mysql/scripts/
[root@lh scripts]# ./mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql/
[root@lh mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@lh mysql]# chkconfig --add mysql
[root@lh mysql]# chkconfig mysql on
[root@lh mysql]# chkconfig mysql --list
mysql          0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭
[root@lh mysql]# cp /usr/local/mysql/support-files/my-default.cnf /usr/local/mysql/my.cnf
cp:是否覆盖"/usr/local/mysql/my.cnf"? y
[root@lh mysql]# vim /usr/local/mysql/my.cnf
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3678(默认端口3306)
sock = /tmp/mysql.sock
[root@lh mysql]# service mysql start
[root@lh ~]# mysql -uroot
mysql> update mysql.user set password=password('neowave') where User="root";
Query OK, 4 rows affected (0.13 sec)
Rows matched: 4  Changed: 4  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
安装apache


[root@lh pub]# tar zxvf /var/ftp/pub/httpd-2.2.26.tar.gz -C /usr/src/
[root@lh pub]# cd /usr/src/httpd-2.2.26/
[root@lh httpd-2.2.26]# yum install zlib-devel
[root@lh httpd-2.2.26]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd \
--enable-so --enable-rewrite --enable-charset-lite --enable-cgi \
--enable-mods-shared=all --enable-cache --enable-disk-cache --enable-mem-cache \
--enable-static-support
[root@lh httpd-2.2.26]# make && make install
[root@lh httpd-2.2.26]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@lh httpd-2.2.26]# vim /etc/init.d/httpd
#chkconfig:35 10 90
#description:Activates/Deactivates Apache Web Server
[root@lh httpd-2.2.26]# chkconfig httpd --add
[root@lh httpd-2.2.26]# chkconfig httpd on
[root@lh httpd-2.2.26]# chkconfig httpd --list
httpd          0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭
[root@lh ~]# service httpd start
[root@lh httpd-2.2.26]# yum install -y lynx   #(centos-indexhtml)
安装PHP

在安装PHP之前,应先安装PHP5需要的最新版本库文件,例如libxml2、libmcrypt以及GD2库等文件。

安装GD2库是为了让PHP5支持GIF、PNG和JPEG图片格式,所以在安装GD2库之前还要先安装最新的zlib、libpng、freetype和jpegsrc等库文件,而且中间还会穿插安装一些软件



批处理解包脚本代码:tar.sh

  
#!/bin/bash
sdir="/root"                    #tar包所在路径
ddir="/usr/local/src"           #解压目标路径
cd $sdir
#######  将find的结果传递给while循环  #################
find . -maxdepth 1 -type f -name "*.tar.*" -print |sed 's/\.\///g' | while read line
do
tar zxvf $line -C $ddir >> /dev/null  #解压tar包
echo $line >> tar.txt                 #解压过的tar包记录到tar.txt
done
exit 0
libxml2、curl、jpeg、libpng、freetype、libmcrypt的tar包复制到root目录,运行tar.sh批量解包,然后切换到/usr/local/src,逐个编译安装



####  安装libxml2  ####
[root@lh src]# cd libxml2-2.9.0/
[root@lh libxml2-2.9.0]# ./configure --prefix=/usr/local/libxml2  && make  &&  make install
####  安装curl  ####
[root@lh libxml2-2.9.0]# cd ../curl-7.36.0/
[root@lh curl-7.36.0]# ./configure --prefix=/usr/local/curl  &&  make  &&  make install
####  安装jpeg  ####
[root@lh curl-7.36.0]# cd ../jpeg-9a/
[root@lh jpeg-9a]# ./configure --prefix=/usr/local/jpeg  &&  make  &&  make install
####  安装libpng  ####
[root@lh jpeg-9a]# cd ../libpng-1.5.18/
[root@lh libpng-1.5.18]# ./configure --prefix=/usr/local/libpng  && make && make install
####  安装freetype  ####
[root@lh libpng-1.5.18]# cd ../freetype-2.5.3/
[root@lh freetype-2.5.3]# ./configure --prefix=/usr/local/freetype  &&  make  &&  make install
####  安装libmcrypt  ####
[root@lh freetype-2.5.3]# cd ../libmcrypt-2.5.7/
[root@lh libmcrypt-2.5.7]# ./configure --prefix=/usr/local/libmcrypt  &&  make  &&  make install
####  安装PHP  ####
[root@lh php-5.5.9]# ./configure --prefix=/usr/local/php --with-config-file-path=/etc \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-mysql-sock=/tmp/mysql.sock \
--with-iconv --with-openssl --with-gd --with-gettext --with-xmlrpc --with-curl=/usr/local/curl \
--with-zlib --with-mcrypt=/usr/local/libmcrypt/ --with-libxml-dir=/usr/local/libxml2/ \
--with-jpeg-dir=/usr/local/jpeg/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ \
--without-pear --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex \
--enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --enable-zip \
--enable-soap --enable-session --enable-zend-signals --enable-fpm
[root@lh php-5.5.9]# make  &&  make install
[root@lh php-5.5.9]# cp php.ini-production /etc/php.ini
编辑apache主配置文件(httpd.conf)添加php支持

[root@lh ~]# vim /etc/httpd/httpd.conf

Addtype application/x-httpd-php .php .phtml

重启httpd

[root@lh ~]# /usr/local/httpd/bin/apachectl restart

  
安装phpMyadmin

[root@lh ~]# tar zxvf phpMyAdmin-4.1.12-all-languages.tar.gz -C /usr/local/src

[root@lh ~]# mv /usr/local/src/phpMyAdmin-4.1.12-all-languages  /usr/local/httpd/htdocs/phpMyAdmin

[root@lh ~]# cd /usr/local/httpd/htdocs/phpMyAdmin/

[root@lh phpMyAdmin]# cp config.sample.inc.php config.inc.php

[root@lh phpMyAdmin]# vim config.inc.php

$cfg['Servers'][$i]['auth_type'] = 'http';将auth_type 由'cookie'改为'http'

  
测试PHP

[root@lh ~]# vim /usr/local/httpd/htdocs/phpinfo.php


访问http://192.168.120.109/phpinfo.php

访问http://192.168.120.109/phpmyadmin/index.php

输入mysql.user中的用户和密码(要有localhost登陆权限)

  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-638440-1-1.html 上篇帖子: REQUEST_FILENAME apache 虚拟主机中值不”正确“ 下篇帖子: apache +mod_proxy_uwsgi
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表