安装前的准备,配置yum查看开发工具: GNOME DesktopEnvironment GNOME SoftwareDevelopment X SoftwareDevelopment Legacy SoftwareDevelopment 必须具备以上的开发工具 [iyunv@localhost ~]# mkdir -pv lamp //创建目录把需要的软件放到这个目录,便于管理 上传需要的软件:如下图
由于httpd-2.4.4 需要apr的支持所以需要安装apr [iyunv@localhost lamp]# tar -zxvfapr-1.4.6.tar.gz -C /usr/local/src/ //解压apr到/usr/local/src [iyunv@localhost lamp]# tar -zxvfapr-util-1.5.1.tar.gz -C /usr/local/src/ //解压apr工具 [iyunv@localhost lamp]# cd/usr/local/src/apr-1.4.6 //进入apr-1.4.6目录 [iyunv@localhost apr-1.4.6]#./configure --prefix=/usr/local/apr //配置apr make && make install //编译安装apr [iyunv@localhost apr-util-1.5.1]#./configure --with-apr=/usr/local/apr/bin/apr-1-config //配置apr-util [iyunv@localhost apr-util-1.5.1]# make&& make install //编译安装apr-util [iyunv@localhost lamp]# tar -jxvfhttpd-2.4.4.tar.bz2 -C /usr/local/src/ //解压安装包 [iyunv@localhost httpd-2.4.4]# cd/usr/local/src/httpd-2.4.4/ //进入源码目录 yum install -y pcre-devel //安装pcre的devel包 --httpd的增强工具 [iyunv@localhost httpd-2.4.4]# ./configure --prefix=/usr/local/appche > --enable-so > --sysconfdir=/etc/httpd [iyunv@localhost httpd-2.4.4]#./configure --prefix=/usr/local/appche--enable-so [iyunv@localhost httpd-2.4.4]#./configure //配置httpd > --prefix=/usr/local/apache > --sysconfdir=/etc/httpd > --enable-so > --enable-ssl > --enable-rewrite >--with-apr=/usr/local/apr/bin/apr-1-config >--with-apr-util=/usr/local/apr/bin/apu-1-config > --with-pcre > --with-z > --enable-mpms-shared=all [iyunv@localhost httpd-2.4.4]# make&& make install //编译安装 [iyunv@localhost apache]# vim/etc/man.config //修改man的配置文件 48 MANPATH /usr/local/apache/man //在47行下面添加这一行 [iyunv@localhost apache]# ln -s/usr/local/apache/include/ /usr/include/apache //处理头文件,放到系统目录 [iyunv@localhost ~]# cd /root/lamp/ //进入上传文件的目录处理脚本 [iyunv@localhost lamp]# vim httpd //编辑脚本 如下图:
[iyunv@localhost lamp]# cp httpd/etc/init.d/ //拷贝到启动目录 [iyunv@localhost lamp]# chmod a+x/etc/init.d/httpd //添加执行权限 [iyunv@localhost lamp]# chkconfig httpd on //设置开机启动 *[iyunv@localhost lamp]# chkconfig --addhttpd //功能如上
Mysql [iyunv@localhost lamp]# tar -zxvfmysql-5.6.10.tar.gz -C /usr/local/src/ //拆包mysql 安装前的准备: Mysql的预安装 # Preconfiguration setup 504shell> groupadd mysql 505shell> useradd -r -g mysql mysql 506# Beginning of source-build specific instructions 507shell> tar zxvf mysql-VERSION.tar.gz 508shell> cd mysql-VERSION 509shell> cmake . 510shell> make 511shell> make install 512# End of source-build specific instructions 513# Postinstallation setup 514shell> cd /usr/local/mysql 515shell> chown -R mysql . 516shell> chgrp -R mysql . 517shell> scripts/mysql_install_db --user=mysql 518shell> chown -R root . 519shell> chown -R mysql data 520# Next command is optional 521shell> cp support-files/my-medium.cnf /etc/my.cnf 522shell> bin/mysqld_safe --user=mysql & 523# Next command is optional 524shell> cp support-files/mysql.server /etc/init.d/mysql.server 525 526 Amore detailed version of the source-build specific instructions 527 is shown following.需要cmake的支持 工具 cmake [iyunv@localhost lamp]# tar -zxvfcmake-2.8.10.2.tar.gz -C /usr/local/src/ //解压cmake 用法:shell>cmake . -L # overview 540shell> cmake . -LH # overview withhelp text 541shell> cmake . -LAH # all params with help text 542shell> ccmake . # interactivedisplay
[iyunv@localhost cmake-2.8.10.2]#cd/usr/local/src/ cmake-2.8.10.2 //进入cmake的源码目录 [iyunv@localhost cmake-2.8.10.2]# make&& make install //编译安装cmake [iyunv@localhost cmake]# vim /etc/profile //编辑profile文件把cmake的bin加入环境变量 45 PATH=$PATH:/usr/local/cmake/bin //在44行后面添加这行 退出;重新登录使环境变量生效 [iyunv@localhost ~]# cd/usr/local/src/mysql-5.6.10/ //进入mysql源码目录 [iyunv@localhost mysql-5.6.10]# cmake . //执行cmake. [iyunv@localhost mysql-5.6.10]# make&& make install //编译安装 [iyunv@localhost mysql]# groupadd mysql //添加组 [iyunv@localhost mysql]# useradd -r -g mysqlmysql //添加帐号 [iyunv@localhost mysql]# chown -Rmysql:mysql . //改变所属组,所属帐号 [iyunv@localhost mysql]# scripts/mysql_install_db --user=mysql //以mysql身份对数据库初始化 [iyunv@localhost mysql]# chown -R root . //改变所有者为root [iyunv@localhost mysql]# chown -R mysql data //但是 data要为mysql [iyunv@localhost support-files]# cpmy-default.cnf /etc/my.cnf //处理mysql的配置文件 [iyunv@localhost support-files]# cpmysql.server /etc/init.d/mysqld //处理mysql的启动文件 [iyunv@localhost support-files]# chmod a+x/etc/init.d/mysqld //给启动文件可执行权限 [iyunv@localhost cmake]# vim /etc/profile //编辑profile文件把cmake的bin加入环境变量 45PATH=$PATH:/usr/local/cmake/bin:/usr/local/mysql/bin //添加 /usr/local/mysql/bin [iyunv@localhost ~]# mysqladmin -u root -ppassword "123" //给mysql设置密码 Enter password: //上次密码为空 [iyunv@localhost ~]# mysql -u root –p //登录mysql [iyunv@localhost mysql]# vim/etc/ld.so.conf.d/mysql.conf //新建文件,处理mysql的库文件 1 /usr/local/mysql/lib //编辑内容 [iyunv@localhost mysql]# ldconfig //刷新缓存 [iyunv@localhost mysql]# ldconfig -pv | grepmysql //查看库文件 [iyunv@localhost mysql]# ln -s/usr/local/mysql/include/ /usr/include/mysql //处理头文件
Php [iyunv@localhost lamp]# tar -jxvfphp-5.4.13.tar.bz2 -C /usr/local/src/ //拆解php [iyunv@localhost php-5.4.13]# cd/usr/local/src/php-5.4.13/ //进入到php源码目录
[iyunv@localhost php-5.4.13]# ./configure--prefix=/usr/local/php //php的配置 > --sysconfdir=/etc/ > --with-apxs2=/usr/local/apache/bin/apxs > --with-zlib > --with-gd > --with-jpeg-dir > --with-png-dir > --enable-mbstring > --with-mysql=/usr/local/mysql/ >--with-mysqli=/usr/local/mysql/bin/mysql_config > --enable-xml > --with-freetype-dir [iyunv@localhost php-5.4.13]# make&& make install //编译安装 [iyunv@localhost php]# vim /etc/profile //处理php的bin文件 45PATH=$PATH:/usr/local/cmake/bin:/usr/local/mysql/bin:/usr/local/php/bin //45行修改如下 退出;重新登录使环境变量生效 [iyunv@localhost ~]# vim/etc/ld.so.conf.d/php.conf //新建文件,处理phl的库文件 /usr/local/php/lib //编辑文件 [iyunv@localhost ~]# ldconfig //刷新缓存 [iyunv@localhost php]# ln -s/usr/local/php/include/ /usr/include/php ////处理头文件 [iyunv@localhost ~]# php –m //查看php的模块 [iyunv@localhost php]# vim/etc/httpd/httpd.conf //编辑apache 的配置文件 149 AddType application/x-httpd-php .php.phtml //在147行下添加这一行 248 DirectoryIndex index.htmlindex.php //在248行追加 index.php [iyunv@localhost php]# service httpd restart //重启apache 服务 [iyunv@localhost php]# service httpd restart/htdocs //进入站点主目录 编辑测试页:
It works!
|