LAMP 系统服务搭建过程详解

LAMP 架构在企业里用得非常广泛,目前很多电商公司、游戏公司、移动互联网公司大多都采用这种架构。LAMP指的是Linux、Apache、MySQL、PHP。下面记录了 LAMP 架构系统服务的搭建过程。

一、MySQL数据库安装

1. 系统环境

CentOS 6.4 x86_64 Mini 版本安装

2. 基础软件包安装

[root@vip ~]# yum install gcc vim make wget -y

3. 下载

# 进入源码存放目录[root@vip ~]# cd /usr/local/src# 下载MySQL安装包[root@vip src]# wget downloads.mysql.com/archives/get/file/mysql-5.5.40-linux2.6-x86_64.tar.gz

4. 解压安装

# 拷贝启动脚本[root@vip mysql]# /bin/cp support-files/mysql.server /etc/init.d/mysqld# 赋予可执行权限[root@vip mysql]# chmod 755 /etc/init.d/mysqld

10. 修改启动脚本

[root@vip mysql]# vim /etc/init.d/# 修改设置内容如下basedir=/usr/local/mysql
datadir=/var/lib/mysql

11. 把MySQL添加到服务

# 设置PATH环境变量[root@vip mysql]# echo 'export PATH=$PATH:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh[root@vip mysql]# source /etc/profile.d/mysql.sh

15. 登录MySQL测试

3. 安装必要的库和工具[root@vip src]# install -y pcre pcre-devel apr apr-devel zlib-devel gcc make4. 配置编译参数[root@vip httpd-31]# cd httpd-31[root@vip httpd-31]# ./configure \--prefix=/usr/local/apache2 \--with-included-apr \--enable-so \--enable-deflate=shared \--enable-expires=shared \--enable-rewrite=shared \--with-pcre
[root@vip httpd-31]# echo $?5. 编译安装# 添加到系统服务 并设置开机启动[root@vip httpd-31]# chkconfig --add httpd
[root@vip httpd-31]# chkconfig httpd on9. 验证服务是否正常<span style='font-family: courier new,1)>31]# service httpd starthttpd: apr_sockaddr_info_get() failed for vip    # 出现警告信息httpd: Could not reliably determine the server's fully qualified domain name,using 127.0.0.1 for ServerName解决警告信息的方法:去掉 ServerName www.example.com:80 行的注释#。三、PHP系统安装1. 下载解压安装包[root@vip ~]# cd /usr/local/wget http:cn2.php.net/get/php-5.5.38.tar.gz/from/this/mirror -O php-5.5.38.tar.gz[root@vip src]# tar zxf php-38.install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel \
libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel3. 编译配置安装选项[root@vip php-38]# cd php-38[root@vip php-38]# ./configure \--prefix=/usr/local/php \--with-apxs2=/usr/local/apache2/bin/apxs \--with-config-file-path=/usr/local/php/etc  \--with-mysql=/usr/local/mysql \--with-libxml-dir \--with-gd \--with-jpeg- \--with-png- \--with-freetype- \--with-iconv- \--with-zlib-bz2 \--with-openssl \--with-mcrypt \--enable-soap \--enable-gd-native-ttf \--enable-mbstring \--enable-sockets \--enable-exif \--disable-ipv64. 编译安装5. 拷贝php配置文件IfModule dir_module>DirectoryIndex index.html index.htm index.php    # 添加php索引IfModule<span style=color: rgba(0,courier'>4. 测试配置语法和重启apache服务[root@vip ~]# apachectl -t
Syntax OK
[root@vip ~]# service httpd restart5. 测试php解析编写测试文件:/usr/local/apache2/htdocs/index.php<?phpecho hello php!
?>命令行curl测试:[root@vip htdocs]# curl localhost/index.phphello php![root@vip htdocs]#解析 php 成功!

相关文章

本篇内容介绍了“LNMP服务器环境配置实例分析”的有关知识,...
本篇内容主要讲解“OneinStack如何一键安装LNMP”,感兴趣的...
小编给大家分享一下如何解决LNMP安装composer install时出现...
1.源码安装mysql鉴于前边的文章已经详细说过mysql的源码安装...
Linux是非常热门的技术,也是当下非常受欢迎的操作系统,具有...
██【電:131.乀.1418.乀.6667】【薇q:9788....