博客
关于我
LAMP网站平台搭建
阅读量:803 次
发布时间:2023-01-30

本文共 2702 字,大约阅读时间需要 9 分钟。

RHEL5.9/5.10 x86_64 环境下的LAMP堆栈部署指南

准备阶段

安装必要的软件包:

[root@mail~]# yum -y install openssl-devel[root@mail~]# yum -y install ncurses-devel libtermcap-devel[root@mail~]# yum -y install libxml2-devel[root@mail~]# yum -y remove httpd mysql-server mysql php-mysql

httpd 安装与配置

  • 解压源包并安装:
[root@mail~]# tar zxf /软件包路径/httpd-2.2.26.tar.gz -C /usr/src/[root@mailhttpd-2.2.26]# ./configure --prefix=/usr/local/httpd \--enable-so --enable-rewrite --enable-cgi \--enable-charset-lite --enable-ssl \--enable-suexec --with-suexec-caller=daemon \--with-suexec-docroot=/usr/local/httpd/htdocs
  • 执行编译与安装:
[root@mailhttpd-2.2.26]# make[root@mailhttpd-2.2.26]# make install
  • 初始化服务并设置为自动启动:
[root@mail~]# cp -f /usr/local/httpd/bin/apachectl /etc/init.d/httpd[root@mail~]# vim /etc/init.d/httpd
#!/bin/bash#chkconfig: 35 85 15#description: Apache is a World Wide Web Server..[root@mail~]# chmod +x /etc/init.d/httpd[root@mail~]# chkconfig --add httpd

mysql 安装与配置

  • 创建运行账户:
[root@mail~]# useradd -M -u 49 -s /sbin/nologin mysql
  • 安装并配置:
[root@mail~]# tar zxf /软件包路径/mysql-5.1.62.tar.gz -C /usr/src/[root@mailmysql-5.1.62]# ./configure --prefix=/usr/local/mysql \--with-charset=utf8 --with-collation=utf8_general_ci \--with-extra-charsets=gbk,gb2312
  • 执行编译与安装:
[root@mailmysql-5.1.62]# make[root@mailmysql-5.1.62]# make install[root@mailmysql]# bin/mysql_install_db --user=mysql
  • 调整目录权限:
[root@mail~]# chown -R root:mysql /usr/local/mysql/[root@mail~]# chown -R mysql /usr/local/mysql/var/
  • 创建my.cnf配置文件并优化:
[root@mail~]# cp -f /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf[root@mail~]# vim /etc/my.cnf
# skip-lockingskip-external-locking...
  • 添加MySQL库路径并优化:
[root@mail~]# ln -sf /usr/local/mysql/bin/* /usr/local/bin/[root@mail~]# vim /etc/ld.so.conf.d/mysql-64.conf[root@mail~]# ldconfig

mysqld 服务管理

  • 配置服务脚本并设置为自动启动:
[root@mail~]# cp -f /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld[root@mail~]# chmod +x /etc/init.d/mysqld[root@mail~]# chkconfig --add mysqld

php 安装与配置

  • 解包并安装:
[root@mail~]# tar zxf /软件包路径/php-5.4.24.tar.gz -C /usr/src/[root@mailphp-5.4.24]# ./configure --prefix=/usr/local/php \--enable-mbstring --enable-sockets \--with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql \--with-config-file-path=/usr/local/php
  • 编译与安装:
[root@mailphp-5.4.24]# make[root@mailphp-5.4.24]# make install
  • 启用PHP于httpd支持:
[root@mail~]# vim /usr/local/httpd/conf/httpd.conf...LoadModule php5_module modules/libphp5.so
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php...

LAMP 平台的部署与测试

  • 重启服务:
[root@mail~]# service mysqld restart[root@mail~]# service httpd restart
  • 创建测试页面验证连接:
[root@svr5~]# vim /usr/local/httpd/htdocs/test2.php
  • 浏览器访问测试页面:
http://服务器地址/test2.php

应该显示"Success!!"

转载地址:http://bkgyk.baihongyu.com/

你可能感兴趣的文章
MySQL5.7新增Performance Schema表
查看>>
Mysql5.7深入学习 1.MySQL 5.7 中的新增功能
查看>>
Webpack 之 basic chunk graph
查看>>
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
MySQL8修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>