Home Database Mysql Tutorial LAMP+Xcache 环境搭建_MySQL

LAMP+Xcache 环境搭建_MySQL

Jun 01, 2016 pm 01:16 PM
linux develop operating system

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to start the server with redis How to start the server with redis Apr 10, 2025 pm 08:12 PM

The steps to start a Redis server include: Install Redis according to the operating system. Start the Redis service via redis-server (Linux/macOS) or redis-server.exe (Windows). Use the redis-cli ping (Linux/macOS) or redis-cli.exe ping (Windows) command to check the service status. Use a Redis client, such as redis-cli, Python, or Node.js, to access the server.

How to use single threaded redis How to use single threaded redis Apr 10, 2025 pm 07:12 PM

Redis uses a single threaded architecture to provide high performance, simplicity, and consistency. It utilizes I/O multiplexing, event loops, non-blocking I/O, and shared memory to improve concurrency, but with limitations of concurrency limitations, single point of failure, and unsuitable for write-intensive workloads.

Where is the Redis restart service Where is the Redis restart service Apr 10, 2025 pm 02:36 PM

How to restart the Redis service in different operating systems: Linux/macOS: Use the systemctl command (systemctl restart redis-server) or the service command (service redis-server restart). Windows: Use the services.msc tool (enter "services.msc" in the Run dialog box and press Enter) and right-click the "Redis" service and select "Restart".

How to create oracle database How to create oracle database How to create oracle database How to create oracle database Apr 11, 2025 pm 02:36 PM

To create an Oracle database, the common method is to use the dbca graphical tool. The steps are as follows: 1. Use the dbca tool to set the dbName to specify the database name; 2. Set sysPassword and systemPassword to strong passwords; 3. Set characterSet and nationalCharacterSet to AL32UTF8; 4. Set memorySize and tablespaceSize to adjust according to actual needs; 5. Specify the logFile path. Advanced methods are created manually using SQL commands, but are more complex and prone to errors. Pay attention to password strength, character set selection, tablespace size and memory

The 5 Pillars of Linux: Understanding Their Roles The 5 Pillars of Linux: Understanding Their Roles Apr 11, 2025 am 12:07 AM

The five pillars of the Linux system are: 1. Kernel, 2. System library, 3. Shell, 4. File system, 5. System tools. The kernel manages hardware resources and provides basic services; the system library provides precompiled functions for applications; the shell is the interface for users to interact with the system; the file system organizes and stores data; and system tools are used for system management and maintenance.

How to view instance name of oracle How to view instance name of oracle Apr 11, 2025 pm 08:18 PM

There are three ways to view instance names in Oracle: use the "sqlplus" and "select instance_name from v$instance;" commands on the command line. Use the "show instance_name;" command in SQL*Plus. Check environment variables (ORACLE_SID on Linux) through the operating system's Task Manager, Oracle Enterprise Manager, or through the operating system.

What is Linux actually good for? What is Linux actually good for? Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

What is the Redis memory management mechanism? What is the Redis memory management mechanism? Apr 10, 2025 pm 01:39 PM

Redis adopts a granular memory management mechanism, including: a well-designed memory-friendly data structure, a multi-memory allocator that optimizes allocation strategies for different sizes of memory blocks, a memory elimination mechanism that selects an elimination strategy based on specific needs, and tools for monitoring memory usage. The goal of this mechanism is to achieve ultimate performance, through fine control and efficient use of memory, minimizing memory fragmentation and improving access efficiency, ensuring that Redis runs stably and efficiently in various scenarios.

See all articles