373 views
Liunx-服务安装

Centos7源码安装LAMP

一、先安装mysql

useradd -s /sbin/nologin mysql –M 创建用户但不生成家目录且不允许登入

1、  解压,复制重命名至/usr/local/mysql

2、  mkdir -p /data/mysql

3、  [root@ying mysql]# chown  -R mysql /data/mysql

4、  [root@ying mysql]# chgrp  -R mysql /data/mysql

5、  ./scripts/mysql_install_db –user=mysql –datadir=/data/mysql初始化库(很重要)

错误1: Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

解决1:重新初始化库

错误2:/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

解决2:yum install -y libaio.x86_64 libaio-devel.x86_64

6、  cd support-files/     cp my-large.cnf /etc/my.cnf  cp:是否覆盖”/etc/my.cnf”? YES

7、  vi /etc/my.cnf  暂时不修改

8、  cp mysql.server /etc/init.d/mysqld  复制添加启动文件

basedir=/usr/local/mysql

datadir=/data/mysql

 

 

二、安装apache  

先下载对应源码包解压

1、yum install -y zlib-devel pcre pcre-devel apr apr-devel

2、yum install -y pcre pcre-devel apr apr-devel

3、[root@localhost httpd-2.2.16]# ./configure –prefix=/usr/local/apache –with-included-apr –enable-so –enable-deflate=shared –enable-expires=shared –enable-rewrite=shared –with-pcre –enable-module=so

4、make  -j8

5、 make install  -j8

验证:/usr/local/apache2/bin/apachectl –M –l –t start| stop| restart |graceful(平滑重启,不关闭服务重启)

 

三、安装php

1、先下载对应源码包解压

./configure \

–prefix=/usr/local/php \

–with-apxs2=/usr/local/apache/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 \

–disable-ipv6

 

注:先下载epel → http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

问题1:error: xml2-config not found. Please check your libxml2 installation.

解决1:yum install -y libxml2-devel

 

问题2:configure: error: Cannot find OpenSSL’s <evp.h>

解决2:yum install -y openssl openssl-devel

 

问题3:configure: error: Please reinstall the libcurl distribution – easy.h should

问题3:configure: error: Please reinstall the libcurl distribution – easy.h should be in <curl-dir>/include/curl/

解决3:yum install -y curl curl-devel

 

问题4:configure: error: Please reinstall the BZip2 distribution

解决4:yum install -y bzip2 bzip2-devel

 

问题5:configure: error: jpeglib.h not found.

解决5:yum install -y libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64

 

问题6:configure: error: png.h not found.

解决6:yum install -y libpng libpng-devel

 

问题7:configure: error: freetype.h not found.

解决7:yum install -y freetype freetype-devel

 

问题8:configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决8:yum install -y libmcrypt-devel

注:先下载epel → http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm默认的yum源没有libmcrypt-devel 这个包,只能借助第三方yum源。

 

四、安装discuz

先下载解压:wget  http://download.comsenz.com/DiscuzX/3.3/Discuz_X3.3_SC_UTF8.zip

1、解压 unzip Discuz_X3.3_SC_UTF8.zip

2、把解压出来的文件移动到apache的发布目录去

cp -r upload/ /usr/local/apache2/htdocs/

3、访问网页apacheIP/upload/install 网页会显示不可写 需要改变属主或者权限

chown -R daemon ./config ./data ./uc*

chown -R777 ./config ./data ./uc*

刷新页面就可以下一步了

4、配置好mysql数据库,填写相关信息即可!

 

五、相关查看命令

1、/usr/local/php/bin/php –m 查看静态库

2、/usr/local/php/bin/php – I 一些配置信息

3、/usr/local/apache2/bin/apachectl -t -D DUMP_MODULES 查看模块

4、/usr/local/apache2/bin/apachectl -l 查看模块

 

 

Leave a Reply

影子专属博客 赣ICP备17013143号