Centos 6.5编译安装LAMP


一、前言1、环境说明基础环境Linux+Apache+MySQL+PHPlinux:6.5Apache 2.2.12mysql:5.6.17php:5.5.122、部署说明php安装目录:/usr/local/phpphp.ini配置文件路径:/usr/local/php/etc/php.iniApache安装目录:/usr/local/nginx二、准备工作1、最小化安装Centos6.5建立一个软件存放目录mkdir /tools 因为刚刚装的系统里面什么都没有,所以直接操作吧[root@mail2 httpd-2.2.32]# setenforce 0 临时禁用selinux [root@mail2 httpd-2.2.32]#server iptables stop 关闭防火墙2、安装必备工具yum-yinstallmakegccgcc-c++gcc-g77flexbisonfilelibtoollibtool-libsautoconfkernel-devellibjpeglibjpeg-devellibpnglibpng-devellibpng10libpng10-develgdgd-develfreetypefreetype-devellibxml2libxml2-develzlibzlib-develglib2glib2-develbzip2bzip2-devellibeventlibevent-develncursesncurses-develcurlcurl-devele2fsprogse2fsprogs-develkrb5krb5-devellibidnlibidn-developensslopenssl-develgettextgettext-develncurses-develgmp-develpspell-develunziplibcaplsof三、安装httpd wget http://apache.fayea.com/httpd/httpd-2.2.32.tar.gztar zxvf httpd-2.2.32.tar.gzcd httpd-2.2.32./configure –prefix=/usr/local/apache –enable-deflate –enable-expires –enable-headers –enable-modules=most –enable-so –with-mpm=worker –enable-rewrite make && make[root@mail2 httpd-2.2.32]# cd /usr/local/apache/bin/apachectl restart 启动httpd[root@mail2 httpd-2.2.32]# ps -ef |grep httpd 检查httpd是否启动编译安装apache默认用户是daemon 如果想修改在主配置文件中修改。三、安装mysql [root@mail2 tools]# groupadd mysql [root@mail2 tools]# useradd -s /sbin/nologin -g mysql -M mysql ####新建一个mysql组和用户MySQL5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具。因此,我们首先要在系统中源码编译安装cmake工具。wgethttp://wwwNaNake.org/files/v2.8/cmake-2.8.12.2.tar.gztarzxvfcmake-2.8.12.2.tar.gzcdcmake-2.8.12.2./configuremake&&makeinstall没有显示error 表示就安装成功。如果出现报错一定看清楚报错再去处理问题。可能是环境问题2、使用cmake来编译安装MySQL 5.6.17wgethttp://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gztarzxvfmysql-5.6.17.tar.gzcdmysql-5.6.17cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/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=/var/lib/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-DMYSQL_USER=mysql-DWITH_DEBUG=0-DWITH_SSL=systemmake&&makeinstall#修改/usr/local/mysql权限chown-Rmysql:mysql/usr/local/mysqlcdsupport-files/#如果还有my.cnf请备份mv/etc/my.cnf/etc/my.cnf.bakcpmy-default.cnf/etc/my.cnf#执行初始化配置脚本,创建系统自带的数据库和表,注意配置文件的路径/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql#拷贝mysql安装目录下support-files服务脚本到init.d目录cpsupport-files/mysql.server/etc/init.d/mysqld#赋予权限、设置开机自启并启动chmod+x/etc/init.d/开发云主机域名mysqldchkconfigmysqldonservicemysqldstart#或者/etc/init.d/mysqlstartMySQL5.6.x启动成功后,root默认没有密码,我们需要设置root密码。设置之前,我们需要先设置PATH,否则不能直接调用mysql#修改/etc/profile文件vim/etc/profile#在文件末尾添加PATH=/usr/local/mysql/bin:$PATHexportPATH#让配置立即生效source/etc/profile#登陆测试,默认是没有密码,直接回车就可进入mysql-uroot-p#设置mysql密码/usr/local/mysql/bin/mysqladmin-uroot-ppassword’你的密码’#登陆进命令行模式mysql-uroot-p#查看用户>selectuser,hostfrommysql.user;#删除不必要的用户>dropuser””@localhost;>dropuserroot@’::1′;#赋予账号远程访问的权限>GRANTALLPRIVILEGESON*.*TO’root’@’127.0.0.1′IDENTIFIEDBY’你的密码’;>GRANTALLPRIVILEGESON*.*TO’root’@’localhost’IDENTIFIEDBY’你的密码’;#其它一些信息查询:#检查mysql版本mysql-uroot-p”密码”-e”selectversion();”四、安装PHP5.5.12wgethttp://mirrors.sohu.com/php/php-5.5.12.tar.gztarzxvfphp-5.5.12.tar.gzcdphp-5.5.12./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql/–enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-magic-quotes –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –disable-fileinfo –enable-maintainer-ztsmake && make install #修改fpm配置php-fpm.conf.default文件名称mv/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf#复制php.ini配置文件cpphp.ini-production/usr/local/php/etc/php.ini#复制php-fpm启动脚本到init.dcpsapi/fpm/init.d.php-fpm/etc/init.d/php-fpm#赋予执行权限chmod+x/etc/init.d/php-fpm#添加为启动项chkconfig–addphp-fpm#设置开机启动chkconfigphp-fpmon#按照标准,给php-fpm创建一个指定的用户和组#创建群组groupaddwww#创建一个用户,不允许登陆和不创主目录useradd-s/sbin/nologin-gwww-Mwww#立即启动php-fpm/etc/init.d/php-fpmstart检查php-fpm 启动情况现在三个应用已经启动成功了,现在测试一下php是否启用成功。Mysql的登陆情况在主配置文件中# DirectoryIndex index.php index.html 加入index.php 311左右加入 AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps重启一下apache /usr/local/apache/bin/apachectl graceful 编译安装的apache 默认的网站存放目录在 /usr/local/apache/htdocs如果显示上面已经成功了。那就测试服务器连接吧如果成功显示mysql welcome to lkq.com已经成功。那现在关闭mysql试试测试看页面

相关推荐: linux 安装mysql 5.7.21详解以及安装过程中所遇问题解决

在安装过程中所遇到的问题有:1、my-default.cnf文件找不到2、mysql启动报错3、mysql临时密码无法登录安装环境centos 6.0下载数据库:[root@CLanguage src]# pwd/usr/local/src #下载文件存放路径…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

Like (0)
Donate 微信扫一扫 微信扫一扫
Previous 06/04 17:47
Next 06/04 17:47

相关推荐