LAMP+Xcache 环境搭建_MySQL
LAMP
一、Linux
操作系统:CentOS6.4
1.配置好可用的yum源
2.开发环境支持:
# yum groupinstall -y "Development tools"
# yum groupinstall -y "Server Platform Development"
Ubuntu13.04 安装 LAMP/Vsftpd/Webmin/phpMyAdmin 服务及设置http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12)http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat5.4下Web服务器架构之源码构建LAMP环境及应用PHPWindhttp://www.linuxidc.com/Linux/2012-10/72484p2.htm
LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHPhttp://www.linuxidc.com/Linux/2013-05/84882.htm
二、Apache
编译安装httpd-2.4.9
1.安装pcre-devel(依赖包)
#yum install pcre-devel -y
(关于pcre:http://www.linuxidc.com/Linux/2014-04/99536.htm)
#tar -xf apr-1.5.0.tar.bz2 -C /usr/src/
#cd /usr/src/apr-1.5.0
#./configure --prefix=/usr/local/apr //指定其安装位置
# make && make install
(关于apr:http://zh.wikipedia.org/wiki/Apache%E5%8F%AF%E7%A7%BB%E6%A4%8D%E8%BF%90%E8%A1%8C%E6%97%B6)
#tar -xf apr-util-1.5.3.tar.bz2 -C /usr/src/
# cd /usr/src/apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
#tar -xf httpd-2.4.9.tar.bz2 -C /usr/src
# cd /usr/src/httpd-2.4.9
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=most --with-mpm=event
================================================================
释义:
--prefix=/usr/local/apache #→指定其安装位置
--sysconfdir=/etc/httpd #→指定配置文件安装位置
--enable-so #→启用基于DSO的方式动态加载模块
--enable-ssl #→启用基于https协议的功能
--enable-cgi #→启用基于cgi协议的功能
--enable-rewrite #→启用支持URL重写的功能
--with-zlib #→指定支持在互联网上发送数据报文时,通用的压缩库的API
--with-pcre #→指定支持poll的cgi
--with-apr=/usr/local/apr #→指定par的安装路径
--with-apr-util=/usr/local/apr-util/ #→指定par-util的安装路径
--enable-modules=most #→启用大多数常用的模块
--enable-mpms-shared=all #→启用加载所有的mpm模块
--with-mpm=event #→指定接下来httpd的工作模式是event
======================================================================
# make && make install
a).静态:使用--with-mpm=指定模块名称;一旦编译安装完成,无法卸载,只能从新编译安装。
b).动态:使用--enable-mpms-shared选项即可启用此特性。当给出的参数为all时,所有此平台支持的MPM模块都会被安装。可运行时加载,构建 MPM 为动态模块允许通过修改LoadModule指令内容来改变MPM,而不用重新编译安装。
配置:
a).设置pid文件的路径:
#vim /etc/httpd/httpd.conf //添加
PidFile "/var/run/httpd.pid"
#vim /etc/rc.d/init.d/httpd //修改
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
# chmod +x /etc/rc.d/init.d/httpd
# chkconfig --add httpd
# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig httpd on
# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# service httpd start
# ps -elFH
三、MySQL
1.安装
# tar xf mysql-5.5.33-linux2.6-x86_64.tar.gz -C /usr/local
# ln -sv /usr/local/mysql-5.5.33-linux2.6-x86_64 mysql 创建软连接,易于操作
# fdisk /dev/sda //10G
#pvcreate /dev/sda3 //创建物理卷
#vgcreate myvg /dev/sda8 //创建卷组
#lvcreate -L 8G -n mydata myvg //创建逻辑卷
#mke2fs -t ext4 /dev/myvg/mydata //格式化逻辑卷
# mkdir /mydata //创建逻辑卷挂载目录
#mkdri -pv /mydata/data //创建mysql数据存放目录
# vim /etc/fstab //添加开机自动挂载
/dev/myvg/mydata /mydata ext4 defaults 0 0
# mount -a //挂载
3.新建用户以安全方式运行进程
#groupadd -r mysql //创建系统组mysql
#useradd -r -s /sbin/nologin -g mysql mysql -M -D /mydata/data mysql
//创建系统用户mysql
#chown -R mysql:mysql /mydata/data
//设置目录属主属组
4.初始化mysql
# cd /usr/local/mysql
# scripts/mysql_install_db --datadir=/mydata/data --user=mysql
//初始化数据库
# chown -R root .
//设置当前目录所有文件属主为root
5.提供脚本
#cd /usr/local/mysql
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
//设置脚本mysqld
#chmod +x /etc/rc.d/init.d/mysqld
//给脚本执行权限
# chkconfig --add mysqld
//添加开机启动
# chkconfig mysqld on
6.提供配文件
#cd /usr/local/mysql
#cp support-files/my-large.cnf /etc/my.cnf
#vim /etc/my.cnf
thread_concurrency = 2
//修改,并发线程数,bithread_concurrency的值为CPU个数乘以2
datadir = /mydata/data
#添加,mysql数据文件的存放路径:
7.其他配置
# vim /etc/profile.d/mysqld.sh
export PATH=/usr/local/mysql/bin:$PATH
# source /etc/profile.d/mysqld.sh
#vim /etc/man.config
MANPATH /usr/local/mysql/man //添加此行
# ln -sv /usr/local/mysql/include /usr/include/mysql
//输出mysql的头文件至系统头文件路径/usr/include
# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
//输出mysql的库文件给系统库
#ldconfig //重载系统库:
# service mysqld start
# ss -rnl | grep 3306
#mysql
mysql> use mysql
mysql> select host,user,password from user;
mysql> DELETE FROM user WHERE user = ''; //删除空用户
mysql> DELETE FROM user WHERE user = '::1'; //删除ipv6用户
mysql> UPDATE user SET password = PASSWORD('Hoolee') WHERE password = '';
//为root用户设置密码
mysql> FLUSH PRIVILEGES;
更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-05/10187p2.htm

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

Analysis of memory leak phenomenon of Java programs on different architecture CPUs. This article will discuss a case where a Java program exhibits different memory behaviors on ARM and x86 architecture CPUs...

The troubleshooting idea of SSH connection failure after SpringBoot service has been running for a period of time has recently encountered a problem: a Spring...

Choose a reliable trading platform such as OKEx to ensure access to the official entrance.

I encountered a tricky problem when developing a multi-device-compatible website: how to accurately identify the user's browser and device information. After trying multiple methods, I found that directly parsing user-agent strings (User-Agent) are both complex and unreliable, and often misjudgments occur. Fortunately, I successfully solved this problem by installing the WhichBrowser/Parser library using Composer.

macOS is suitable for valuing user experience and hardware and software integration, while Linux is suitable for requiring high customizability and flexibility. macOS is simple and easy to use, seamlessly integrated with Apple products; Linux is open source, adapted to various environments, and has rich community resources.
